networks
components
find the connected components of a graph
Calling Sequence
Parameters
Description
Examples
components(G)
components(G, root=v)
G
-
graph
v
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](...).
with⁡networks:
G≔random⁡12,6:
ends⁡G
2,3,2,10,2,12,3,8,4,6,6,8
components⁡G
1,5,7,9,11,2,3,4,6,8,10,12
components⁡G,root=5
5
See Also
GraphTheory
GraphTheory[ConnectedComponents]
networks(deprecated)[bicomponents]
networks(deprecated)[random]
with
Download Help Document