pub fn bfs_distances(
graph: &[Vec<usize>],
source: usize,
) -> HashMap<usize, usize>Expand description
Compute the shortest distance (in number of edges) from source to
every vertex reachable from it.
Returns a map from vertex id to distance. Vertices that are not
reachable from source are absent. source itself maps to 0.
ยงPanics
Panics if source >= graph.len().