Skip to main content

parallel_bfs

Function parallel_bfs 

Source
pub fn parallel_bfs(graph: &CsrGraph, source: usize) -> Result<BfsResult>
Expand description

Perform a level-synchronous parallel BFS from a source node.

At each level, the current frontier is processed in parallel: each node’s neighbors are checked, and unvisited neighbors are added to the next frontier.

§Arguments

  • graph - The CSR graph to traverse
  • source - The source node for BFS

§Returns

A BfsResult containing distances, parents, and traversal statistics.

§Complexity

  • Time: O((V + E) / P) with P threads, plus O(L) synchronization barriers where L is the BFS depth
  • Space: O(V) for distances, parents, and frontier arrays