Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Beats me. A bug? – Sjoerd C. de Vries Sep 14 '13 at 20:56
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. – István Zachar Sep 14 '13 at 21:11
Furthermore, not even SetProperty works here (as it worked here), in any form. – István Zachar Sep 14 '13 at 21:16
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). – Sjoerd C. de Vries Sep 14 '13 at 21:19
Ok, I report this to the Support. Until then, all graph techniques that are dependent on weights are useless, I suppose. – Ilya Sorokin Sep 16 '13 at 8:32

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)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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