Function Repository Resource:

RandomWolframModel

Source Notebook

Generate a random canonical Wolfram model rule with a particular signature

Contributed by: Stephen Wolfram & Max Piskunov

ResourceFunction["RandomWolframModel"][signature]

generates a random Wolfram model rule with the specified signature.

ResourceFunction["RandomWolframModel"][signature,n]

generates a random Wolfram model using at most n distinct elements.

Details and Options

The signature is given in the form lhsrhs, where each lhs or rhs is a list of pairs {count,arity} where count gives the number of hyperedges of specified arity.
ResourceFunction["RandomWolframModel"] gives a canonical form of each rule it returns.

Examples

Basic Examples (3) 

Generate a random 23 32 Wolfram model rule:

In[1]:=
ResourceFunction["RandomWolframModel"][{{2, 3}} -> {{3, 2}}]
Out[1]=

Generate a 23 32 Wolfram model rule, restricting to two distinct elements:

In[2]:=
ResourceFunction["RandomWolframModel"][{{2, 3}} -> {{3, 2}}, 2]
Out[2]=

Generate a random 23 32 Wolfram model rule:

In[3]:=
ResourceFunction["RandomWolframModel"][{{2, 3}} -> {{3, 2}}]
Out[3]=

Generate a random 23224382 with at most 12 elements:

In[4]:=
ResourceFunction[
 "RandomWolframModel"][{{2, 3}, {2, 2}} -> {{4, 3}, {8, 2}}, 12]
Out[4]=

Generate a random rule containing two different transformations:

In[5]:=
ResourceFunction[
 "RandomWolframModel"][{{{2, 3}} -> {{3, 2}}, {{2, 4}} -> {{3, 1}}}]
Out[5]=

Possible Issues (2) 

By default (Automatic connectedness), disconnected right-hand sides can be generated as long as all of their components are still connected to the left-hand side:

In[6]:=
SeedRandom[38]; RulePlot[
 ResourceFunction["WolframModel"][
  ResourceFunction["RandomWolframModel"][{{2, 3}} -> {{3, 3}}, 7]]]
Out[6]=

Note that evolution may still be connected in this case if there are other edges connecting vertices on the left-hand side:

In[7]:=
ResourceFunction["WolframModel"][SeedRandom[38]; ResourceFunction["RandomWolframModel"][{{2, 3}} -> {{3, 3}}, 7], {{1, 1, 1}, {1, 1, 1}}, 5, "StatesPlotsList"]
Out[7]=

Version History

  • 4.0.0 – 20 April 2020
  • 3.0.0 – 31 December 2019
  • 2.0.0 – 20 December 2019
  • 1.0.0 – 04 December 2019

Related Resources

Author Notes

In its present form, this will not correctly weight all canonical forms the same.

License Information