find the connected components of a graph
vertex of G
Important: The networks package has been deprecated. Use the superseding command GraphTheory[ConnectedComponents] instead.
The components of the graph G are returned as a set of sets. The number of sets indicates the number of components while the elements of the sets indicate the vertices belonging to each component.
If a second argument of the form root=v is given, then only the single component containing the vertex v is constructed.
A set of subgraphs corresponding to each component can be constructed by mapping induce() onto the set of components.
This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[components](...).
G ≔ random⁡12,6:
Download Help Document