SOLUTIONS

BUILTIN MATHEMATICA SYMBOL
ConnectedComponents[g]
gives the connected components of the graph g.
ConnectedComponents[g, {v_{1}, v_{2}, ...}]
gives the connected components that include at least one of the vertices , , ... .
ConnectedComponents[g, patt]
gives the connected components that include a vertex that matches the pattern patt.
DetailsDetails
 ConnectedComponents returns a list of components , where each component is given as a list of vertices.
 For an undirected graph, the vertices u and v are in the same component if there is a path from u to v.
 For a directed graph, the vertices u and v are in the same component if there is a directed path from u to v and from v to u.
 For directed graphs, strongly connected components are computed.
 For undirected graphs, the components are ordered by their length, with the largest component first.
 For directed graphs, the components are given in an order such that there are no edges from to , , etc.
New in 8  Last modified in 9
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »