Discussion:
VertexWeight not showing in Graph
(too old to reply)
Lou
2011-03-09 12:00:34 UTC
Permalink
Hi All,
I'm using the example in the helpfiles:
Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, EdgeWeight -> {2, 3, 4}]
I read that it's possible to show the edgeweight as a label with
EdgeLabels->"EdgeWeight"
However using that option doesn't show the expected (by me that is..)
2,3 and 4.
See document on edgelabels.
What am I doing wrong?
Kind regards,
Laurent
Bob Hanlon
2011-03-10 11:25:26 UTC
Permalink
I was unable to find anything that indicates EdgeLabels->"EdgeWeight" should work. However, based on the documentation I would use

With[{gr = {1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, wt = {2, 3, 4}},
Graph[gr, EdgeWeight -> wt,
EdgeLabels -> Thread[gr -> wt]]]


Bob Hanlon

---- Lou <***@xs4all.nl> wrote:

=============
Hi All,
I'm using the example in the helpfiles:
Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, EdgeWeight -> {2, 3, 4}]
I read that it's possible to show the edgeweight as a label with
EdgeLabels->"EdgeWeight"
However using that option doesn't show the expected (by me that is..)
2,3 and 4.
See document on edgelabels.
What am I doing wrong?
Kind regards,
Laurent
Peter Pein
2011-03-11 09:35:45 UTC
Permalink
Post by Bob Hanlon
I was unable to find anything that indicates EdgeLabels->"EdgeWeight" should work.
Have a look at the documentation page for EdgeLabels and you'll find in
the "More Information"-paragraph:

The following option settings can be used:
None use no edge labels
"EdgeWeight" use the edge weight as a label
{Subscript[v, i]\[UndirectedEdge]Subscript[v,
j]->Subscript[lbl, ij],\[Ellipsis]} label edge Subscript[v,
i]\[UndirectedEdge]Subscript[v, j] with Subscript[lbl, ij] etc.
Post by Bob Hanlon
However, based on the documentation I would use
With[{gr = {1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, wt = {2, 3, 4}},
Graph[gr, EdgeWeight -> wt,
EdgeLabels -> Thread[gr -> wt]]]
Bob Hanlon
=============
Hi All,
Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, EdgeWeight -> {2, 3, 4}]
I read that it's possible to show the edgeweight as a label with
EdgeLabels->"EdgeWeight"
However using that option doesn't show the expected (by me that is..)
2,3 and 4.
See document on edgelabels.
What am I doing wrong?
Kind regards,
Laurent
I think that is
1. unmistakable
2. not true

Peter
Lou
2011-03-11 09:38:45 UTC
Permalink
I was unable to find anything that indicates EdgeLabels->"EdgeWeight" sho=
uld work. However, based on the documentation I would use
With[{gr = {1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, wt = {2, 3, 4}},
Graph[gr, EdgeWeight -> wt,
EdgeLabels -> Thread[gr -> wt]]]
Bob Hanlon
=============
Hi All,
Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, EdgeWeight -> {2, 3, 4}]
I read that it's possible to show the edgeweight as a label with
EdgeLabels->"EdgeWeight"
However using that option doesn't show the expected (by me that is..)
2,3 and 4.
See document on edgelabels.
What am I doing wrong?
Kind regards,
Laurent
Ok just for the update.
I was using Mathematica 8.0.0 and found in the documentation that the option
Edgelabels->"EdgeWeight" should work.
In fact it did something.. It didn't do anything so there's something
to it! Since when you use Edgelabels->"Blah" you just get that
printed on the edges as expected.
But not with the word EdgeWeight! It's not printing anything.
In Mathematica 8.0.1 however the documentation has removed this option.
But now it does work abit more. Now the edgelabels are printed with
the Edgelabels->"EdgeWeight".
Now isn't that funny!
I hope someone can solve this.
Bob Hanlon
2011-03-12 10:13:00 UTC
Permalink
My documentation (v8.0.1 on a Mac) is apparently different from yours.

Under More Information there are only two entries following the statement "The following option settings can be used: " They are the first and third that you see. There is no statement about "EdgeWeight"


Bob Hanlon


---- Peter Pein <***@dordos.net> wrote:

=============
Post by Bob Hanlon
I was unable to find anything that indicates EdgeLabels->"EdgeWeight" should work.
Have a look at the documentation page for EdgeLabels and you'll find in
the "More Information"-paragraph:

The following option settings can be used:
None use no edge labels
"EdgeWeight" use the edge weight as a label
{Subscript[v, i]\[UndirectedEdge]Subscript[v,
j]->Subscript[lbl, ij],\[Ellipsis]} label edge Subscript[v,
i]\[UndirectedEdge]Subscript[v, j] with Subscript[lbl, ij] etc.
Post by Bob Hanlon
However, based on the documentation I would use
With[{gr = {1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, wt = {2, 3, 4}},
Graph[gr, EdgeWeight -> wt,
EdgeLabels -> Thread[gr -> wt]]]
Bob Hanlon
=============
Hi All,
Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, EdgeWeight -> {2, 3, 4}]
I read that it's possible to show the edgeweight as a label with
EdgeLabels->"EdgeWeight"
However using that option doesn't show the expected (by me that is..)
2,3 and 4.
See document on edgelabels.
What am I doing wrong?
Kind regards,
Laurent
I think that is
1. unmistakable
2. not true

Peter

Loading...