Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: GraphPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70824] Re: [mg70809] Re: [mg70775] GraphPlot
  • From: Bruce Colletti <vze269bv at verizon.net>
  • Date: Sat, 28 Oct 2006 23:37:56 -0400 (EDT)

Carl

In v5.2, why does: 

     GraphPlot[{...}, VertexStyleFunction -> (Text[#, #] &)

fail when {0,-1} is the Text offset?

     GraphPlot[{1 -> 2, 2 -> 3, 3 -> 1, 3 -> 4, 5 -> 6, 6 -> 5},   
VertexStyleFunction -> (Text[#, #,{0,-1}] &)

Thankx.

Bruce




=====================
From: Carl Woll <carlw at wolfram.com>
To: mathgroup at smc.vnet.net
Subject: [mg70824] [mg70809] Re: [mg70775] GraphPlot

Matt Curcio wrote:

> 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

Did you try the code I gave in my last post? Trying it out on this 
example, we have:

gr={1 -> 2, 2 -> 3, 3 -> 1, 3 -> 4, 5 -> 6,   6 -> 5}

In[9]:=
StrongComponents[Join[gr, Reverse /@ gr]]
Out[9]=
{{1, 2, 3, 4}, {5, 6}}

This isn't quite what you asked for, but it's close.

Carl Woll
Wolfram Research

>
>
>
> 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
>


  • Prev by Date: Re: DisplayTogether & PlotLegend incompatibility
  • Next by Date: Why all the if's the answer (revised!!!)
  • Previous by thread: Re: GraphPlot
  • Next by thread: Re: Re: GraphPlot