connected_components

Function connected_components 

Source
pub fn connected_components<V: Eq + Hash + Clone + Debug>(
    graph: &Graph<V>,
) -> Vec<Vec<usize>>
Expand description

Finds all connected components of an undirected graph.

A connected component is a subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the supergraph.

§Arguments

  • graph - The graph to analyze.

§Returns

A Vec<Vec<usize>> where each inner Vec represents a connected component.