Package org.neo4j.gds.paths.traverse
Class BFS
- java.lang.Object
-
- org.neo4j.gds.Algorithm<org.neo4j.gds.core.utils.paged.HugeLongArray>
-
- org.neo4j.gds.paths.traverse.BFS
-
public final class BFS extends org.neo4j.gds.Algorithm<org.neo4j.gds.core.utils.paged.HugeLongArray>Parallel implementation of the BFS algorithm. It uses the concept of bucketing/chunking to keep track of the ordering of the visited nodes. Conceptually, a bucket keeps all nodes at a fixed distance from the starting node. The nodes within each bucket are kept in a list ordered by their final position in the output BFS ordering. To implement parallelism, the nodes within a bucket are processed concurrently. For this, the nodes of the bucket are partitioned into chunks, where each chunk contains a continuous segment from the list of nodes. Threads are then assigned chunks in parallel and process (relax) each node within the assigned chunk. To maintain a correct ordering, once the parallel processing phase has concluded, we perform a sequential step, where we examine the chunks from earliest to latest to create the next bucket, such that a correct BFS ordering is returned where all descendants from the nodes of a chunk, appear together before those from a later chunk.
-
-
Field Summary
Fields Modifier and Type Field Description static intALL_DEPTHS_ALLOWED
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.neo4j.gds.core.utils.paged.HugeLongArraycompute()static BFScreate(org.neo4j.gds.api.Graph graph, long startNodeId, ExitPredicate exitPredicate, Aggregator aggregatorFunction, int concurrency, org.neo4j.gds.core.utils.progress.tasks.ProgressTracker progressTracker, long maximumDepth)voidrelease()
-
-
-
Field Detail
-
ALL_DEPTHS_ALLOWED
public static final int ALL_DEPTHS_ALLOWED
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static BFS create(org.neo4j.gds.api.Graph graph, long startNodeId, ExitPredicate exitPredicate, Aggregator aggregatorFunction, int concurrency, org.neo4j.gds.core.utils.progress.tasks.ProgressTracker progressTracker, long maximumDepth)
-
compute
public org.neo4j.gds.core.utils.paged.HugeLongArray compute()
- Specified by:
computein classorg.neo4j.gds.Algorithm<org.neo4j.gds.core.utils.paged.HugeLongArray>
-
release
public void release()
- Specified by:
releasein classorg.neo4j.gds.Algorithm<org.neo4j.gds.core.utils.paged.HugeLongArray>
-
-