Re: Re: changing style of vertices for ShowGraph with Combinatorica
- To: mathgroup at smc.vnet.net
- Subject: [mg86381] Re: [mg86348] Re: [mg86332] changing style of vertices for ShowGraph with Combinatorica
- From: "J. McKenzie Alexander" <jalex at lse.ac.uk>
- Date: Mon, 10 Mar 2008 02:01:56 -0500 (EST)
- References: <200803070729.CAA19892@smc.vnet.net> <C63D1D41-0058-431D-A84D-4418E66DBF46@lse.ac.uk> <200803081044.FAA13587@smc.vnet.net> <C5476BB7-775D-44D1-8046-346E75B094A0@lse.ac.uk> <200803091001.FAA12363@smc.vnet.net>
It's not surprising that no edges are labelled in the first example for two reasons. First, the custom definition of EdgeRenderingFunction overrides the setting for EdgeLabeling, as Carl Woll pointed out. Second, the graph generated by Cycle[3] doesn't specify any labels for the edges. Unless specific edge labels are given, even the default definition of EdgeRenderingFunction doesn't do anything, as the following example illustrates. GraphPlot[{1 -> 2, 2 -> 3, 3 -> 1}, VertexLabeling -> True, EdgeLabeling -> True ] In my second example, I deliberately specified labels for the edges and gave a custom definition for EdgeRenderingFunction which would draw the labels over the middle of the edge. What was surprising, in this case, was that the edge labels weren't being passed in as the third argument. Hence my comment about it possibly being a bug. On 9 Mar 2008, at 10:01, Murray Eisenberg wrote: > The first example profered shows precisely part of the difficulty: No > edges are labeled! > > J. McKenzie Alexander wrote: >> Setting the option VertexLabeling->True has no effect when a custom >> definition is provided for VertexRenderingFunction, as VertexLabeling >> only affects how the default rendering function draws the >> vertices. If >> you want vertex labels provided you need to include that in the >> definition of the custom rendering function. >> >> Look up the documentation for VertexRenderingFunction and >> EdgeRenderingFunction to see what additional arguments are >> provided. The >> first argument for VertexRenderingFunction is the position of the >> vertex. The second argument is the label. So the following works: >> >> GraphPlot[Cycle[3], Method -> Automatic, VertexLabeling -> True, >> EdgeLabeling -> True, EdgeRenderingFunction -> ({Black, Line[#1]} &), >> VertexRenderingFunction -> ({EdgeForm[{Thickness[0.005], Red}], >> Yellow, >> Disk[#1, 0.04], Black, Text[#2, #1]} &)] >> >> You can drop the option settings for VertexLabeling and >> EdgeLabeling and >> get the same effect. >> >> As for whether GraphPlot plays well with the Combinatorica graph >> structure, it does handle vertex labels correctly but not edge >> labels, >> as the following example illustrates. I was personally surprised to >> find that the edge labels were not passed to >> EdgeRenderingFunction. I >> think this might be a bug. >> >> GraphPlot[ >> Graph[{{{1, 2}, EdgeLabel -> "e1"}, {{2, 3}, EdgeLabel -> "e2"}, >> {{3, 1}, >> EdgeLabel -> "e3"}}, >> {{{-0.5, 0.866}, VertexLabel -> "a"}, >> {{-0.5, -0.866}, VertexLabel -> "b"}, >> {{1., 0}, VertexLabel -> "c"}}], >> EdgeRenderingFunction -> ({Black, Line[#1], >> Text[#3, Mean[#1]] >> } &), >> VertexRenderingFunction -> ({EdgeForm[{Thickness[0.005], Red}], >> Yellow, >> Disk[#1, 0.04], Black, Text[#2, #1]} &)] >> >> Cheers, >> >> Jason >> Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm
- References:
- changing style of vertices for ShowGraph with Combinatorica
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: changing style of vertices for ShowGraph with Combinatorica
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: changing style of vertices for ShowGraph with Combinatorica
- From: Murray Eisenberg <murray@math.umass.edu>
- changing style of vertices for ShowGraph with Combinatorica