Wolfram Function Repository
Instantuse addon functions for the Wolfram Language
Function Repository Resource:
Compute branch pairs for a given multiway system
ResourceFunction["BranchPairs"][rules,init,n] generates a list of branch pairs for the multiway system with the specified rules after n steps, starting with initial conditions init. 

ResourceFunction["BranchPairs"][rules→sel,init,n] uses the function sel to select which of the events obtained at each step to include in the evolution. 
{"lhs_{1}">"rhs_{1}",…}  string substitution system 
{{l_{11},l_{12},…}>{r_{11},r_{12},..},…}  list substitution system 
CellularAutomaton[rules]  cellular automaton system 
"type"→rules  system of the specified type 
"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 
"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"  gives a system type name 
"EventSelectionFunction"  determines which events should be applied to a given state 
"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 spatiallyseparated replacements (strings only) 
"IncludeStepNumber"  False  whether to label states and events with their respective step numbers 
"IncludeStateID"  False  whether to label states and events with unique IDs 
"GivePredecessors"  False  whether to label branch pairs with their predecessor state 
Generate the list of all branch pairs (i.e. critical pairs) for two string substitution systems:
In[1]:= 

Out[1]= 

In[2]:= 

Out[2]= 

Show common predecessor states:
In[3]:= 

Out[3]= 

Different event selection functions can lead to different lists of branch pairs:
In[4]:= 

Out[4]= 

In[5]:= 

Out[5]= 

BranchPairs can handle Wolfram Models and other system types:
In[6]:= 

Out[6]= 

In[7]:= 

Out[7]= 

In[8]:= 

Out[8]= 

Preventing identical states from being merged, by including step numbers and/or state IDs, can change branch pair behavior:
In[9]:= 

Out[9]= 

In[10]:= 

Out[10]= 

BranchPairs supports both string and list substitution systems:
In[11]:= 

Out[11]= 

In[12]:= 

Out[12]= 

Lists can contain arbitrary symbolic elements:
In[13]:= 

Out[13]= 

Give an explicit substitution system rule:
In[14]:= 

Out[14]= 

An alternative method of specifying that a substitution system should be used:
In[15]:= 

Out[15]= 

BranchPairs also supports multiway generalizations of cellular automata:
In[16]:= 

Out[16]= 

Generate all branch pairs from left and rightshift cellular automaton rules after 3 steps:
In[17]:= 

Out[17]= 

Determine branch pairs of the rule 30 cellular automaton:
In[18]:= 

Out[18]= 

BranchPairs also supports multiway generalizations of Wolfram Models:
In[19]:= 

Out[19]= 

In[20]:= 

Out[20]= 

Construct a multiway evolution by explicitly specifying an association:
In[21]:= 

Out[21]= 

BranchPairs accepts both individual rules and lists of rules:
In[22]:= 

Out[22]= 

In[23]:= 

Out[23]= 

Likewise for initial conditions:
In[24]:= 

Out[24]= 

Apply only the first possible event at each step:
In[25]:= 

Out[25]= 

Apply the first and last possible events at each step:
In[26]:= 

Out[26]= 

Use a greedystyle algorithm to apply the maximal set of nonconflicting events at each step (strings only):
In[27]:= 

Out[27]= 

Explicitly specify the type of rule:
In[28]:= 

Out[28]= 

In[29]:= 

Out[29]= 

By default, equivalent states are merged across all time steps:
In[30]:= 

Out[30]= 

Merging of equivalent states across different time steps can be prevented by including step numbers:
In[31]:= 

Out[31]= 

Merging of equivalent states at the same time step can be prevented by also including state IDs:
In[32]:= 

Out[32]= 

By default, BranchPairs returns only a list of branch pairs:
In[33]:= 

Out[33]= 

Common predecessor states can be shown using "GivePredecessors":
In[34]:= 

Out[34]= 

This work is licensed under a Creative Commons Attribution 4.0 International License