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"rulessystem of the specified type
assocsystem 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"Falsewhether to label states and events with their respective step numbers
"IncludeStateID"Falsewhether to label states and events with unique IDs
"IncludeInitializationEvents"Falsewhether to include pseudoevents that set up initial conditions
"IncludeEventInstances"Falsewhether to show distinct updating events that connect the same states as separate edges
"IncludeStateWeights"Falsewhether to weight state vertices by their rate of occurrence at a particular time step
"IncludeStatePathWeights"Falsewhether to weight state vertices by the number of distinct evolution paths that lead to them
"StateRenderingFunction"Automatichow to label states that appear in graphs
"EventRenderingFunction"Automatichow to label events that appear in graphs
MaxItemsInfinityhow many instances of a causal graph or evolution causal graph to return
"GivePredecessors"Falsewhether to label branch pairs with their predecessor state
"GiveResolvents"Falsewhether to label branch pairs with their resolvent state
"IncludeSelfPairs"Falsewhether to include trivial branch pairs
"IncludeFullBranchialSpace"Falsewhether to show all possible states in a given branchial graph
"LineThickness"1absolute line thickness for graph edges
Possible settings for "StateRenderingFunction" and "EventRenderingFunction" include:
Automaticmake a label from the name of the vertex
Inheriteduse the explicit vertex name as the label
Noneuse no label for the vertex
"string"use a shape from the VertexShapeFunction collection
funcapply 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 (17) 

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[19]=

Show the structure of the graph, without labels:

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

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

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

Show the structure of the graph, without labels:

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

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

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

Show the structure of the graph, without labels:

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

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

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

Show the structure of the graph, without labels:

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

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

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

Show the structure of the graph, without labels:

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

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

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

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

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

Prove that the system is not causal invariant:

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

Generate a graph showing branch pair ancestry:

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

Show the structure of the graph, without labels:

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

Generate a graph showing branch pair event ancestry:

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

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

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

Scope (11) 

System Types (5) 

MultiwaySystem supports both string and list substitution systems:

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

Lists can contain arbitrary symbolic elements:

In[39]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/0f738fcf-6678-4507-9be6-ccf98ecf4a8e"]
Out[39]=

Give an explicit substitution system rule:

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

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

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

MultiwaySystem also supports multiway generalizations of cellular automata:

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

Lists of cellular automaton rules can also be specified directly:

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

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

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

Generate a causal graph for the rule 30 cellular automaton:

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

MultiwaySystem also supports multiway generalizations of Wolfram models:

In[46]:=
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[46]=

Generate an evolution causal graph for a Wolfram model rule:

In[47]:=
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[47]=

Construct a multiway system by explicitly specifying an association:

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

Rules and Initial Conditions (2) 

MultiwaySystem accepts both individual rules and lists of rules:

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

Likewise for initial conditions:

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

Event Selection Functions (4) 

Apply only the first possible event at each step:

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

Apply the first and last possible events at each step:

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

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

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

Compare this to the full states graph:

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

Options (31) 

State Node Rendering (5) 

By default, states are labeled by their contents:

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

Use no labeling for states:

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

"StatesGraphStructure" yields the same result:

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

Use raw state names as node labels:

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

Use a named shape as each state label:

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

Event Node Rendering (5) 

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

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

Use no labeling for states:

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

Also use no labeling for events:

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

"EvolutionEventsGraphStructure" yields an equivalent result:

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

Use raw event expressions as their labels:

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

Initialization Events (3) 

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

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

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

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

Initialization events have special default rendering:

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

Graph Layout Options (2) 

Place arrows in the middle of edges:

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

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

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

Force the initial state node to be at the top:

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

Step Numbers and State IDs (4) 

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

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

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

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

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

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

Step numbers and IDs also apply to events:

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

Event Instances (2) 

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

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

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

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

State (Path) Weights (2) 

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

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

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

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

MaxItems (2) 

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

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

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

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

Predecessors and Resolvents (2) 

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

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

Common predecessor states can be shown using "GivePredecessors":

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

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

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

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

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

Show both common predecessors and common resolvents, where appropriate:

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

Self-Pairs (2) 

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

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

Self-pairs can be included using "IncludeSelfPairs":

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

Full Branchial Space (2) 

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

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

They can be shown using "IncludeFullBranchialSpace":

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

Applications (3) 

Investigate a multiway system from A New Kind of Science:

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

Illustrate the evolution:

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

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

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

Its multiway causal graph is relatively complicated:

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

Causal Invariant Rules (3) 

Show the state graph structure for a multiway system:

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

Show the causal graph structure:

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

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

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

Illustrate a simple sorting rule:

In[103]:=
ResourceFunction["MultiwaySystem"][
 "BA" -> "AB", "BBBAAA", 10, "StatesGraph"]
Out[103]=
In[104]:=
ResourceFunction["MultiwaySystem"][
 "BA" -> "AB", "BBBAAA", 10, "CausalInvariantQ"]
Out[104]=
In[105]:=
ResourceFunction["MultiwaySystem"][
 "BA" -> "AB", 10, "TotalCausalInvariantQ"]
Out[105]=

Generate string replacements rules corresponding to the Xor function:

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

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

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

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

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

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

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

Properties and Relations (2) 

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

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

Find all possible states, including multiplicities:

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

Version History

  • 12.0.0 – 10 April 2020
  • 11.0.0 – 08 April 2020
  • 10.0.0 – 26 March 2020
  • 9.0.0 – 20 March 2020
  • 8.0.0 – 19 March 2020
  • 7.0.0 – 19 March 2020
  • 6.0.0 – 17 March 2020
  • 5.0.0 – 13 March 2020
  • 4.0.0 – 10 March 2020
  • 3.0.0 – 26 February 2020
  • 2.0.0 – 19 December 2019
  • 1.0.0 – 04 December 2019

Source Metadata

Related Resources

License Information