Macaulay2 » Documentation
Packages » Graphs :: numberOfComponents
next | previous | forward | backward | up | index | toc

numberOfComponents -- computes the number of connected components of a graph



A connected component is a list of vertexSet of a graph that are connected, i.e. there exists a path of edges between any two vertexSet in the component.

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

See also

Ways to use numberOfComponents :

For the programmer

The object numberOfComponents is a method function.