If I have already created a graph using Graph. Later, I want to add to the graph some vertex and/or edge labels, how can I do that?

Thank you.

link|improve this question

43% accept rate
feedback

1 Answer

A random graph without any labeling:

g = RandomGraph[{11, 21}]

enter image description here

You can use SetProperty to add labeling P.S.

SetProperty[g, {EdgeLabels -> {3 \[UndirectedEdge] 4 -> "COOL"}, 
  VertexLabels -> {1 -> "STUFF"}}]

enter image description here

link|improve this answer
actually in version 8.0.0.0, it is not working SetProperty[g, {EdgeLabels -> {3 \[UndirectedEdge] 4 -> "COOL"}, VertexLabels -> {1 -> "STUFF"}}]. Looks like SetProperty can only set one property at a time. – Qiang Li Feb 21 at 22:26
feedback

Your Answer

 
or
required, but never shown

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