Given a graph which has already been constructed, how can I add, e.g., the option VertexSize -> 3 to that graph without having to deconstruct the graph?

  • $\begingroup$ Perhaps Show["graph",VertexSize->3]? $\endgroup$ Apr 16 '21 at 12:10

To add newoptions to a graph object g, you can use

  1. Graph[g, newoptions]
  2. Annotate[g, newoptions]
  3. SetProperty[g, newoptions]


options = {VertexSize -> Large, PlotTheme -> "IndexLabeled", VertexStyle -> {1 -> Red}};


Grid[Partition[#,2], Dividers -> All]&[Labeled[#, HoldForm @ #, Top] & /@
 {Unevaluated[rg = RandomGraph[{5, 9}, ImageSize -> 300]], 
  Unevaluated @ Graph[rg, options], 
  Unevaluated @ Annotate[rg, options],
  Unevaluated @ SetProperty[rg,  options]}]

enter image description here


There's quite a nice copy function that lets you keep it as a graph expression

enter image description here

Probably more efficient ways if you have assigned the graph or use the % output

However as mentioned in the comments you should be able to manipulate by pasting the graph expression in place of "graph"


@Ulrich Neumann


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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