pub fn connected_components<N, FN, IN>(
    starts: &[N],
    neighbours: FN
) -> Vec<HashSet<N>>
where N: Clone + Hash + Eq, FN: FnMut(&N) -> IN, IN: IntoIterator<Item = N>,
Expand description

Extract connected components from a graph.

  • starts is a collection of vertices to be considered as start points.
  • neighbours is a function returning the neighbours of a given node.

This function returns a list of sets of nodes forming disjoint connected sets.