Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Simulate a nondeterministic Turing machine evolution as a multiway system
| ResourceFunction["MultiwayTuringMachine"][rules,init,n] generates the results of n steps in the evolution of the multiway (nondeterministic) Turing machine with the specified rules, starting from initial conditions init. | |
| ResourceFunction["MultiwayTuringMachine"][rules,init,n,"prop"] gives the property “prop” for the specified multiway (nondeterministic) Turing machine evolution. | |
| ResourceFunction["MultiwayTuringMachine"][rules→sel,init,n,…] uses the function sel to select which of the events obtained at each step to include in the evolution. | 
| "Sequential" | applies the first possible replacement (sequential substitution system) | 
| "Random" | applies a random replacement | 
| {"Random", n} | applies n randomly chosen replacements | 
| "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 event 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 | 
| "StateWeights" | list of weights for all vertices in the states graph | 
| "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 | 
| "IncludeEventsInstances" | 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 | 
| 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 | 
Show basic multiway Turing machine evolution (for 2-state, 2-color machines):
| In[1]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506}, {{1, 1, 0}, {0, 0, 0, 0}}, 5]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/1c279ff61ee53078.png)  | 
| Out[1]= |   | 
Use two rules:
| In[2]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 0, 0, 0}}, 3]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/2257947578aa79e7.png)  | 
| Out[2]= |   | 
Use three rules:
| In[3]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506, 1506}, {{1, 0, 1}, {0, 1, 1, 0}}, 3]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/33a79875962c930c.png)  | 
| Out[3]= |   | 
Generate a graph showing how each state is obtained from the others:
| In[4]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/68a51c4ffe5a23a8.png)  | 
| Out[4]= |   | 
Show the structure of the graph, without labels:
| In[5]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/1ee78c1b6969f172.png)  | 
| Out[5]= |   | 
Generate the list of all updating events applied at each step:
| In[6]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "AllEventsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/25e919989d11231d.png)  | 
| Out[6]= |   | 
Generate a graph of the evolution history, with updating events included:
| In[7]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionEventsGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/63a803c0344e99b2.png)  | 
| Out[7]= |   | 
Show the structure of the graph, without labels:
| In[8]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionEventsGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/053c2c76957ca06d.png)  | 
| Out[8]= |   | 
Generate the causal graph, showing dependencies between updating events:
| In[9]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "CausalGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/74e87f451e88426e.png)  | 
| Out[9]= |   | 
Show the structure of the graph, without labels:
| In[10]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "CausalGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/695228fd0ccec249.png)  | 
| Out[10]= |   | 
Generate the evolution events graph, with causal connections included:
| In[11]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionCausalGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/42341c8c3030591d.png)  | 
| Out[11]= |   | 
Show the structure of the graph, without labels:
| In[12]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionCausalGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/28bbeaf51850c748.png)  | 
| Out[12]= |   | 
Specify an event selection function that picks a random event at each step:
| In[13]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506} -> "Random", {{1, 1, 0}, {0, 1, 0, 0}}, 5, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/433676d4209a5721.png)  | 
| Out[13]= |   | 
Generate causal graphs for all possible choices of event sequences:
| In[14]:= | ![Graph[#, VertexSize -> 1] & /@ ResourceFunction[
  "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4,
   "CausalGraphInstances"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/7e83f3475d9bf41f.png)  | 
| Out[14]= |   | 
Show the structures of the graphs, without labels:
| In[15]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "CausalGraphStructureInstances"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/4e07c7135d4afc47.png)  | 
| Out[15]= |   | 
Generate the list of all branch pairs (i.e. critical pairs):
| In[16]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 5, "BranchPairsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/3ed71113d11121a5.png)  | 
| Out[16]= |   | 
Generate the association showing which branch pairs converged and which did not:
| In[17]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 5, "BranchPairResolutionsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/786e620f0aab79b3.png)  | 
| Out[17]= |   | 
Prove that the system is not causal invariant:
| In[18]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 5, "CausalInvariantQ"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/5cf734d888ead079.png)  | 
| Out[18]= |   | 
Generate a graph showing branch pair ancestry:
| In[19]:= | ![ResourceFunction["MultiwayTuringMachine"][
 Range[2506, 2606], {{1, 1, 0}, {1, 0, 0, 1}}, 2, "BranchialGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/0a62f9551f588283.png)  | 
| Out[19]= |   | 
Show the structure of the graph, without labels:
| In[20]:= | ![ResourceFunction["MultiwayTuringMachine"][
 Range[2506, 2606], {{1, 1, 0}, {1, 0, 0, 1}}, 2, "BranchialGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/5a8d59decfb48597.png)  | 
| Out[20]= |   | 
Generate a graph showing branch pair event ancestry:
| In[21]:= | ![ResourceFunction["MultiwayTuringMachine"][
 Range[2506, 2606], {{1, 1, 0}, {1, 0, 0, 1}}, 2, "EventBranchialGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/1a0abacfab0ea71a.png)  | 
| Out[21]= |   | 
Prevent identical states from being merged by including step numbers and state IDs:
| In[22]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/681818831187e91a.png)  | 
| Out[22]= |   | 
| In[23]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/130222b5704c6c77.png)  | 
| Out[23]= |   | 
Generate a graph of full evolution history, with all events included:
| In[24]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "EvolutionGraphFullStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/5fa79529365384d8.png)  | 
| Out[24]= |   | 
Generate a graph of full evolution history, with no merging of equivalent states:
| In[25]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "EvolutionGraphUnmergedStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/09bef158b7e20023.png)  | 
| Out[25]= |   | 
Generate a graph of evolution history, with edges weighted by event multiplicity:
| In[26]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "EvolutionGraphWeightedStructure", EdgeLabels -> "EdgeWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/076f8246a6a97f12.png)  | 
| Out[26]= |   | 
Generate a states graph with vertices weighted by their rate of occurrence on each time step:
| In[27]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", "IncludeStateWeights" -> True, VertexSize -> 1, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/117232aafa0b3880.png)  | 
| Out[27]= |   | 
Show the structure of the graph, without labels:
| In[28]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraphStructure", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/7035ed1d9ca33fff.png)  | 
| Out[28]= |   | 
Generate a states graph with vertices weighted by the number of distinct evolution paths that lead to them:
| In[29]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", "IncludeStatePathWeights" -> True, VertexSize -> 1, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/6b37dd10d39a113b.png)  | 
| Out[29]= |   | 
Show the structure of the graph, without labels:
| In[30]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraphStructure", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/663776c7f151899a.png)  | 
| Out[30]= |   | 
MultiwayTuringMachine accepts lists of Turing machine IDs:
| In[31]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{200, 300}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/1adafb8ebf16ea93.png)  | 
| Out[31]= |   | 
Simulating 3-state 2-color machines:
| In[32]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{{2139050, 3}, {2149050, 3}}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/6c75ef0100651855.png)  | 
| Out[32]= |   | 
MultiwayTuringMachine also accepts explicit lists of transitions:
| In[33]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{{{state_, color_?EvenQ} :> {state, color/1, -1}, {state_, color_?OddQ} :> {state, 3*color + 1, 1}}}, {{1, 1, 0}, {0, 0, 0, 0}}, 3, "AllStatesList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/16d06a5f32743456.png)  | 
| Out[33]= |   | 
MultiwayTuringMachine accepts both individual initial conditions and lists of initial conditions:
| In[34]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/1fbabf18a2fdb98b.png)  | 
| Out[34]= |   | 
| In[35]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{{1, 1, 0}, {0, 1, 0, 0}}, {{1, 1, 0}, {1, 0, 1, 1}}}, 3, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/726fcf7d8664f092.png)  | 
| Out[35]= |   | 
Apply only the first possible event at each step:
| In[36]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506} -> "Sequential", {{1, 1, 0}, {0, 1, 0, 0}}, 8]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/1a616421d5b246da.png)  | 
| Out[36]= |   | 
Apply the first and last possible events at each step:
| In[37]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506} -> ({First[#], Last[#]} &), {{1, 1, 0}, {0, 1, 0, 0}}, 8]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/3a8e94bf4c8c5bed.png)  | 
| Out[37]= |   | 
By default, states are labeled by their contents:
| In[38]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/6e030bdad2eb7ad0.png)  | 
| Out[38]= |   | 
Use no labeling for states:
| In[39]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", "StateRenderingFunction" -> None]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/6255f182eb76660e.png)  | 
| Out[39]= |   | 
"StatesGraphStructure" yields the same result:
| In[40]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/58d2859f385dfd67.png)  | 
| Out[40]= |   | 
Use raw state names as node labels:
| In[41]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", "StateRenderingFunction" -> Inherited]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/37163e13bc36c035.png)  | 
| Out[41]= |   | 
Use a named shape as each state label:
| In[42]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", "StateRenderingFunction" -> "Square"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/42e81e187c209ab7.png)  | 
| Out[42]= |   | 
By default, both states and events are labeled by their contents:
| In[43]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionEventsGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/3a757cfcb595d393.png)  | 
| Out[43]= |   | 
Use no labels for states or events:
| In[44]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionEventsGraph", "StateRenderingFunction" -> None, "EventRenderingFunction" -> None]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/14a371b86779be07.png)  | 
| Out[44]= |   | 
"EvolutionEventsGraphStructure" yields an equivalent result:
| In[45]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionEventsGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/22e95722777cf756.png)  | 
| Out[45]= |   | 
Use raw event expressions as their labels:
| In[46]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionEventsGraph", "StateRenderingFunction" -> None, "EventRenderingFunction" -> Inherited]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/36aad83d8195bceb.png)  | 
| Out[46]= |   | 
By default, "AllEventsList" does not include initialization events:
| In[47]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "AllEventsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/24b0b26d9fb7de95.png)  | 
| Out[47]= |   | 
The option "IncludeInitializationEvents" allows one to override this default:
| In[48]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "AllEventsList", "IncludeInitializationEvents" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/223dc1c796ddac55.png)  | 
| Out[48]= |   | 
Initialization events have special default rendering:
| In[49]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{{1, 1, 0}, {0, 1, 0, 0}}, {{1, 1, 0}, {0, 0, 1, 0}}}, 3, "EvolutionEventsGraph", "IncludeInitializationEvents" -> True, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/0781c8d9aad55964.png)  | 
| Out[49]= |   | 
Place arrows in the middle of edges:
| In[50]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", EdgeShapeFunction -> GraphElementData["ShortFilledArrow", "ArrowSize" -> 0.03], VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/0c6cbc404fd7db7a.png)  | 
| Out[50]= |   | 
Generate an example of multiway Turing machine evolution:
| In[51]:= | ![ResourceFunction["MultiwayTuringMachine"][
 Range[2506, 2606], {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/0baa19c1d3c25a04.png)  | 
| Out[51]= |   | 
Force the initial state node to be at the top:
| In[52]:= | ![ResourceFunction["MultiwayTuringMachine"][
 Range[2506, 2606], {{1, 1, 0}, {0, 1, 0, 0}}, 3, "StatesGraph", GraphLayout -> {"LayeredDigraphEmbedding", "RootVertex" -> ToString[{{1, 1, 0}, {0, 1, 0, 0}}]}, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/6c300711bcf0cd8b.png)  | 
| Out[52]= |   | 
By default, equivalent states are merged across all time steps:
| In[53]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/7b41e297ec3dda45.png)  | 
| Out[53]= |   | 
| In[54]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "AllStatesList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/59577a92d13c7aa0.png)  | 
| Out[54]= |   | 
Merging of equivalent states across different time steps can be prevented by including step numbers:
| In[55]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", "IncludeStepNumber" -> True, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/6503342558fbf736.png)  | 
| Out[55]= |   | 
| In[56]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "AllStatesList", "IncludeStepNumber" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/2bbfd0ff9225589d.png)  | 
| Out[56]= |   | 
Merging of equivalent states at the same time step can be prevented by also including state IDs:
| In[57]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/49a8d4c8a9e5ece8.png)  | 
| Out[57]= |   | 
| In[58]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/7be96256642c3c09.png)  | 
| Out[58]= |   | 
Step numbers and IDs also apply to events:
| In[59]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "EvolutionEventsGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/2b6fa5d20cb3aec9.png)  | 
| Out[59]= |   | 
See the events:
| In[60]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "AllEventsList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/77647fcda677b231.png)  | 
| Out[60]= |   | 
By default, multiple instances of equivalent updating events are merged in the states graph:
| In[61]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 0, 0, 0}}, 4, "StatesGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/6f6ab1ab3bfe183e.png)  | 
| Out[61]= |   | 
Merging of equivalent events can be prevented by including event instances:
| In[62]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 0, 0, 0}}, 4, "StatesGraph", "IncludeEventInstances" -> True, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/4679d367dc3a6268.png)  | 
| Out[62]= |   | 
Vertices of a states graph can be weighted by their relative rate of occurrence at each time step:
| In[63]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/34c2980312742358.png)  | 
| Out[63]= |   | 
Vertices can also be weighted by the number of distinct evolution paths that lead to them:
| In[64]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4, "StatesGraph", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/35fa644bd3f40884.png)  | 
| Out[64]= |   | 
By default, "CausalGraphInstances" returns all possible causal graphs:
| In[65]:= | ![Graph[#, VertexSize -> 1] & /@ ResourceFunction[
  "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4,
   "CausalGraphInstances"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/41c7099fc536215d.png)  | 
| Out[65]= |   | 
The number of causal graphs returned can be limited using MaxItems:
| In[66]:= | ![Graph[#, VertexSize -> 1] & /@ ResourceFunction[
  "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 4,
   "CausalGraphInstances", MaxItems -> 5]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/5a5e777e143efba6.png)  | 
| Out[66]= |   | 
By default, "BranchPairsList" returns only a list of branch pairs:
| In[67]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "BranchPairsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/0eae3ec5730dff24.png)  | 
| Out[67]= |   | 
Common predecessor states can be shown using "GivePredecessors":
| In[68]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "BranchPairsList", "GivePredecessors" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/152a54f384ae89e9.png)  | 
| Out[68]= |   | 
Similarly, "BranchPairResolutionsList" by default lists only resolved and unresolved branch pairs:
| In[69]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "BranchPairResolutionsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/5baeaed92a014002.png)  | 
| Out[69]= |   | 
Common resolvents of resolved branch pairs can be shown using "GiveResolvents":
| In[70]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "BranchPairResolutionsList", "GiveResolvents" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/33075163db0783ea.png)  | 
| Out[70]= |   | 
Show both common predecessors and common resolvents, where appropriate:
| In[71]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "BranchPairResolutionsList", "GivePredecessors" -> True, "GiveResolvents" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/38f5562574297bfb.png)  | 
| Out[71]= |   | 
By default, non-branch pair states are not shown as part of the branchial graph:
| In[72]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{1506, 2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 2, "BranchialGraph", VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/1e2ac16ec3880aa2.png)  | 
| Out[72]= |   | 
They can be shown using "IncludeFullBranchialSpace":
| In[73]:= | ![ResourceFunction[
 "MultiwayTuringMachine"][{1506, 2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 2, "BranchialGraph", "IncludeFullBranchialSpace" -> True, VertexSize -> 1]](https://www.wolframcloud.com/obj/resourcesystem/images/6aa/6aa4fe27-87fd-4356-ae45-d4033b440f3f/2b2555012c91a2b6.png)  | 
| Out[73]= |   | 
This work is licensed under a Creative Commons Attribution 4.0 International License