graph1 = SetProperty[graph1, VertexLabels -> Table[i -> Placed[{Style[i, Blue], 
    Style[PropertyValue[{graph1, i}, VertexIndex], Red]}, {Before, After}], 
{i, VertexList[graph1]}]]

does not display the indices in Red (gives an error).

is there a way to fix this?

This question is related to: Graphs: colouring vertex weights differently from vertices



graph1 = SetProperty[graph1,VertexLabels->Table[i->Placed[

It turns out PropertyValue is being replaced by AnnotationValue. Even so, calling AnnotationKeys[{graph1,First@VertexList[graph1]}] shows that a graph vertex has the following inbuilt annotations (formerly properties)


VertexIndex is a function on graphs just like VertexList, vertices do not store their index.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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