Function Repository Resource:

CayleyNestGraph

Source Notebook

Create a generalized Cayley graph from generators and relations

Contributed by: Stephen Wolfram and Jan Mangaldan

ResourceFunction["CayleyNestGraph"][{gens,rels},inits,n]

generates a generalized Cayley graph for a system for generators gens and relations rels, starting from the elements inits and going n steps.

Details and Options

The group elements are taken to be strings in gens, rels and inits. The group operation is taken to be string concatenation.
The identity element is taken to be "" in rels and inits.
Commutativity is represented in rels with TwoWayRule. Otherwise, the result of a group operation is represented with Rule.
CayleyNestGraph takes the same options as Graph.

Examples

Basic Examples (5) 

Make 5 steps in the Cayley graph for the free group with two generators:

In[1]:=
TreePlot[ResourceFunction["CayleyNestGraph"][{{"A", "B"}, {}}, {""}, 5], Center]
Out[1]=

Label the elements:

In[2]:=
TreePlot[ResourceFunction["CayleyNestGraph"][{{"A", "B"}, {}}, {""}, 4], Center, VertexLabels -> Automatic]
Out[2]=

Make a Cayley graph for a commutative semigroup:

In[3]:=
Graph[ResourceFunction[
  "CayleyNestGraph"][{{"A", "B"}, {"AB" <-> "BA"}}, {""}, 7], GraphLayout -> "SpringElectricalEmbedding"]
Out[3]=

Commutative group with two elements and their inverses:

In[4]:=
Graph[ResourceFunction[
  "CayleyNestGraph"][{{"A", "B", "a", "b"}, {"AB" <-> "BA", "ab" <-> "ba", "Ba" <-> "aB", "Ab" <-> "bA", "Aa" -> "", "aA" -> "", "bB" -> "", "Bb" -> ""}}, {""}, 3], GraphLayout -> "SpringElectricalEmbedding", VertexLabels -> Automatic]
Out[4]=

Torus graph:

In[5]:=
Graph[ResourceFunction[
  "CayleyNestGraph"][{{"A", "B"}, {"AB" <-> "BA", "AAAAAA" -> "", "BBBB" -> ""}}, {""}, 9], GraphLayout -> "SpringElectricalEmbedding"]
Out[5]=

Quaternion group:

In[6]:=
Graph[ResourceFunction[
  "CayleyNestGraph"][{{"i", "j"}, {"jij" -> "i", "iji" -> "j"}}, {""},
   10], GraphLayout -> "SpringElectricalEmbedding"]
Out[6]=

SL(2Z):

In[7]:=
Graph[ResourceFunction[
  "CayleyNestGraph"][{{"a", "b"}, {"aba" -> "bab", "abaabaabaaba" -> ""}}, {""}, 10], GraphLayout -> "SpringElectricalEmbedding"]
Out[7]=

Version History

  • 2.0.0 – 25 March 2020
  • 1.0.0 – 16 March 2020

License Information