Wolfram Research

Function Repository Resource:

TokenEventGraph (1.1.2) current version: 3.0.0 »

Source Notebook

Generate a token-event graph for multicomputational evolution according to particular rules

Contributed by: Stephen Wolfram and Nikolay Murzin

ResourceFunction["TokenEventGraph"][rules, init, t]

generates a token-event graph for t steps of evolution according to rules from init.

Details and Options

ResourceFunction["TokenEventGraph"] accepts the following options:
"AllSubsets" True whether to allow all subsets of tokens to be used in a given event
"TokenDeduplication" True whether to deduplicate tokens
"EventDeduplication" False whether to deduplicate events
"TokenLabeling" Automatic how to label token vertices
"EventLabeling" None how to label event vertices
"TokenMultiplicity" 1 how many copies of tokens rules are matched against
"TokenRenderingFunction" Identity how to render tokens
"TokenLabeling"Automatic uses ordinary vertex labels; "TokenLabeling"True uses boxes for each vertex.
"EventLabeling"Automatic uses ordinarily placed vertex labels; "EventLabeling"True uses in-circle labeling for each vertex; "EventLabeling""Colors" uses a different color for each rule index.
"TokenMultiplicity"Automatic uses as many copies of tokens as are needed for arbitrary matching.

Examples

Basic Examples (2) 

Make a token-event graph of a simple rule:

In[1]:=
ResourceFunction["TokenEventGraph"][{{n_} :> {n + 1, n + 2}}, {1, 2},
  2]
Out[1]=

Multiple rules:

In[2]:=
ResourceFunction[
 "TokenEventGraph"][{{n_} :> {n + 1}, {n_} :> {2 n}}, {1, 2}, 2]
Out[2]=

Scope (1) 

Make a WolframModel-like TokenEventGraph:

In[3]:=
Module[{w = 0}, ResourceFunction[
  "TokenEventGraph"][{{{x_, y_}, {y_, z_}} :> {{w++, y}, {y, z}, {z, w}, {x, w}}}, {{0, 0}}, 3, AspectRatio -> 1/2]]
Out[3]=

Options (8) 

AllSubsets (1) 

Allow or disallow all subsets of tokens for an event:

In[4]:=
ResourceFunction[
 "TokenEventGraph"][{{n_, m_} :> {n + m}}, {1, 2, 3, 4}, 2, "AllSubsets" -> True]
Out[4]=
In[5]:=
ResourceFunction[
 "TokenEventGraph"][{{n_, m_} :> {n + m}}, {1, 2, 3, 4}, 2, "AllSubsets" -> False]
Out[5]=

TokenDeduplication (1) 

Keep or remove duplicate tokens:

In[6]:=
ResourceFunction[
 "TokenEventGraph"][{{f[n_] /; n > 2} :> {f[n - 1], f[n - 2]}}, {f[
   7]}, 4, "TokenDeduplication" -> True]
Out[6]=
In[7]:=
ResourceFunction[
 "TokenEventGraph"][{{f[n_] /; n > 2} :> {f[n - 1], f[n - 2]}}, {f[
   7]}, 4, "TokenDeduplication" -> False]
Out[7]=

EventDeduplication (1) 

Keep or remove duplicate events:

In[8]:=
ResourceFunction[
 "TokenEventGraph"][{{n_} :> {n + 1}, {n_} :> {2 n}}, {1, 2}, 2, "EventDeduplication" -> False]
Out[8]=
In[9]:=
ResourceFunction[
 "TokenEventGraph"][{{n_} :> {n + 1}, {n_} :> {2 n}}, {1, 2}, 2, "EventDeduplication" -> True]
Out[9]=

TokenMultiplicity (2) 

No token multiplicity:

In[10]:=
ResourceFunction["TokenEventGraph"][{{n_, 2} :> {n + 10}}, {1, 2}, 1, "AllSubsets" -> False]
Out[10]=

Allow token multiplicity:

In[11]:=
ResourceFunction["TokenEventGraph"][{{n_, 2} :> {n + 10}}, {1, 2}, 1, "AllSubsets" -> False, "TokenMultiplicity" -> Automatic]
Out[11]=

TokenLabeling (1) 

Disable custom token labeling:

In[12]:=
ResourceFunction[
 "TokenEventGraph"][{{n_} :> {n + 1}, {n_} :> {2 n}}, {1, 2}, 2, "TokenLabeling" -> None]
Out[12]=

EventLabeling (1) 

Label events by its rule index:

In[13]:=
ResourceFunction[
 "TokenEventGraph"][{{n_} :> {n + 1}, {n_} :> {2 n}}, {1, 2}, 2, "EventDeduplication" -> False, "EventLabeling" -> "Colors"]
Out[13]=

TokenRenderingFunction (1) 

Specify rendering for the token:

In[14]:=
ResourceFunction[
 "TokenEventGraph"][{{n_} :> {n + 1}, {n_} :> {2 n}}, {1, 2}, 2, "TokenRenderingFunction" -> (Style[#, 12, Bold, Red] &)]
Out[14]=

Version History

  • 3.0.0 – 22 April 2024
  • 2.2.0 – 14 March 2022
  • 2.1.0 – 07 March 2022
  • 2.0.0 – 23 February 2022
  • 1.2.0 – 15 February 2022
  • 1.1.2 – 19 January 2022

Related Resources

License Information