Wolfram Research

Function Repository Resource:

MultiwaySystem

Source Notebook

Compute the evolution of a multiway system and many associated properties

Contributed by: Jonathan Gorard, Stephen Wolfram and Max Piskunov

ResourceFunction["MultiwaySystem"][rules,init,n]

generates the results of n steps in the evolution of the multiway system with the specified rules, starting from initial conditions init.

ResourceFunction["MultiwaySystem"][rules,init,n,"prop"]

gives the property "prop" for the specified multiway system evolution.

ResourceFunction["MultiwaySystem"][rulessel,init,n,]

uses the function sel to select which of the events obtained at each step to include in the evolution.

Details and Options

Rules can be specified in the following ways:
{"lhs1""rhs1",…} string substitution system
{{l11,l12,…}{r11,r12,..},…} list substitution system
SubstitutionSystem [ rules ] string or list substitution system
CellularAutomaton [ rules ] cellular automaton system
"type"rules system of the specified type
assoc system with properties defined by an Association
Supported rule types include:
"StringSubstitutionSystem" rules given as replacements on strings
"ListSubstitutionSystem" rules given as replacements on lists
"CellularAutomaton" rules given as a list of CellularAutomaton rule specifications
"WolframModel" rules given as replacements on hypergraphs
When rules are specified by an explicit association, the following elements can be included:
"StateEvolutionFunction" gives the list of successors to a given state
"StateEquivalenceFunction" determines whether two states should be considered equivalent
"StateEventFunction" gives the list of events applicable to a given state
"EventApplicationFunction" applies an event to a given state
"EventDecompositionFunction" decomposes an event into creator and destroyer events for individual elements
"SystemType" system type name
"EventSelectionFunction" determines which events should be applied to a given state
The event selection function sel in ResourceFunction["MultiwaySystem"][rulessel,] can have the following special forms:
"Sequential" applies the first possible replacement (sequential substitution system)
"Random" applies a random replacement
{"Random",n} applies n randomly chosen replacements
"MaxScan" applies the maximal set of spatially separated replacements (strings only)
The initial condition for ResourceFunction["MultiwaySystem"] is a list of states appropriate for the type of system used.
ResourceFunction["MultiwaySystem"][rules,"string",] is interpreted as ResourceFunction["MultiwaySystem"][rules,{"string"},].
ResourceFunction["MultiwaySystem"] accepts both individual rules and lists of rules, and likewise for initial conditions.
In ResourceFunction["MultiwaySystem"][rules,init,n,"prop"], the following properties can be requested:
"AllStatesList" the list of all states generated at each successive step (default)
"StatesCountsList" the number of distinct states generated at each successive step
"AllStatesListUnmerged" the list of all states without any merging
"PredecessorRulesList" the list of states and their corresponding predecessor states at each successive step
"EvolutionGraph" graph formed by the evolution process, with no merging between different time steps
"EvolutionGraphStructure" evolution graph without labeling
"EvolutionGraphFull" graph formed by the evolution process, including equivalent events
"EvolutionGraphFullStructure" full evolution graph without labeling
"EvolutionGraphUnmerged" graph formed by the evolution process, with no merging of equivalent states
"EvolutionGraphUnmergedStructure" unmerged evolution graph without labeling
"EvolutionGraphWeighted" graph formed by the evolution process, with edges weighted by event multiplicity
"EvolutionGraphWeightedStructure" weighted evolution graph without labeling
"StatesGraph" graph of how each distinct state leads to other states
"StatesGraphStructure" states graph without labeling
"AllEventsList" the list of all events that occur at each successive step
"EvolutionEventsGraph" graph showing the evolution process with updating events explicitly included
"EvolutionEventsGraphStructure" evolution events graph without labeling
"CausalGraph" graph of all causal relations between updating events
"CausalGraphStructure" causal graph without labeling
"EvolutionCausalGraph" combined graph of evolution process and causal relationships between events
"EvolutionCausalGraphStructure" evolution causal graph without labeling
"CausalGraphInstances" list of distinct causal graphs for all possible choices of event sequences
"CausalGraphStructureInstances" causal graph instances without labeling
"EvolutionCausalGraphInstances" list of distinct evolution causal graphs for all possible choices of events sequences
"EvolutionCausalGraphStructureInstances" evolution causal graph instances without labeling
"BranchPairsList" list of all branch pairs (i.e. critical pairs) generated in the states graph
"NewBranchPairsList" list of all new branch pairs generated at each successive step
"EvolutionBranchPairsList" list of all branch pairs generated in the evolution graph
"NewEvolutionBranchPairsList" list of all new evolution branch pairs generated at each successive step
"BranchPairEventsList" list of all events yielding branch pairs
"NewBranchPairEventsList" list of all events yielding new branch pairs at each successive step
"EvolutionBranchPairEventsList" list of all events yielding evolution branch pairs
"NewEvolutionBranchPairEventsList" list of all events yielding new evolution branch pairs at each successive step
"BranchialGraph" graph of branch pair ancestry at a given step
"BranchialGraphStructure" branchial graph without labeling
"AllStatesBranchialGraph" graph of branch pair ancestry across all steps
"AllStatesBranchialGraphStructure" all states branchial graph without labeling
"EvolutionBranchialGraph" graph of evolution branch pair ancestry at a given step
"EvolutionBranchialGraphStructure" evolution branchial graph without labeling
"AllStatesEvolutionBranchialGraph" graph of evolution branch pair ancestry across all steps
"AllStatesEvolutionBranchialGraphStructure" all states evolution branchial graph without labeling
"EventBranchialGraph" graph of branch pair event ancestry at a given step
"EventBranchialGraphStructure" event branchial graph without labeling
"AllEventsBranchialGraph" graph of branch pair event ancestry across all steps
"AllEventsBranchialGraphStructure" all events branchial graph without labeling
"EvolutionEventBranchialGraph" graph of evolution branch pair event ancestry at a given step
"EvolutionEventBranchialGraphStructure" evolution event branchial graph without labeling
"AllEventsEvolutionBranchialGraph" graph of evolution branch pair event ancestry across all steps
"AllEventsEvolutionBranchialGraphStructure" all events evolution branchial graph without labeling
"BranchPairResolutionsList" association of all resolved and unresolved branch pairs up to a given step
"EvolutionBranchPairResolutionsList" association of all resolved and unresolved evolution branch pairs up to a given step
"CausalInvariantQ" whether the system is causal invariant (all branch pairs converge)
"EvolutionCausalInvariantQ" whether the system is evolution causal invariant (all evolution branch pairs converge)
"KnuthBendixCompletion" list of Knuth–Bendix completion rules required to force causal invariance
"EvolutionKnuthBendixCompletion" list of Knuth–Bendix completion rules required to force evolution causal invariance
"CanonicalBranchPairsList" list of canonical (initial condition-independent) branch pairs
"CanonicalBranchPairResolutionsList" association of all resolved and unresolved canonical branch pairs up to a given step
"TotalCausalInvariantQ" whether the system is total causal invariant (all canonical branch pairs converge)
"CanonicalKnuthBendixCompletion" minimal list of canonical Knuth–Bendix completion rules required to force total causal invariance
"StateWeights" list of weights for all vertices in the states graph
Except for "AllStatesListUnmerged", "EvolutionGraphUnmerged" and states containing state IDs, identical states are always merged at each step.
In "StatesGraph", all instances of a given state at any step are merged. Different updating events that connect the same states will only be shown as separate edges if "IncludeEventInstances" is set to True.
Events are represented in the form {rule,input,rest}, where rule is the rule used in the updating event, input is the part of the state to which the rule is applied and rest is the remainder of the state. For substitution systems, rest is given in the form {prefix,suffix}.
Options for ResourceFunction["MultiwaySystem"] include:
"IncludeStepNumber" False whether to label states and events with their respective step numbers
"IncludeStateID" False whether to label states and events with unique IDs
"IncludeInitializationEvents" False whether to include pseudoevents that set up initial conditions
"IncludeEventInstances" False whether to show distinct updating events that connect the same states as separate edges
"IncludeStateWeights" False whether to weight state vertices by their rate of occurrence at a particular time step
"IncludeStatePathWeights" False whether to weight state vertices by the number of distinct evolution paths that lead to them
"StateRenderingFunction" Automatic how to label states that appear in graphs
"EventRenderingFunction" Automatic how to label events that appear in graphs
MaxItems Infinity how many instances of a causal graph or evolution causal graph to return
"GivePredecessors" False whether to label branch pairs with their predecessor state
"GiveResolvents" False whether to label branch pairs with their resolvent state
"IncludeSelfPairs" False whether to include trivial branch pairs
"IncludeFullBranchialSpace" False whether to show all possible states in a given branchial graph
"LineThickness" 1 absolute line thickness for graph edges
Possible settings for "StateRenderingFunction" and "EventRenderingFunction" include:
Automatic make a label from the name of the vertex
Inherited use the explicit vertex name as the label
None use no label for the vertex
"string" use a shape from the VertexShapeFunction collection
func apply the function func to the name of the vertex
For "CausalGraphInstances" and "EvolutionCausalGraphInstances", the option MaxItemsn can be used to get only the first n possible instances of causal graphs.
"CanonicalCriticalPairsList", "CanonicalCriticalPairsResolutionsList", "TotalCausalInvariantQ" and "CanonicalKnuthBendixCompletion" all require no initial condition specification. Furthermore, "CanoncialCriticalPairsList" requires no step count specification either, and "CanonicalKnuthBendixCompletion" can be used with or without a step count.

Examples

Basic Examples

Show basic multiway system evolution:

In[1]:=
ResourceFunction["MultiwaySystem"]["A" -> "AA", "A", 7]
Out[1]=
In[2]:=
ResourceFunction["MultiwaySystem"][{"A" -> "AB", "B" -> "A"}, "A", 5]
Out[2]=
In[3]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "BAA", "BAA" -> "AB"}, {"AAA"}, 3]
Out[3]=

Generate a graph showing how each state is obtained from the others:

In[4]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA", 3, "StatesGraph"]
Out[4]=

Show the structure of the graph, without labels:

In[5]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA", 3, "StatesGraphStructure"]
Out[5]=

Generate the list of all updating events applied at each step:

In[6]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, {"ABA"}, 3, "AllEventsList"]
Out[6]=

Generate a graph of the evolution history, with updating events included:

In[7]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, {"ABA"}, 3, "EvolutionEventsGraph"]
Out[7]=

Show the structure of the graph, without labels:

In[8]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, {"ABA"}, 3, "EvolutionEventsGraphStructure"]
Out[8]=

Generate the causal graph, showing dependencies between updating events:

In[9]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, {"ABA"}, 3, "CausalGraph"]
Out[9]=

Show the structure of the graph, without labels:

In[10]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, {"ABA"}, 3, "CausalGraphStructure"]
Out[10]=

Generate the evolution events graph, with causal connections included:

In[11]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, {"ABA"}, 3, "EvolutionCausalGraph"]
Out[11]=

Show the structure of the graph, without labels:

In[12]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, {"ABA"}, 3, "EvolutionCausalGraphStructure"]
Out[12]=

MultiwaySystem can handle Wolfram models and other rule types:

In[13]:=
ResourceFunction["MultiwaySystem"][
 "WolframModel" -> {{{2, 2, 1}, {2, 2, 2}} -> {{1, 1, 3}, {1, 1, 1}, {2, 1, 2}, {3, 3, 2}}}, {Table[{0, 0, 0}, 3]}, 3, "EvolutionCausalGraph", VertexSize -> 1]
Out[13]=
In[14]:=
ResourceFunction["MultiwaySystem"][
 CellularAutomaton[30], {0, 0, 1, 0, 0}, 2, "EvolutionCausalGraph", VertexSize -> 1]
Out[14]=
In[15]:=
ResourceFunction[
 "MultiwaySystem"][{{0} -> {0, 1, 0}, {0, 0} -> {1}}, {0, 1, 0}, 3, "EvolutionCausalGraph"]
Out[15]=

Specify an event selection function that picks only up to two events at each step:

In[16]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"} -> (Take[#, UpTo[2]] &), "ABABA", 3, "StatesGraph"]
Out[16]=

Generate causal graphs for all possible choices of event sequences:

In[17]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"AB"}, 3, "CausalGraphInstances"]
Out[17]=

Show the structures of the graphs, without labels:

In[18]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"AB"}, 3, "CausalGraphStructureInstances"]
Out[18]=

Generate a graph of full evolution history, with all events included:

In[19]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "EvolutionGraphFull"]
Out[20]=

Show the structure of the graph, without labels:

In[21]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "EvolutionGraphFullStructure"]
Out[22]=

Generate a graph of evolution history, with no merging of equivalent states:

In[23]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "EvolutionGraphUnmerged"]
Out[24]=

Show the structure of the graph, without labels:

In[25]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "EvolutionGraphUnmergedStructure"]
Out[26]=

Generate a graph of evolution history, with edges weighted by event multiplicity:

In[27]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "EvolutionGraphWeighted", EdgeLabels -> "EdgeWeight"]
Out[28]=

Show the structure of the graph, without labels:

In[29]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "EvolutionGraphWeightedStructure", EdgeLabels -> "EdgeWeight"]
Out[30]=

Generate a states graph with vertices weighted by their rate of occurrence on each time step:

In[31]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "AABABAA", 3, "StatesGraph", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]
Out[31]=

Show the structure of the graph, without labels:

In[32]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "AABABAA", 3, "StatesGraphStructure", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]
Out[32]=

Generate a states graph with vertices weighted by the number of distinct evolution paths that lead to them:

In[33]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "AABABAA", 3, "StatesGraph", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]
Out[33]=

Show the structure of the graph, without labels:

In[34]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "AABABAA", 3, "StatesGraphStructure", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]
Out[34]=

Generate the list of all branch pairs (i.e. critical pairs):

In[35]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "BranchPairsList"]
Out[35]=

Generate the association showing which branch pairs converged and which did not:

In[36]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "BranchPairResolutionsList"]
Out[36]=

Prove that the system is not causal invariant:

In[37]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 3, "CausalInvariantQ"]
Out[37]=

Generate a graph showing branch pair ancestry:

In[38]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "BranchialGraph"]
Out[38]=

Show the structure of the graph, without labels:

In[39]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "BranchialGraphStructure"]
Out[39]=

Generate a graph showing branch pair event ancestry:

In[40]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "ABA", "AA" -> "B"}, "AABAA", 2, "EventBranchialGraphStructure"]
Out[40]=

Prevent identical states from being merged by including step numbers and state IDs:

In[41]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA", 3, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[41]=
In[42]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA", 3, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[42]=

Scope

System Types

MultiwaySystem supports both string and list substitution systems:

In[43]:=
ResourceFunction["MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA",
  3]
Out[43]=
In[44]:=
ResourceFunction[
 "MultiwaySystem"][{{0} -> {0, 0}, {1} -> {0, 1}}, {0, 1, 0}, 3]
Out[44]=

Lists can contain arbitrary symbolic elements:

In[45]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/c800f009-ba07-4e9d-b877-3109d0aa2d9a"]
Out[45]=

Give an explicit substitution system rule:

In[46]:=
ResourceFunction["MultiwaySystem"][
 SubstitutionSystem[{{0} -> {0, 0}, {0} -> {0, 1}}], {{0}}, 3]
Out[46]=

An alternative method of specifying that a substitution system should be used:

In[47]:=
ResourceFunction["MultiwaySystem"][
 "SubstitutionSystem" -> {{0} -> {0, 0}, {0} -> {0, 1}}, {{0}}, 3]
Out[47]=

MultiwaySystem also supports multiway generalizations of cellular automata:

In[48]:=
ResourceFunction[
 "MultiwaySystem"][{CellularAutomaton[170], CellularAutomaton[240]}, {{0, 0, 1, 0, 0}}, 2]
Out[48]=

Lists of cellular automaton rules can also be specified directly:

In[49]:=
ResourceFunction["MultiwaySystem"][
 CellularAutomaton[{170, 240}], {0, 0, 1, 0, 0}, 2]
Out[49]=

Generate a states graph from left- and right-shift cellular automaton rules:

In[50]:=
ResourceFunction["MultiwaySystem"][
 "CellularAutomaton" -> {170, 240}, {{0, 0, 1, 0, 0}}, 2, "StatesGraph", VertexSize -> 1]
Out[50]=

Generate a causal graph for the rule 30 cellular automaton:

In[51]:=
ResourceFunction["MultiwaySystem"][
 CellularAutomaton[30], {0, 0, 1, 0, 0}, 2, "CausalGraph", VertexSize -> 1]
Out[51]=

MultiwaySystem also supports multiway generalizations of Wolfram models:

In[52]:=
ResourceFunction["MultiwaySystem"][
 "WolframModel" -> {{{2, 2, 1}, {2, 2, 2}} -> {{1, 1, 3}, {1, 1, 1}, {2, 1, 2}}}, {Table[{0, 0, 0}, 3]}, 4]
Out[52]=

Generate an evolution causal graph for a Wolfram model rule:

In[53]:=
ResourceFunction["MultiwaySystem"][
 "WolframModel" -> {{{2, 2, 1}, {2, 2, 2}} -> {{1, 1, 3}, {1, 1, 1}, {2, 1, 2}}}, {Table[{0, 0, 0}, 3]}, 4, "EvolutionCausalGraph", VertexSize -> 1]
Out[53]=

Construct a MultiwaySystem by explicitly specifying an association:

In[54]:=
ResourceFunction[
 "MultiwaySystem"][<|
  "StateEvolutionFunction" -> (StringReplaceList[#, {"A" -> "AA", "B" -> "AB"}] &), "StateEquivalenceFunction" -> SameQ, "StateEventFunction" -> Identity, "EventDecompositionFunction" -> Identity, "EventApplicationFunction" -> Identity, "SystemType" -> "None", "EventSelectionFunction" -> Identity|>, {"ABA"}, 3]
Out[54]=

Rules and Initial Conditions

MultiwaySystem accepts both individual rules and lists of rules:

In[55]:=
ResourceFunction["MultiwaySystem"][
 "A" -> "AA", "AAA", 3, "StatesGraph"]
Out[55]=
In[56]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB", "B" -> "BA"}, "AAA", 3, "StatesGraph"]
Out[56]=

Likewise for initial conditions:

In[57]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB", "B" -> "BA"}, {"ABA", "AAB"}, 3, "StatesGraph"]
Out[57]=

Event Selection Functions

Apply only the first possible event at each step:

In[58]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AAB", "BA" -> "A"} -> "Sequential", "A",
  8]
Out[58]=

Apply the first and last possible events at each step:

In[59]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AAB", "BA" -> "A"} -> ({First[#], Last[#]} &), "A", 8]
Out[59]=

Use a greedy-style algorithm to apply the maximal set of nonconflicting events at each step (strings only):

In[60]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "BA" -> "AB"} -> "MaxScan", "ABA", 4, "StatesGraph"]
Out[60]=

Compare this to the full states graph:

In[61]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "BA" -> "AB"}, "ABA", 4, "StatesGraph"]
Out[61]=

Options

State Node Rendering

By default, states are labeled by their contents:

In[62]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"ABA"}, 3, "StatesGraph"]
Out[62]=

Use no labeling for states:

In[63]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"ABA"}, 3, "StatesGraph", "StateRenderingFunction" -> None]
Out[63]=

"StatesGraphStructure" yields the same result:

In[64]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"ABA"}, 3, "StatesGraphStructure"]
Out[64]=

Use raw state names as node labels:

In[65]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"ABA"}, 3, "StatesGraph", "StateRenderingFunction" -> Inherited]
Out[65]=

Use a named shape as each state label:

In[66]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"ABA"}, 3, "StatesGraph", "StateRenderingFunction" -> "Square"]
Out[66]=

Event Node Rendering

By default, both states and events are labeled by their contents:

In[67]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "A" -> "AB"}, {"A"}, 3, "EvolutionEventsGraph"]
Out[67]=

Use no labeling for states:

In[68]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "A" -> "AB"}, {"A"}, 3, "EvolutionEventsGraph", "StateRenderingFunction" -> None]
Out[68]=

Also use no labeling for events:

In[69]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "A" -> "AB"}, {"A"}, 3, "EvolutionEventsGraph", "StateRenderingFunction" -> None, "EventRenderingFunction" -> None]
Out[69]=

"EvolutionEventsGraphStructure" yields an equivalent result:

In[70]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "A" -> "AB"}, {"A"}, 3, "EvolutionEventsGraphStructure"]
Out[70]=

Use raw event expressions as their labels:

In[71]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "A" -> "AB"}, {"A"}, 2, "EvolutionEventsGraph", "StateRenderingFunction" -> None, "EventRenderingFunction" -> Inherited]
Out[71]=

Initialization Events

By default, "AllEventsList" does not include initialization events:

In[72]:=
ResourceFunction[
 "MultiwaySystem"][{"BA" -> "AB", "AB" -> "BA"}, {"ABA", "ABA", "ABB"}, 3, "AllEventsList"]
Out[72]=

The option "IncludeInitializationEvents" allows one to override this default:

In[73]:=
ResourceFunction[
 "MultiwaySystem"][{"BA" -> "AB", "AB" -> "BA"}, {"ABA", "ABA", "ABB"}, 3, "AllEventsList", "IncludeInitializationEvents" -> True]
Out[73]=

Initialization events have special default rendering:

In[74]:=
ResourceFunction[
 "MultiwaySystem"][{"BA" -> "AB", "AB" -> "BA"}, {"ABA", "ABA", "ABB"}, 3, "EvolutionEventsGraph", "IncludeInitializationEvents" -> True]
Out[74]=

Graph Layout Options

Place arrows in the middle of edges:

In[75]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, {"ABA"}, 3, "StatesGraph", EdgeShapeFunction -> GraphElementData["ShortFilledArrow", "ArrowSize" -> 0.03]]
Out[75]=

Generate an example multiway evolution from page 209 of A New Kind of Science:

In[76]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 8, "StatesGraph"]
Out[76]=

Force the initial state node to be at the top:

In[77]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 8, "StatesGraph", GraphLayout -> {"LayeredDigraphEmbedding", "RootVertex" -> "BBA"}]
Out[77]=

Step Numbers and State IDs

By default, equivalent states are merged across all time steps:

In[78]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 8, "StatesGraph"]
Out[78]=
In[79]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 8, "AllStatesList"]
Out[79]=

Merging of equivalent states across different time steps can be prevented by including step numbers:

In[80]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 8, "StatesGraph", "IncludeStepNumber" -> True]
Out[80]=
In[81]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 8, "AllStatesList", "IncludeStepNumber" -> True]
Out[81]=

Merging of equivalent states at the same time step can be prevented by also including state IDs:

In[82]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 7, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[82]=
In[83]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 7, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[83]=

Step numbers and IDs also apply to events:

In[84]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 4, "EvolutionEventsGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[84]=
In[85]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, {"BBA"}, 4, "AllEventsList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[85]=

Event Instances

By default, multiple instances of equivalent updating events are merged in the states graph:

In[86]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA", 3, "StatesGraph"]
Out[86]=

Merging of equivalent events can be prevented by including event instances:

In[87]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA", 3, "StatesGraph", "IncludeEventInstances" -> True]
Out[87]=

State (Path) Weights

Vertices of a states graph can be weighted by their relative rate of occurrence at each time step:

In[88]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB"}, "AABBA", 3, "StatesGraph", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]
Out[88]=

Vertices can also be weighted by the number of distinct evolution paths that lead to them:

In[89]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB"}, "AABBA", 3, "StatesGraph", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]
Out[89]=

MaxItems

By default, "CausalGraphInstances" returns all possible causal graphs:

In[90]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB"}, "AAB", 4, "CausalGraphInstances"]
Out[90]=

The number of causal graphs returned can be limited using MaxItems:

In[91]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB"}, "AAB", 4, "CausalGraphInstances", "MaxItems" -> 5]
Out[91]=

Predecessors and Resolvents

By default, "BranchPairsList" returns only a list of branch pairs:

In[92]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB", "B" -> "BA"}, "ABA", 2, "BranchPairsList"]
Out[92]=

Common predecessor states can be shown using "GivePredecessors":

In[93]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB", "B" -> "BA"}, "ABA", 2, "BranchPairsList", "GivePredecessors" -> True]
Out[93]=

Similarly, "BranchPairResolutionsList" by default lists only resolved and unresolved branch pairs:

In[94]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB", "B" -> "BA"}, "ABA", 2, "BranchPairResolutionsList"]
Out[94]=

Common resolvents of resolved branch pairs can be shown using "GiveResolvents":

In[95]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB", "B" -> "BA"}, "ABA", 2, "BranchPairResolutionsList", "GiveResolvents" -> True]
Out[95]=

Show both common predecessors and common resolvents, where appropriate:

In[96]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AB", "B" -> "BA"}, "ABA", 2, "BranchPairResolutionsList", "GivePredecessors" -> True, "GiveResolvents" -> True]
Out[96]=

Self-Pairs

By default, "CanonicalBranchPairsList" does not include self-pairs (i.e. trivial critical pairs):

In[97]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "AB", "BAA" -> "BA"}, "CanonicalBranchPairsList"]
Out[97]=

Self-pairs can be included using "IncludeSelfPairs":

In[98]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "AB", "BAA" -> "BA"}, "CanonicalBranchPairsList", "IncludeSelfPairs" -> True]
Out[98]=

Full Branchial Space

By default, non-branch pair states are not shown as part of the branchial graph:

In[99]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "A" -> "AB", "A" -> "A"}, "A", 3, "BranchialGraph"]
Out[99]=

They can be shown using "IncludeFullBranchialSpace":

In[100]:=
ResourceFunction[
 "MultiwaySystem"][{"A" -> "AA", "A" -> "AB", "A" -> "A"}, "A", 3, "BranchialGraph", "IncludeFullBranchialSpace" -> True]
Out[100]=

Applications

Investigate a multiway system from A New Kind of Science:

In[101]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, "BBA", 5]
Out[101]=

Illustrate the evolution:

In[102]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, "BBA", 5, "StatesGraph"]
Out[102]=

The rule exhibits irregular growth in the total number of states at each step:

In[103]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, "BBA", 100, "StatesCountsList"]
Out[103]=

Its multiway causal graph is relatively complicated:

In[104]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, "BBA", 10, "CausalGraphStructure"]
Out[104]=

Causal Invariant Rules

Show the state graph structure for a multiway system:

In[105]:=
LayeredGraphPlot[
 ResourceFunction["MultiwaySystem"][{"AAB" -> "ABBBAA"}, "AAABBB", 15,
   "StatesGraphStructure"]]
Out[105]=

Show the causal graph structure:

In[106]:=
ResourceFunction[
 "MultiwaySystem"][{"AAB" -> "ABBBAA"}, "AAABBB", 6, "CausalGraphStructure"]
Out[106]=

Show that this multiway evolution is both causal invariant and total causal invariant:

In[107]:=
ResourceFunction[
 "MultiwaySystem"][{"AAB" -> "ABBBAA"}, "AAABBB", 5, "CausalInvariantQ"]
Out[107]=
In[108]:=
ResourceFunction[
 "MultiwaySystem"][{"AAB" -> "ABBBAA"}, 5, "TotalCausalInvariantQ"]
Out[108]=

Illustrate a simple sorting rule:

In[109]:=
ResourceFunction["MultiwaySystem"][
 "BA" -> "AB", "BBBAAA", 10, "StatesGraph"]
Out[109]=
In[110]:=
ResourceFunction["MultiwaySystem"][
 "BA" -> "AB", "BBBAAA", 10, "CausalInvariantQ"]
Out[110]=
In[111]:=
ResourceFunction["MultiwaySystem"][
 "BA" -> "AB", 10, "TotalCausalInvariantQ"]
Out[111]=

Generate string replacements rules corresponding to the Xor function:

In[112]:=
Map[StringJoin, # -> Apply[Xor][#] & /@ Tuples[{True, False}, 2] /. {True -> "T", False -> "F"}, {2}]
Out[112]=

The multiway system has many paths, but due to causal invariance all lead to the same eventual result:

In[113]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "F", "TF" -> "T", "FT" -> "T", "FF" -> "F"}, "TFTTFF", 10, "StatesGraph"]
Out[113]=
In[114]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "F", "TF" -> "T", "FT" -> "T", "FF" -> "F"}, "TFTTFF", 10, "CausalInvariantQ"]
Out[114]=
In[115]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "F", "TF" -> "T", "FT" -> "T", "FF" -> "F"}, 10, "TotalCausalInvariantQ"]
Out[115]=

The And function is also confluent, since it too is associative:

In[116]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "T", "TF" -> "F", "FT" -> "F", "FF" -> "F"}, "TFTTFF", 10, "StatesGraph"]
Out[116]=
In[117]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "T", "TF" -> "F", "FT" -> "F", "FF" -> "F"}, "TFTTFF", 10, "CausalInvariantQ"]
Out[117]=
In[118]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "T", "TF" -> "F", "FT" -> "F", "FF" -> "F"}, 10, "TotalCausalInvariantQ"]
Out[118]=

The Nand function is not associative, so can lead to different results:

In[119]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "F", "TF" -> "T", "FT" -> "T", "FF" -> "T"}, "TFTTFF", 10, "StatesGraph"]
Out[119]=
In[120]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "F", "TF" -> "T", "FT" -> "T", "FF" -> "T"}, "TFTTFF", 10, "CausalInvariantQ"]
Out[120]=
In[121]:=
ResourceFunction[
 "MultiwaySystem"][{"TT" -> "F", "TF" -> "T", "FT" -> "T", "FF" -> "T"}, 10, "TotalCausalInvariantQ"]
Out[121]=

Properties and Relations

"StatesCountsList" is equivalent to mapping Length over the lists of generated states:

In[122]:=
Length /@ ResourceFunction[
  "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, "BBA", 10]
Out[122]=
In[123]:=
ResourceFunction[
 "MultiwaySystem"][{"AA" -> "", "BA" -> "ABB", "BB" -> "A"}, "BBA", 10, "StatesCountsList"]
Out[123]=

Find all possible states, including multiplicities:

In[124]:=
KeySort /@ Counts /@ ResourceFunction["MultiwaySystem"][{"A" -> "AA", "B" -> "AB"}, "ABA", 3, "AllStatesListUnmerged"]
Out[124]=

Resource History

Source Metadata

Related Resources

License Information