Re: GraphPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg70808] Re: [mg70775] GraphPlot
- From: Matt Curcio <matt at aggregateknowledge.com>
- Date: Sat, 28 Oct 2006 05:21:48 -0400 (EDT)
- References: <200610270428.AAA24447@smc.vnet.net> <4541F805.6080501@wolfram.com>
Carl, Thanks for your reply. Sorry I was unclear, let me try to explain better with a simpler example. When you run the code: << DiscreteMath`GraphPlot`; GraphPlot[{1 -> 2, 2 -> 3, 3 -> 1, 3 -> 4, 5 -> 6, 6 -> 5}, VertexStyleFunction -> (Text[#, #] &) You see two graphs with the vertices labeled. The rightmost graph is composed of the components {5->6, 6->5}. But the only way I know that is because I've labeled the vertices and my dataset above is so small. What I would like is a function that does the following: MagicalGraphCoordinatesFunction[ {1 -> 2, 2 -> 3, 3 -> 1, 3 -> 4, 5 - > 6, 6 -> 5} ]; which returns: {{1 -> 2, 2 -> 3, 3 -> 1, 3 -> 4}, {5 -> 6, 6 -> 5}} i.e. A list with the elements of the two directed graphs in my data. I am essentially using GraphPlot to discover how many directed graph clusters are in my data. Its great to visualize them, but I would really like to know which elements make up the subgraphs. Thanks again, Matt On Oct 27, 2006, at 5:13 AM, Carl Woll wrote: > Matt Curcio wrote: > >> Hi, >> I have a question about extracting data from the internals of >> GraphPlot. For example, the following code plots multiple >> subplots of disconnected clusters. >> >> << DiscreteMath`GraphPlot` >> n = 129; >> d = Table[i -> Mod[i^2, n], {i, 0, n - 1}]; >> GraphPlot[d]; >> >> However, I would like to know the subsets that are being plotted. >> I know you can plot the vertex labels on the chart, but my >> dataset is ~50,000 connected vertices and GraphPlot outputs ~100 >> clusters, so vertex labeling is unrealistic. It would be very >> interesting to know which vertices GraphPlot has associated. >> There maybe a way to do this using some functions from >> "Combninatorica" but I have not been able to find them. Can >> anyone help? >> >> Thanks, >> Matt >> > I'm not clear on what you want, but have you tried StrongComponents > from the GraphPlot package? This function will give you a list of > the vertices in each disconnected cluster (assuming the graph is > undirected). In your example, we would convert d to an undirected > graph and then use StrongComponents: > > comps = StrongComponents[ Join[d, Reverse/@d] ]; > > In[30]:= > Length[comps] > Out[30]= > 14 > > Carl Woll
- References:
- GraphPlot
- From: Matt Curcio <matt@aggregateknowledge.com>
- GraphPlot