|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractQueue<E>
de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap<E>
de.lmu.ifi.dbs.elki.utilities.datastructures.heap.TopBoundedHeap<E>
de.lmu.ifi.dbs.elki.utilities.datastructures.heap.TiedTopBoundedHeap<DistanceResultPair<D>>
de.lmu.ifi.dbs.elki.utilities.datastructures.heap.KNNHeap<D>
D - distance typepublic class KNNHeap<D extends Distance<D>>

Heap used for KNN management.
| Nested Class Summary | |
|---|---|
static class |
KNNHeap.Comp<D extends Distance<D>>
Comparator to use. |
| Nested classes/interfaces inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap |
|---|
Heap.Itr |
| Field Summary | |
|---|---|
private D |
maxdist
Maximum distance, usually infiniteDistance |
private static long |
serialVersionUID
Serial version |
| Fields inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.TopBoundedHeap |
|---|
maxsize |
| Fields inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap |
|---|
modCount, size |
| Constructor Summary | |
|---|---|
KNNHeap(int k)
Simplified constructor. |
|
KNNHeap(int k,
D maxdist)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
add(D distance,
DBID id)
Add a distance-id pair to the heap unless the distance is too large. |
int |
getK()
Get the K parameter ("maxsize" internally). |
D |
getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise. |
D |
getMaximumDistance()
Get maximum distance in heap |
KNNList<D> |
toKNNList()
Serialize to a KNNList. |
ArrayList<DistanceResultPair<D>> |
toSortedArrayList()
Return the heap as a sorted array list, by repeated polling. |
| Methods inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.TiedTopBoundedHeap |
|---|
clear, contains, handleOverflow, iterator, peek, poll, size |
| Methods inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.TopBoundedHeap |
|---|
getMaxSize, offer |
| Methods inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap |
|---|
castQueueElement, compare, compareExternal, compareExternalExternal, heapifyDown, heapifyUp, heapifyUpParent, putInQueue, removeAt, swap |
| Methods inherited from class java.util.AbstractQueue |
|---|
add, addAll, element, remove |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
private static final long serialVersionUID
private final D extends Distance<D> maxdist
| Constructor Detail |
|---|
public KNNHeap(int k,
D maxdist)
k - k Parametermaxdist - k-distance to return for less than k neighbors - usually
infiniteDistancepublic KNNHeap(int k)
null as kNN distance with less
than k entries.
k - k Parameter| Method Detail |
|---|
public ArrayList<DistanceResultPair<D>> toSortedArrayList()
Heap
toSortedArrayList in class Heap<DistanceResultPair<D extends Distance<D>>>public KNNList<D> toKNNList()
KNNList. This empties the heap!
public int getK()
public D getKNNDistance()
public D getMaximumDistance()
public boolean add(D distance,
DBID id)
distance - Distance valueid - ID number
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||