szhorvat
(Szabolcs Horvát)
July 10, 2014, 6:43pm
1
It is very easy to set or change multiple options of a graphics objects with Show:
Show[g, Frame -> True, Axes -> False, PlotRange -> All, ...]
One may often want to do this with Graphs. It’s been always bothering me that I can’t see an easy way to do it. Now that I took the time to think about it and write up a question, one idea that came to mind is:
Fold[
SetProperty,
CompleteKaryTree[5],
{
EdgeStyle -> Directive[Thick, Orange],
VertexStyle -> White,
GraphLayout -> "SpringElectricalEmbedding"
}
]
It’s still rather tedious compared to how easy it is to use Show.
Is there a recommended official way to do this type of graph manipulation? Is there a better, easier way than above?
Vitaliyk
(Vitaliy Kaurov)
July 11, 2014, 7:29am
2
This produced an identical output for me on versions 9 and 10:
SetProperty[
CompleteKaryTree[5],
{EdgeStyle -> Directive[Thick, Orange],
VertexStyle -> White,
GraphLayout -> "SpringElectricalEmbedding"}]
Does this work for you? This documentation example points to that.
szhorvat
(Szabolcs Horvát)
July 11, 2014, 3:45pm
3
Thank you Vitaliy, I knew there had to be a simpler solution!
I would like to suggest adding an additional function signature to the documentation. Now it mentions
SetProperty[{obj, itemspec}, name -> value]
only. It would be helpful to also list
SetProperty[{obj, itemspec}, {name1 -> value1, name2 -> value2, ...}]
below it, to make this easier to find.