Macaulay2 » Documentation
Packages » Graphs :: connectedComponents(Graph)
next | previous | forward | backward | up | index | toc

connectedComponents(Graph) -- Computes the connected components of a graph

Synopsis

Description

A connected component is a list of vertices of a graph that are connected, in other words there exists a path of edges between any two vertices in the component.

i1 : G = graph(toList(1..8),{{1,2},{2,3},{3,4},{5,6}});
i2 : connectedComponents G

o2 = {{1, 2, 3, 4}, {5, 6}, {7}, {8}}

o2 : List

See also

Ways to use this method: