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?

  • $\begingroup$ 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. $\endgroup$
    – Szabolcs
    Feb 13, 2013 at 20:26
  • 1
    $\begingroup$ @Szabolcs Ok no problem. Is this ok? $\endgroup$
    – Lou
    Feb 13, 2013 at 20:35

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

  • $\begingroup$ This was discussed in the mathgroup a year ago. Apparently this was documented in 8.0.0 and disappeared in later versions. $\endgroup$ Feb 13, 2013 at 21:51
  • $\begingroup$ @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. $\endgroup$
    – Lou
    Feb 13, 2013 at 22:08
  • $\begingroup$ @SjoerdC.deVries stackoverflow.com/q/7381085/353410 $\endgroup$ Feb 13, 2013 at 22:25
  • $\begingroup$ @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. $\endgroup$ Feb 13, 2013 at 22:29
  • $\begingroup$ @SjoerdC.deVries youtube.com/watch?v=emAe6IClGys $\endgroup$ Feb 13, 2013 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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