|
[Date Index]
[Thread Index]
[Author Index]
How do I use EdgeRenderingFunction in GraphPlot with one command
- To: mathgroup at smc.vnet.net
- Subject: [mg89255] How do I use EdgeRenderingFunction in GraphPlot with one command
- From: Pavithra Harsha <pavithra at mit.edu>
- Date: Sun, 1 Jun 2008 16:33:54 -0400 (EDT)
Hi,
I am new to Mathematica and I would like to use GraphPlot for drawing
graphs. I have a color and a thickness attribute for each edge of the
graph. I have extended my code from on the posts on thickness
(http://forums.wolfram.com/mathgroup/archive/2008/Feb/msg00327.html).
So, here is how I modified it. But the problem I have is that the
attributes are getting matched with the edges in a different order.
Clear[getThickness];
Clear[getColor];
Clear[e];
Array[Freq, 3];
Freq[1] = 0.004; Freq[2] = 0.012; Freq[3] = 0.004;
Array[Color, 3];
Color[1] = Red; Color[2] = Blue; Color[3] = Green;
count = 1;
getThickness[d_] := {getThickness[d] = Freq[count]; count++;}
ColorCount = 1;
getColor[d_] := {getColor[d] = Color[ColorCount]; ColorCount++;}
e = {LGA -> PHX, PHX -> LGA, LGA -> BOS};
g = GraphPlot[e, DirectedEdges -> True, VertexLabeling -> True,
EdgeRenderingFunction -> ({getColor[#1],
Thickness[getThickness[#1]], Arrowheads[{{.05, .8}}],
Arrow[#1]} &)]
Here the order of the edges it takes are 1,3,2 rather than 1,2,3 which is
the order of the attributes given. This is just a small example but my
problem has about 900 edges and the order of the attributes gets more
complicated as one proceeds. Can you please help me how I can modify this.
Thanks.
`````````````````````````````````````````````````````````````````````````````
Operations Research Center, MIT
77 Massachusetts Avenue, Bldg. E40-130
Cambridge MA 02139
Phone No: 617-253-7412
Prev by Date:
Re: Default location for Exported files?
Next by Date:
Re: ImportString error
Previous by thread:
Re: How to use a returned pure function from say, Maximize
Next by thread:
Re: How do I use EdgeRenderingFunction in GraphPlot with one command
|