Skip to main content

shortest_path_distances

Function shortest_path_distances 

Source
fn shortest_path_distances(graph: &[f64], n: usize) -> Vec<f64>
Expand description

Unweighted (hop-count) all-pairs shortest-path distances via BFS.

graph is row-major n x n. An edge exists where graph[u*n+v] > 0 (the diagonal is ignored). Unreachable pairs stay f64::INFINITY.