Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the evolution of a multiway system based on function evaluation over the integers
| ResourceFunction["MultiwayFunctionSystem"][rules,init,n] generates the results of n steps in the multiway integer function evaluation with the specified rules, starting from initial conditions init. | |
| ResourceFunction["MultiwayFunctionSystem"][rules,init,n,"prop"] gives the property "prop" for the specified multiway integer function evaluation. | |
| ResourceFunction["MultiwayFunctionSystem"][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 incude 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 | 
| Inherited | use the explicit vertex name as the label | 
| None | use no label for the vertex | 
| "shape" | use a shape from the VertexShapeFunction collection | 
| func | apply the function func to the name of the vertex | 
Show basic multiway function evaluation:
| In[1]:= | ![ResourceFunction["MultiwayFunctionSystem"][{# + 1} &, 1, 5]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/21e46dc639e04393.png)  | 
| Out[1]= |   | 
| In[2]:= | ![ResourceFunction["MultiwayFunctionSystem"][{2 # + 1, 3 # + 2} &, 1, 5]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/79c1e3b5493d4390.png)  | 
| Out[2]= |   | 
| In[3]:= | ![ResourceFunction["MultiwayFunctionSystem"][{#^3, #^2 - 1, # + 5} &, 2,
  3]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/0d8ee037e1989ec0.png)  | 
| Out[3]= |   | 
Generate a graph showing how each state is obtained from the others:
| In[4]:= | ![rules = {2 # + 1, 3 # - 1} &;
ResourceFunction["MultiwayFunctionSystem"][rules, 1, 4, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/61de80e504e8e21e.png)  | 
| Out[5]= |   | 
Show the structure of the graph, without labels:
| In[6]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][rules, 1, 4, "StatesGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/7f26e1f5b18bbc0f.png)  | 
| Out[6]= |   | 
Generate the list of all updating events applied at each step:
| In[7]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][rules, 1, 4, "AllEventsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/60854b956779d1cb.png)  | 
| Out[7]= |   | 
Generate a graph of evolution history, with updating events included:
| In[8]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionEventsGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/0d3496e38068a9f2.png)  | 
| Out[8]= |   | 
Show the structure of the graph, without labels:
| In[9]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionEventsGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/1ece75606de7698f.png)  | 
| Out[9]= |   | 
Generate a causal graph, showing dependencies between updating events:
| In[10]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "CausalGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/344d565b90976723.png)  | 
| Out[10]= |   | 
Show the structure of the graph, without labels:
| In[11]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "CausalGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/42ae41036f6ec55b.png)  | 
| Out[11]= |   | 
Generate an evolution events graph, with causal connections included:
| In[12]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionCausalGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/25d78795aef5302c.png)  | 
| Out[12]= |   | 
Show the structure of the graph, without labels:
| In[13]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionCausalGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/51eb614e91adb117.png)  | 
| Out[13]= |   | 
Specify an event selection function that picks a random event at each step:
| In[14]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][({2 # + 1, 3 # - 1} &) -> "Random", 1, 5, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/111634d62951275e.png)  | 
| Out[14]= |   | 
Generate causal graphs for all possible choices of event sequences:
| In[15]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # + 1} &, 1, 5, "CausalGraphInstances"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3205e64f2d894f3f.png)  | 
| Out[15]= |   | 
Show the structures of the graphs, without labels:
| In[16]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # + 1} &, 1, 5, "CausalGraphStructureInstances"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/64717e19bcf54c6c.png)  | 
| Out[16]= |   | 
Generate a list of all branch pairs (i.e. critical pairs) for a multiway system:
| In[17]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "BranchPairsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/587189ebadd90a59.png)  | 
| Out[17]= |   | 
Generate the association of which branch pairs converged and which did not:
| In[18]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "BranchPairResolutionsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/58a336bea76aeffa.png)  | 
| Out[18]= |   | 
Prove that the system is not causal invariant:
| In[19]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "CausalInvariantQ"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/09b378a78771287c.png)  | 
| Out[19]= |   | 
Generate a graph showing branch pair ancestry:
| In[20]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # + 1, 2 #, 3 #} &, 1, 4, "BranchialGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/43d9b8833cf02e36.png)  | 
| Out[20]= |   | 
Show the structure of the graph, without labels:
| In[21]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # + 1, 2 #, 3 #} &, 1, 4, "BranchialGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/24179e2eb55da4d4.png)  | 
| Out[21]= |   | 
Generate a graph showing branch pair event ancestry:
| In[22]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # + 1, 2 #, 3 #} &, 1, 4, "EventBranchialGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/649706a04d26491c.png)  | 
| Out[22]= |   | 
Prevent identical states from being merged by including step numbers and state IDs:
| In[23]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/5d6e3cf352e814aa.png)  | 
| Out[23]= |   | 
View the states:
| In[24]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3256c605030805a2.png)  | 
| Out[24]= |   | 
Generate a graph of full evolution history, with all events included:
| In[25]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionGraphFullStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/7d0ee459ce7d54a0.png)  | 
| Out[25]= |   | 
Generate a graph of full evolution history, with no merging of equivalent states:
| In[26]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionGraphUnmergedStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/38c331a44efbabaf.png)  | 
| Out[26]= |   | 
Generate a graph of evolution history, with edges weighted by event multiplicity:
| In[27]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionGraphWeightedStructure", EdgeLabels -> "EdgeWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/1052b132edaedec8.png)  | 
| Out[27]= |   | 
Generate a states graph with vertices weighted by their rate of occurrence at each time step:
| In[28]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/1b25fc5de4a88f2a.png)  | 
| Out[28]= |   | 
Show the structure of the graph, without labels:
| In[29]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraphStructure", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3a42e75227c109aa.png)  | 
| Out[29]= |   | 
Generate a states graph with vertices weighted by the number of distinct evolution paths that lead to them:
| In[30]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/174b3d0ea4bdbfff.png)  | 
| Out[30]= |   | 
Show the structure of the graph, without labels:
| In[31]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraphStructure", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/131f952572b190ca.png)  | 
| Out[31]= |   | 
MultiwayFunctionSystem accepts single pure functions:
| In[32]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{# + 2, 2 # - 1} &, 1, 5, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3a3fdd5c5f86d0b5.png)  | 
| Out[32]= |   | 
MultiwayFunctionSystem also accepts lists of pure functions:
| In[33]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{{# + 2, 2 # - 1} &, {2 # + 1, 3 # + 2} &}, 1, 5, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/71d4c481951b3710.png)  | 
| Out[33]= |   | 
MultiwayFunctionSystem accepts both individual initial conditions and lists of initial conditions:
| In[34]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 #} &, 1, 5, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/70c18513b28b8494.png)  | 
| Out[34]= |   | 
| In[35]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 #} &, {1, 2}, 4, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/5c97c198b3d14096.png)  | 
| Out[35]= |   | 
Apply the first possible event at each step:
| In[36]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][({2 # + 1, 3 # - 1} &) -> "Sequential", 1,
  8]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/78974c8a4703ba92.png)  | 
| Out[36]= |   | 
Apply the first and last possible events at each step:
| In[37]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][({2 # + 1, 3 # - 1} &) -> ({First[#], Last[#]} &), 1, 8]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3d7f13c323bb32fa.png)  | 
| Out[37]= |   | 
By default, states are labeled by their contents:
| In[38]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/7af4c805cb762c1c.png)  | 
| Out[38]= |   | 
Use no labeling for states:
| In[39]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "StateRenderingFunction" -> None]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3333925285f6727a.png)  | 
| Out[39]= |   | 
"StatesGraphStructure" yields the same result:
| In[40]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3a3cbeb2c3982228.png)  | 
| Out[40]= |   | 
Use raw state names as node labels:
| In[41]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "StateRenderingFunction" -> Inherited]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/6efa85fed174e011.png)  | 
| Out[41]= |   | 
Use a named shape as each state label:
| In[42]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "StateRenderingFunction" -> "Square"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/2fba8774b6612967.png)  | 
| Out[42]= |   | 
By default, both states and events are labeled by their contents:
| In[43]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionEventsGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/00c1df7f90ed3d37.png)  | 
| Out[43]= |   | 
Use no labels for states or events:
| In[44]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionEventsGraph", "StateRenderingFunction" -> None, "EventRenderingFunction" -> None]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/4dc7fd8b5a4d3c29.png)  | 
| Out[44]= |   | 
"EvolutionEventsGraphStructure" yields an equivalent result:
| In[45]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionEventsGraphStructure"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3bb46cf8d868160c.png)  | 
| Out[45]= |   | 
Use raw event expressions as their labels:
| In[46]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionEventsGraph", "StateRenderingFunction" -> None, "EventRenderingFunction" -> Inherited]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/785d66485be6d13f.png)  | 
| Out[46]= |   | 
By default, "AllEventsList" does not include initialization events:
| In[47]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "AllEventsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/2aef5068bbca57c7.png)  | 
| Out[47]= |   | 
The option "IncludeInitializationEvents" allows one to override this default:
| In[48]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "AllEventsList", "IncludeInitializationEvents" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/23dd7e69c04fbab8.png)  | 
| Out[48]= |   | 
Initialization events have special default rendering:
| In[49]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, {1, 7}, 3, "EvolutionEventsGraph", "IncludeInitializationEvents" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/63d4653d8bee2d81.png)  | 
| Out[49]= |   | 
Place arrows in the middle of edges:
| In[50]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "StatesGraph", EdgeShapeFunction -> GraphElementData["ShortFilledArrow", "ArrowSize" -> 0.03]]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/49c31bcd286e63ec.png)  | 
| Out[50]= |   | 
Generate an example of multiway function evaluation:
| In[51]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 6, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/5ca6a9d2cc21c8b8.png)  | 
| Out[51]= |   | 
Force the initial state node to be at the top:
| In[52]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 6, "StatesGraph", GraphLayout -> {"LayeredDigraphEmbedding", "RootVertex" -> ToString[1]}]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/1f9d0629ad814c18.png)  | 
| Out[52]= |   | 
By default, equivalent states are merged across all time steps:
| In[53]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/45089446ae46ceba.png)  | 
| Out[53]= |   | 
View the states:
| In[54]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "AllStatesList"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/47fd1a17fd7a1cf5.png)  | 
| Out[54]= |   | 
Merging of equivalent states across different time steps can be prevented by including step numbers:
| In[55]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "IncludeStepNumber" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/7196a2e5ec76ebb6.png)  | 
| Out[55]= |   | 
View the states:
| In[56]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "AllStatesList", "IncludeStepNumber" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/7288d6d8265b404c.png)  | 
| Out[56]= |   | 
Merging of equivalent states at the same time step can be prevented by also including state IDs:
| In[57]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/01b436b3c7876c77.png)  | 
| Out[57]= |   | 
View the states:
| In[58]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/010b1627b0fb0a35.png)  | 
| Out[58]= |   | 
Step numbers and IDs also apply to events:
| In[59]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "EvolutionEventsGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/22dc80440cbbf7ff.png)  | 
| Out[59]= |   | 
View the states:
| In[60]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 4, "AllEventsList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3f6b053dbe6c0912.png)  | 
| Out[60]= |   | 
By default, multiple instances of equivalent updating events are merged in the states graph:
| In[61]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/460f73b678333a97.png)  | 
| Out[61]= |   | 
Merging of equivalent events can be prevented by including event instances:
| In[62]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "IncludeEventInstances" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/39e9c7a72edde726.png)  | 
| Out[62]= |   | 
Vertices of a states graph can be weighted by their relative rate of occurrence at each time step:
| In[63]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/39a568c57e0a29b1.png)  | 
| Out[63]= |   | 
Vertices can also be weighted by the number of distinct evolution paths that lead to them:
| In[64]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "StatesGraph", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/33735ff818575b4f.png)  | 
| Out[64]= |   | 
By default, "CausalGraphInstances" returns all possible causal graphs:
| In[65]:= | ![ResourceFunction["MultiwayFunctionSystem"][{2 # + 1, 3 # + 1} &, 1, 5,
   "CausalGraphInstances"] // Length](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/05b8212e8ca6010c.png)  | 
| Out[65]= |   | 
The number of causal graphs returned can be limited using MaxItems:
| In[66]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # + 1} &, 1, 5, "CausalGraphInstances", MaxItems -> 8]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/53135b90b522657d.png)  | 
| Out[66]= |   | 
By default, "BranchPairsList" returns only a list of branch pairs:
| In[67]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "BranchPairsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/42186d6da89ead22.png)  | 
| Out[67]= |   | 
Common predecessor states can be shown using "GivePredecessors":
| In[68]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "BranchPairsList", "GivePredecessors" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/22721466db10feac.png)  | 
| Out[68]= |   | 
Similarly, "BranchPairResolutionsList" by default lists only resolved and unresolved branch pairs:
| In[69]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "BranchPairResolutionsList"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3084c15d1aa16621.png)  | 
| Out[69]= |   | 
Common resolvents of resolved branch pairs can be shown using "GiveResolvents":
| In[70]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "BranchPairResolutionsList", "GiveResolvents" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/108f3978fde82192.png)  | 
| Out[70]= |   | 
Show both common predecessors and common resolvents, where appropriate:
| In[71]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1} &, 1, 5, "BranchPairResolutionsList", "GivePredecessors" -> True, "GiveResolvents" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/535a9af83166ab7b.png)  | 
| Out[71]= |   | 
By default, non-branch pair states are not shown as part of the branchial graph:
| In[72]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1, 2 #, 3 #} &, 1, 4, "BranchialGraph"]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/3ee2b54996757ad5.png)  | 
| Out[72]= |   | 
They can be shown using "IncludeFullBranchialSpace":
| In[73]:= | ![ResourceFunction[
 "MultiwayFunctionSystem"][{2 # + 1, 3 # - 1, 2 #, 3 #} &, 1, 4, "BranchialGraph", "IncludeFullBranchialSpace" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/89d/89d0e3e8-c831-486d-8157-8079c623f378/24c090ee837f692d.png)  | 
| Out[73]= |   | 
This work is licensed under a Creative Commons Attribution 4.0 International License