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.
A random graph without any labeling:
g = RandomGraph[{11, 21}]
You can use SetProperty
to add labeling P.S.
SetProperty[g, {EdgeLabels -> {3 \[UndirectedEdge] 4 -> "COOL"},
VertexLabels -> {1 -> "STUFF"}}]
SetProperty[g, {EdgeLabels -> {3 \[UndirectedEdge] 4 -> "COOL"}, VertexLabels -> {1 -> "STUFF"}}]
. Looks like SetProperty
can only set one property at a time.
$\endgroup$