[Date Index]
[Thread Index]
[Author Index]
Re: Re: changing style of vertices for ShowGraph with Combinatorica
*To*: mathgroup at smc.vnet.net
*Subject*: [mg86347] Re: [mg86307] Re: changing style of vertices for ShowGraph with Combinatorica
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Sun, 9 Mar 2008 05:00:56 -0500 (EST)
*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst
*References*: <fqqrql$k9j$1@smc.vnet.net> <200803081040.FAA13262@smc.vnet.net>
*Reply-to*: murray at math.umass.edu
So far so good, but this raises lots of questions:
(1) Why Text[#2,#1] in the pure function for VertexRenderingFunction?
(Except that an example appears in the Documentation Center where this
is used. To what do the arguments refer?
(2) What about edge labeling? If I specify a graph directly like this...
g = {{1 -> 2, "a"}, {2 -> 3, "b"}, {3 -> 1, "c"}};
... then I can produce (and even PARTIALLY format) labels for it as follows:
GraphPlot[g,
VertexRenderingFunction -> ({EdgeForm[{Thick, Red}],
FaceForm[Yellow], Disk[#1, 0.05], Text[#2, #1]} &),
EdgeLabeling -> True, BaseStyle -> {FontSize -> 18}]
I said "partially" because, for example, I cannot change the font color
in that BaseStyle specification. And the edge labels are superimposed
upon (i.e., inset into) the edge lines. I can imagine providing an
EdgeRenderingFunction to change that, but it seems like it would be
rather complicated.
To do the same sort of thing with a But how do I do the same thing for a
Combinatorica-type Graph object? For example:
g=Cycle[3]
I thought perhaps that using SetGraphOptions or this g might help, but
the documentation for SetGraphOptions is almost useless. Despite that
documentation, I could get the following to work:
g = Cycle[3];
g = SetGraphOptions[g,
{{{1,2}, EdgeLabel->"a"}, {{2,3},EdgeLabel->"b"},
{{3,1}, EdgeLabel->"c"}}]
ShowGraph[g]
However, using GraphPlot instead displays no edge labels with this:
GraphPlot[g,
VertexRenderingFunction -> ({EdgeForm[{Thick, Red}],
FaceForm[Yellow], Disk[#1, 0.05], Text[#2, #1]} &),
EdgeLabeling -> True]
And I am at a loss as to how to use EdgeRenderingFunction to display the
edge labels I specified in the SetGraphOptions. The documentation is
just so horribly inadequate (at least for me) as to give no clue.
Perhaps somebody else has a clue, or has managed to stumble upon this
despite the non-documentation.
(3) And where, exactly, is all this documented carefully? (I'm
addressing this last question really to WRI!) With GraphPlot, as with
Combinatorica, the documentation is skimpy -- to be generous about the
situation.
(I write all this from the standpoint of one who is trying to use
Combinatorica's graph-theoretic functions for students who are relative
Mathematica beginners.)
Steve Luttrell wrote:
> You could use the native GraphPlot function to plot your
> Combinatorica-defined graph as follows:
>
> Needs["Combinatorica`"]
>
> g = Cycle[3];
>
> GraphPlot[g,
> VertexRenderingFunction -> ({EdgeForm[{Thick, Red}],
> FaceForm[Yellow], Disk[#1, 0.05], Text[#2, #1]} &)]
>
> Stephen Luttrell
> West Malvern, UK
>
> "Murray Eisenberg" <murray at math.umass.edu> wrote in message
> news:fqqrql$k9j$1 at smc.vnet.net...
>> With Mathematica 6, I can change the default style (medium black disk)
>> for rendering the vertices of a Combinatorica Graph like this:
>>
>> Needs["Combinatorica`"]
>>
>> g = Cycle[3];
>> ShowGraph[g, VertexStyle -> Disk[Large], VertexColor -> Red]
>>
>> But how can I, for example, change the vertex style so it is, say, a
>> large yellow disk with a thick red boundary? Or even just change it to
>> be a circle? I tried "obvious" things like the following, but they
>> cause errors:
>>
>> ShowGraph[g, VertexStyle -> Graphics[Circle[], ImageSize -> 20]]
>>
>> --
>> Murray Eisenberg murray at math.umass.edu
>> Mathematics & Statistics Dept.
>> Lederle Graduate Research Tower phone 413 549-1020 (H)
>> University of Massachusetts 413 545-2859 (W)
>> 710 North Pleasant Street fax 413 545-1801
>> Amherst, MA 01003-9305
>>
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Prev by Date:
**Re: Assignment problem**
Next by Date:
**Re: changing style of vertices for ShowGraph with Combinatorica**
Previous by thread:
**Re: changing style of vertices for ShowGraph with Combinatorica**
Next by thread:
**Re: changing style of vertices for ShowGraph with Combinatorica**
| |