Consider the following two graphs:
graph1 = Graph[{1, 2, 3}, {1 -> 3, 2 -> 3}, VertexLabels -> {3 -> 3, 2 -> 2, 1 -> 1}]
graph2 = Graph[{1, 2, 3}, {1 -> 3, 2 -> 3}, VertexLabels -> {3 -> 3, 2 -> 1, 1 -> 2}]
and the list containing both
graphlist = {graph1, graph2}
The code:
testgraphs =
SetProperty[#,
VertexLabels -> {v_ :> Placed[{Style[v, Blue]}, {Above}]}] & /@
graphlist
produces two V-shaped graphs, for which the labels (displayed in Blue) are the same for each vertex (across the graphs).
I expect these to be different as the VertexLabels for graph1 and graph2 are different.
Is there an issue with the code?
v_ :> Placed[{Style[v, Blue]}, {Above}]
labels every node with its name (not with itsVertexLabels
in the input graph.) $\endgroup$