Re: issues with GraphPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg99068] Re: issues with GraphPlot
- From: Bob F <deepyogurt at gmail.com>
- Date: Sun, 26 Apr 2009 01:37:17 -0400 (EDT)
- References: <gsuisc$drq$1@smc.vnet.net>
On Apr 25, 2:50 am, sean_inc... at yahoo.com wrote:
> Hello group,
>
> A few things that I just can't figure out.
>
> 1. EdgeRenderingFunction ignores edge labels.
>
> GraphPlot[{{"B" -> "A" , "+"}, {"A" -> "B", "+"}},
> DirectedEdges -> True, VertexLabeling -> True,
> VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .05],
> Black, Text[#2, #1]} &), EdgeLabeling -> True,
> EdgeRenderingFunction -> ({ Arrowheads[Medium],
> Arrow[#1 , 0.07]} &), PlotStyle -> Thickness[0.005]]
>
> 2. As it is, above code produces a graph that is stretched
> horizontally a bit too much. About the half the horizontal width works
> better for me. How do I accomplish that? AspectRatio-> 1/GoldenRatio
> doesn't work since disk gets stretch also.
>
> 3. For node A to appear on the left, "B"-> "A" has to be defined
> first. If I reverse it, then the node B will appear on the left. What
> is the reason for this?
>
> Thanks in advance for any info.
>
> Sean
Sean,
According to the Documentation Center info about "GraphPlot", the
order the nodes appear in is controlled by the "Method" that GraphPlot
uses. There are seven methods with the default method being
"Automatic" which uses the "SpringElectricalEmbedding" method, but
uses the "RadialDrawing" method if the graph is a tree.. The seven
methods are:
"CircularEmbedding", "RandomEmbedding", "HighDimensionalEmbedding",
"RadialDrawing", "SpringEmbedding" and "SpringElectricalEmbedding".
The method "LinearEmbedding" lays out all vertices on a single line.
See the detailed writeup of GraphPlot for more info. Also here are the
seven possiblities for a simple 2 vertex graph:
GraphPlot[{0 -> 1, 1 -> 0}, DirectedEdges -> True,
VertexLabeling -> True, Method -> "CircularEmbedding"]
GraphPlot[{0 -> 1, 1 -> 0}, DirectedEdges -> True,
VertexLabeling -> True, Method -> "RandomEmbedding"]
GraphPlot[{0 -> 1, 1 -> 0}, DirectedEdges -> True,
VertexLabeling -> True, Method -> "HighDimensionalEmbedding"]
GraphPlot[{0 -> 1, 1 -> 0}, DirectedEdges -> True,
VertexLabeling -> True, Method -> "RadialDrawing"]
GraphPlot[{0 -> 1, 1 -> 0}, DirectedEdges -> True,
VertexLabeling -> True, Method -> "SpringEmbedding"]
GraphPlot[{0 -> 1, 1 -> 0}, DirectedEdges -> True,
VertexLabeling -> True, Method -> "SpringElectricalEmbedding"]
GraphPlot[{0 -> 1, 1 -> 0}, DirectedEdges -> True,
VertexLabeling -> True, Method -> "LinearEmbedding"]
-Bob