Class MultiSourceBFSAccessMethods
- java.lang.Object
-
- org.neo4j.gds.msbfs.MultiSourceBFSAccessMethods
-
public final class MultiSourceBFSAccessMethods extends java.lang.ObjectMulti Source Breadth First Search implemented as described in [1].The benefit of running this MS-BFS instead of multiple execution of a regular BFS for every source is that the MS-BFS algorithm can collapse traversals that are the same for multiple nodes. If any two or more given BFSs would traverse the same nodes at the same iteration depth, the MS-BFS will traverse only once and group all sources for this traversal.
The consumer of this algorithm provides a callback function, the gets called with:
- the node id where the BFS traversal is at
- the depth or BFS iteration at which this node is traversed
- a lazily evaluated list of all source nodes that have arrived at this node at the same depth/iteration
We use a fixed
ω(OMEGA) of 64, which allows us to implement the seen/visitNext bit sets as a packed long which improves memory locality as suggested in 4.1. of the paper. If the number of sources exceed 64, multiple instances of MS-BFS are run in parallel.If the MS-BFS runs in parallel, the callback may be executed from multiple threads at the same time. The implementation should therefore be thread-safe.
[1]: The More the Merrier: Efficient Multi-Source Graph Traversal
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MultiSourceBFSAccessMethodsaggregatedNeighborProcessing(long nodeCount, org.neo4j.gds.api.RelationshipIterator relationships, BfsConsumer perNodeAction, long[] sourceNodes)static MultiSourceBFSAccessMethodsaggregatedNeighborProcessingWithoutSourceNodes(long nodeCount, org.neo4j.gds.api.RelationshipIterator relationships, BfsConsumer perNodeAction)static MultiSourceBFSAccessMethodspredecessorProcessing(org.neo4j.gds.api.Graph graph, BfsConsumer perNodeAction, BfsWithPredecessorConsumer perNeighborAction, long[] sourceNodes)static MultiSourceBFSAccessMethodspredecessorProcessingWithoutSourceNodes(org.neo4j.gds.api.Graph graph, BfsConsumer perNodeAction, BfsWithPredecessorConsumer perNeighborAction)voidrun(int concurrency, java.util.concurrent.ExecutorService executor)Runs MS-BFS, possibly in parallel.java.lang.StringtoString()
-
-
-
Method Detail
-
aggregatedNeighborProcessingWithoutSourceNodes
public static MultiSourceBFSAccessMethods aggregatedNeighborProcessingWithoutSourceNodes(long nodeCount, org.neo4j.gds.api.RelationshipIterator relationships, BfsConsumer perNodeAction)
-
aggregatedNeighborProcessing
public static MultiSourceBFSAccessMethods aggregatedNeighborProcessing(long nodeCount, org.neo4j.gds.api.RelationshipIterator relationships, BfsConsumer perNodeAction, long[] sourceNodes)
-
predecessorProcessingWithoutSourceNodes
public static MultiSourceBFSAccessMethods predecessorProcessingWithoutSourceNodes(org.neo4j.gds.api.Graph graph, BfsConsumer perNodeAction, BfsWithPredecessorConsumer perNeighborAction)
-
predecessorProcessing
public static MultiSourceBFSAccessMethods predecessorProcessing(org.neo4j.gds.api.Graph graph, BfsConsumer perNodeAction, BfsWithPredecessorConsumer perNeighborAction, long[] sourceNodes)
-
run
public void run(int concurrency, java.util.concurrent.ExecutorService executor)Runs MS-BFS, possibly in parallel.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-