Class ANPStrategy

  • All Implemented Interfaces:
    ExecutionStrategy

    public class ANPStrategy
    extends java.lang.Object
    implements ExecutionStrategy
    "Aggregated Neighbor Processing" (ANP) strategy as described in The More the Merrier: Efficient Multi-Source Graph Traversal http://www.vldb.org/pvldb/vol8/p449-then.pdf

    The ANP strategy provides two invariants:

    • For a single thread, a single node is traversed at most once at a given depth – That is, the combination of (nodeId, depth) appears at most once per thread. It may be that a node is traversed multiple times, but then always at different depths.
    • For multiple threads, the (nodeId, depth) may appear multiple times, but then always for different sources.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void prepareNextVisit​(org.neo4j.gds.api.RelationshipIterator relationships, long nodeVisit, long nodeId, org.neo4j.gds.core.utils.paged.HugeLongArray nextSet, int depth)  
      void run​(org.neo4j.gds.api.RelationshipIterator relationships, long totalNodeCount, org.neo4j.gds.msbfs.SourceNodes sourceNodes, org.neo4j.gds.core.utils.paged.HugeLongArray visitSet, org.neo4j.gds.core.utils.paged.HugeLongArray visitNextSet, org.neo4j.gds.core.utils.paged.HugeLongArray seenSet, @Nullable org.neo4j.gds.core.utils.paged.HugeLongArray seenNextSet)  
      protected boolean stopTraversal​(boolean hasNext, int depth)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ANPStrategy

        public ANPStrategy​(BfsConsumer perNodeAction)
    • Method Detail

      • run

        public void run​(org.neo4j.gds.api.RelationshipIterator relationships,
                        long totalNodeCount,
                        org.neo4j.gds.msbfs.SourceNodes sourceNodes,
                        org.neo4j.gds.core.utils.paged.HugeLongArray visitSet,
                        org.neo4j.gds.core.utils.paged.HugeLongArray visitNextSet,
                        org.neo4j.gds.core.utils.paged.HugeLongArray seenSet,
                        @Nullable
                        @Nullable org.neo4j.gds.core.utils.paged.HugeLongArray seenNextSet)
        Specified by:
        run in interface ExecutionStrategy
      • stopTraversal

        protected boolean stopTraversal​(boolean hasNext,
                                        int depth)
      • prepareNextVisit

        protected void prepareNextVisit​(org.neo4j.gds.api.RelationshipIterator relationships,
                                        long nodeVisit,
                                        long nodeId,
                                        org.neo4j.gds.core.utils.paged.HugeLongArray nextSet,
                                        int depth)