What is the most convenient way to change options such as VertexLabels in existing Graph objects? (Version 7 users note: Graph is new in Mathematica 8.)
With graphics, we can use Show for this, not matter what function was originally used to produce the graphic:
g = Plot[Sin[x], {x, 0, 10}]
Show[g, Axes -> False, Frame -> True]
Is there an analogous function for Graphs? Suppose we already have a graph, and now we need to show vertex labels in a different way.
Here's a workaround using HighlightGraph:
g = Graph[{1 -> 2}]
HighlightGraph[g, {}, VertexLabels -> "Name"]
While it works, this is not really what HighlightGraph is meant for.
Please note that Graph objects are atomic before trying to take them apart. Also, I'm looking for the safest and most robust solution. I'm hoping there's a function I overlooked.





Show),SetPropertydoes not work if there is no second argument, which is a PITA if ypou want to make a wrapper function and call it with no options:Options[plotGraph] = Options@Graph; plotGraph[g_Graph, opts:OptionsPattern[]] := SetProperty[g, opts]; g = Graph[{1 -> 2, 2 -> 3}];plotGraph[g]. So one has to check whetheroptsis empty or not... – István Zachar Nov 25 '13 at 11:06