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

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

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:


The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/Graphs.m2:3221:0.