Package elki.database.ids
Interface KNNHeap
-
- All Superinterfaces:
DBIDRef
,DoubleDBIDHeap
- All Known Implementing Classes:
DoubleIntegerDBIDKNNHeap
public interface KNNHeap extends DoubleDBIDHeap
Interface for kNN heaps.To instantiate, use:
DBIDUtil.newHeap(int)
!- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description int
getK()
Get the K parameter ("maxsize" internally).double
getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise.double
insert(double distance, DBIDRef id)
Add a distance-id pair to the heapdefault double
insert(double distance, DBIDRef id, int max)
Deprecated.KNNList
toKNNList()
Serialize to aKNNList
.KNNList
toKNNListSqrt()
Serialize to aKNNList
, but applying sqrt to every distance.-
Methods inherited from interface elki.database.ids.DBIDRef
equals, hashCode, internalGetIndex
-
Methods inherited from interface elki.database.ids.DoubleDBIDHeap
clear, contains, isEmpty, peekKey, poll, size, unorderedIterator
-
-
-
-
Method Detail
-
toKNNList
KNNList toKNNList()
Serialize to aKNNList
. This empties the heap!- Returns:
- KNNList with the heaps contents.
-
toKNNListSqrt
KNNList toKNNListSqrt()
Serialize to aKNNList
, but applying sqrt to every distance. This empties the heap!- Returns:
- KNNList with the heaps contents.
-
insert
double insert(double distance, DBIDRef id)
Add a distance-id pair to the heap- Specified by:
insert
in interfaceDoubleDBIDHeap
- Parameters:
distance
- Distance valueid
- ID number- Returns:
- Distance to the element at the top of the heap
-
insert
@Deprecated default double insert(double distance, DBIDRef id, int max)
Deprecated.Disallowed, becausemax
is fixed.- Specified by:
insert
in interfaceDoubleDBIDHeap
- Parameters:
distance
- Distance valueid
- ID numbermax
- Maximum number of values- Returns:
- Distance to the element at the top of the heap
- Throws:
java.lang.UnsupportedOperationException
-
getK
int getK()
Get the K parameter ("maxsize" internally).- Returns:
- K
-
getKNNDistance
double getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise.- Returns:
- Maximum distance
-
-