Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I noticed that the Mathematica 9.0 documentation only mentions the usage of "Name" to label the vertexlabel or edgelabel in the Graph. Is there an option to use the Weights automatically just as "Name" does?

share|improve this question
    
Could you please split this into a separate question and answer to comply with the format of the site? It is okay to answer your own question. –  Szabolcs Feb 13 '13 at 20:26
1  
@Szabolcs Ok no problem. Is this ok? –  Lou Feb 13 '13 at 20:35
add comment

1 Answer 1

I found that "EdgeWeight" and "VertexWeight" are next to "Name" also possible candidates.

Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 
  3 \[UndirectedEdge] 1}, VertexWeight -> {100, f[x], 300}, 
 EdgeWeight -> {10 || 20, Prime[x], g[x]^2}, 
 VertexLabels -> "VertexWeight", EdgeLabels -> "EdgeWeight", 
 ImagePadding -> 20]

Mathematica graphics

share|improve this answer
    
This was discussed in the mathgroup a year ago. Apparently this was documented in 8.0.0 and disappeared in later versions. –  Sjoerd C. de Vries Feb 13 '13 at 21:51
    
@SjoerdC.deVries Yes that is correct. At that time this option however didn't work and got removed from the docs. Apparently it got fixed but the documentation was not updated. VertexWeight was also missing in the 8.0 docs. –  Lou Feb 13 '13 at 22:08
    
@SjoerdC.deVries stackoverflow.com/q/7381085/353410 –  belisarius Feb 13 '13 at 22:25
    
@belisarius Totally forgot that we had that discussion there as well. I checked that it doesn't work in 8.0.4, but it does in 9.0.1. –  Sjoerd C. de Vries Feb 13 '13 at 22:29
    
@SjoerdC.deVries youtube.com/watch?v=emAe6IClGys –  belisarius Feb 13 '13 at 22:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.