I’m trying to find the connected components of a very large directed graph with Mathematica 9 and have been having trouble with the ConnectedComponents function. I have been working with smaller components of the graph, but the ConnectedComponents function has not been recognizing the smaller graph images that the GraphPlot command produces. Here is an example of the code I’ve been using:
in[1]:= g = GraphPlot[{file1 → file6, file1 → file2, file1 → file3, file2 → file7, file3 → file9}, DirectedEdges → True]
out[1]:= (A small directed graph, the GraphPlot command works fine)
in[2]:= ConnectedComponents
ConnectedComponents::graph: A graph object is expected at position 1 in ConnectedComponents
out[2]:= (same as in[2])
If the first line properly outputs a graph, why doesn’t the next like properly read it? I’ll attach a screenshot of my code to show what’s going wrong.