Package org.neo4j.gds.similarity.knn
Class NeighborList
- java.lang.Object
-
- org.neo4j.gds.similarity.knn.NeighborList
-
public class NeighborList extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longadd(long element, double priority, java.util.SplittableRandom random, double perturbationRate)Tries to add the given element with the given priority to this list.java.util.stream.LongStreamelements()voidfilterHighSimilarityResults(double threshold)filterHighSimilarityResults will override the original array in priorityElementPairs keeping only the results with similarity greater than or equal to threshold.static org.neo4j.gds.core.utils.mem.MemoryEstimationmemoryEstimation(int capacity)java.util.stream.Stream<SimilarityResult>similarityStream(long nodeId)intsize()
-
-
-
Method Detail
-
memoryEstimation
public static org.neo4j.gds.core.utils.mem.MemoryEstimation memoryEstimation(int capacity)
-
elements
public java.util.stream.LongStream elements()
-
size
public int size()
-
add
public long add(long element, double priority, java.util.SplittableRandom random, double perturbationRate)Tries to add the given element with the given priority to this list. This method and data structure is purpose-built for KNN, which counts the number of insertions per round. To simplify that logic, we return 1 or 0 instead of true or false. This allows KNN to just add the return values together without having the check on each of them.
-
similarityStream
public java.util.stream.Stream<SimilarityResult> similarityStream(long nodeId)
-
filterHighSimilarityResults
public void filterHighSimilarityResults(double threshold)
filterHighSimilarityResults will override the original array in priorityElementPairs keeping only the results with similarity greater than or equal to threshold. It will write all high similarity elements at the beginning of the array and re-define elementCount.- Parameters:
threshold- we keep all results with similarity greater than or equal to threshold.
-
-