Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.
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

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)

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.