Wolfram Research

Function Repository Resource:

PerturbedCausalGraph

Source Notebook

Generate the causal graph produced by combining an unperturbed and perturbed WolframModelEvolutionObject

Contributed by: William Yam

ResourceFunction["PerturbedCausalGraph"][wm0,wm1]

combines the causal graphs of wm0 and wm1 and returns a graph object.

Details and Options

ResourceFunction["PerturbedCausalGraph"] tries to find differences between the final state of wm0 and the initial state of wm1 in the form of insertions, deletions and replacements as a way of identifying causally connected edges.
A replacement is considered to be a combination of a deletion and an insertion. The replaced edges do not share the same causal connections as their predecessors.
Edges in the initial state of wm1 that are not contained in the final state of wm0 are assumed to be insertions with no prior causal connections.
The ordering of edges is important and swapping pairs of edges is equivalent to pairs of replacements.
Attempting to combine graphs which share no common edges will result in a disconnected causal graph.

Examples

Basic Examples

Compute a WolframModel evolution over 200 steps:

In[1]:=
wm0 = ResourceFunction[
    "WolframModel"][{{{1, 2, 2}, {3, 1, 4}} -> {{2, 5, 2}, {2, 3, 5}, {4, 5, 5}}}, Automatic, 200];
GraphicsRow[{wm0["FinalStatePlot"], wm0["CausalGraph"]}]
Out[2]=

After the 200 steps, add a self-loop as a perturbation and evolve for a further 50 steps:

In[3]:=
wm1 = ResourceFunction[
    "WolframModel"][{{{1, 2, 2}, {3, 1, 4}} -> {{2, 5, 2}, {2, 3, 5}, {4, 5, 5}}}, Append[wm0["FinalState"], {100, 100, 100}], 50];
GraphicsRow[{wm1["FinalStatePlot"], wm1["CausalGraph"]}]
Out[4]=

Use PerturbedCausalGraph to show the difference caused by the perturbation:

In[5]:=
ResourceFunction["PerturbedCausalGraph"][wm0, wm1]
Out[5]=

Compute 200 steps of the evolution of a WolframModel:

In[6]:=
wm0 = ResourceFunction[
    "WolframModel"][{{{1, 2, 2}, {3, 1, 4}} -> {{2, 5, 2}, {2, 3, 5}, {4, 5, 5}}}, Automatic, 200];

Plot the final state:

In[7]:=
wm0["FinalStatePlot"]
Out[7]=

Delete 10 random edges in the spatial hypergraph after 200 steps before evolving further:

In[8]:=
wm1 = ResourceFunction[
    "WolframModel"][{{{1, 2, 2}, {3, 1, 4}} -> {{2, 5, 2}, {2, 3, 5}, {4, 5, 5}}}, Delete[wm0["FinalState"], Split@RandomSample[Range@Length@wm0["FinalState"], 10]], 200];
In[9]:=
wm1["FinalStatePlot"]
Out[9]=

Show the perturbed causal graph:

In[10]:=
ResourceFunction["PerturbedCausalGraph"][wm0, wm1]
Out[10]=

Scope

Use the output of one rule as the input for a different rule:

In[11]:=
wm0 = ResourceFunction[
    "WolframModel"][{{{1, 1, 2}, {2, 3, 4}} -> {{4, 4, 3}, {5, 3, 2}, {2, 5, 1}}}, Automatic, 200];
wm0["CausalGraph"]
Out[12]=
In[13]:=
wm1 = ResourceFunction[
    "WolframModel"][{{{1, 1, 2}, {3, 2, 4}} -> {{5, 5, 4}, {5, 1, 3}, {3, 2, 5}}}, wm0["FinalState"], 200];
In[14]:=
wm1["CausalGraph"]
Out[14]=
In[15]:=
ResourceFunction["PerturbedCausalGraph"][wm0, wm1]
Out[15]=

Resource History

Source Metadata

Related Resources

License Information