Class NeighborList


  • public class NeighborList
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      java.util.stream.LongStream elements()  
      void filterHighSimilarityResults​(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.MemoryEstimation memoryEstimation​(int capacity)  
      java.util.stream.Stream<SimilarityResult> similarityStream​(long nodeId)  
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.