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; |
The object numberOfComponents is a method function.