Re: label graph vertices
- To: mathgroup at smc.vnet.net
- Subject: [mg74493] Re: label graph vertices
- From: dh <dh at metrohm.ch>
- Date: Fri, 23 Mar 2007 19:04:24 -0500 (EST)
- References: <ett7ks$id6$1@smc.vnet.net>
Hi Alessandro,
this can e.g. be done withthe "VertexStyleFunction" options. E.g.:
In[35]:=
labels = Table[StringJoin["Label", ToString[i]], {i, 12}];
GraphPlot[{1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5,
5 -> 6, 6 -> 7, 7 -> 8, 8 -> 1, 1 -> 9,
2 -> 9, 3 -> 10, 4 -> 10, 6 -> 11, 5 -> 11,
7 -> 12, 8 -> 12},
"EdgeStyleFunction" -> (Arrow[{#1, #2}] & ),
"VertexStyleFunction" -> ({Text[labels[[#1]], #1]} & )]
Daniel
alexxx.magni at gmail.com wrote:
> greetings,
> after having used for some time a very powerful program (Graphviz) for
> displaying the graph structures I'm working on, I decided to give it a
> try under Mathematica, since I use M. for many other related tasks.
>
> I started from DiscreteMath`GraphPlot`, but from what I can see
> everything is done using an adjacency matrix composed of (0,1)'s,
> right?
> That is, my problem is that I need to LABEL the vertices with a name,
> instead of a position.
>>From http://documents.wolfram.com/mathematica/functions/AdvancedDocumentationGraphPlot
> I thought for a moment it was possible (e.g. see graph under
> "MaximalBipartiteMatching" with Tom,Rob,Adam etc), but I then realized
> it was demonstration-only, and no code is present to do it
>
> am I right, or there is a way?
>
> thanks for any help...
>
> Alessandro Magni
>
>