# How to change an option's value for a specific object?

I have a Graph object x such that

GraphLayout /. AbsoluteOptions[x]


evaluates to Automatic.

I want generate an object y from x such that

GraphLayout /. AbsoluteOptions[y]


evaluates to the string "RadialEmbedding".

In principle, I imagine that y could be generated from x in a way that leaves x unchanged. Alternatively, y could be an "in-place mutation" of x. I'm interested in both approaches. (If "in-place mutation" is the only convenient way to produce the desired y, then I'd like to know how to "clone" x, so that I can mutate the clone and leave x unaffected.)

PS: I spent a huge amount of time poring over the Mathematica documentation in search for the answer to this question, obviously without any success. I'd be curious to know what keywords I could have used in my search to find the answer.

• It's no wonder you couldn't find it easily. Graph functionality is a muddy terrain. There are a few superimposed ways to define graphs and the docs aren't clear at all. Commented Oct 28, 2014 at 12:58
– Öskå
Commented Oct 28, 2014 at 12:59
• @belisarius: actually, I approached the question generally, from the standpoint of modifying an arbitrary option in an arbitrary object. I thought that this would be an easy-to-find topic. I was wrong.
– kjo
Commented Oct 28, 2014 at 13:00
• @kjo Graphs are very particular objects! Commented Oct 28, 2014 at 13:03
• @belisarius: Thanks for the tip; I'll keep that in mind from now on.
– kjo
Commented Oct 28, 2014 at 13:04

You can do both:

Generating a second Graph:

x = PathGraph[Range[20]];
GraphLayout /. AbsoluteOptions[x]
y = SetProperty[x, GraphLayout -> "RadialEmbedding"];
GraphLayout /. AbsoluteOptions[y]

(*
Automatic


PropertyValue[x, GraphLayout] = "RadialEmbedding";