Bug introduced in 9.0.1 or earlier and fixed in 10.0

g = CompleteGraph[8, VertexSize -> Medium];

PropertyValue[{g, VertexList[g][[1]]}, VertexWeight] = 10;    
PropertyValue[g, VertexWeight]
{10, 1, 1, 1, 1, 1, 1, 1}
PropertyValue[{g, VertexList[g][[2]]}, VertexWeight] = 10;    
PropertyValue[g, VertexWeight]
{1, 10, 1, 1, 1, 1, 1, 1}
PropertyValue[{g, VertexList[g][[3]]}, VertexWeight] = 10;
PropertyValue[g, VertexWeight]
{1, 1, 10, 1, 1, 1, 1, 1}

How come that I see only the last result from PropertyValue? It applies only to VertexWeight property. When I set VertexStyle (like in docs), everything is fine: I can change the vertex color one by one.

  • $\begingroup$ Beats me. A bug? $\endgroup$ Sep 14, 2013 at 20:56
  • $\begingroup$ Interestingly, the very same examples work with VertexLabels instead of VertexWeight, so I guess VertexWeights always resets the weights for all vertices to 1 (the default value) when setting with PropertyValue[...] = val. Definitely unwanted behaviour, but sadly it is just one in a long list of annoyances with Graph... You should report it to Tech Support. $\endgroup$ Sep 14, 2013 at 21:11
  • $\begingroup$ Furthermore, not even SetProperty works here (as it worked here), in any form. $\endgroup$ Sep 14, 2013 at 21:16
  • $\begingroup$ I also note that the example in SetProperty's doc page (Scope/Basic Properties) PropertyValue[{%, 1}, VertexWeight] shows a result of $Failed, indicating a problem at the time of generating the docs (though it now executes as intended). $\endgroup$ Sep 14, 2013 at 21:19
  • $\begingroup$ Ok, I report this to the Support. Until then, all graph techniques that are dependent on weights are useless, I suppose. $\endgroup$ Sep 16, 2013 at 8:32

1 Answer 1


The answer from the Tech Support:

I have reproduced this problem and agree that the behavior with VertexWeight is not desirable. I have filed a report with our developers on the problem so that it can be fixed in a future version of Mathematica.

Ticket number is 265525 (just in case)


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.