Skip to main content

bfs_sequential

Function bfs_sequential 

Source
pub fn bfs_sequential(
    adj: &CsrMatrix,
    sources: &[NodeId],
) -> Result<Vec<Distance>>
Expand description

Sequential BFS implementation.

Uses a queue-based approach with O(V + E) complexity.

§Arguments

  • adj - Adjacency matrix in CSR format
  • sources - Source nodes to start BFS from

§Returns

Vector of distances, one per node. Distance::INFINITY for unreachable nodes.