Function Repository Resource:

PermutationCyclesGraph

A graph representing cycles and fixed points of a permutation

Contributed by: Wolfram Staff
 ResourceFunction["PermutationCyclesGraph"][perm] constructs a graph of disjoint cycles representing the permutation perm.

Details and Options

ResourceFunction["PermutationCyclesGraph"] accepts the same options as Graph.

Examples

Basic Examples (2)

Permutation cycles represented as a graph:

 In[1]:=
 In[2]:=
 Out[2]=

Or as a list:

 In[3]:=
 Out[3]=

Scope (2)

Cycles graph of a permutation list:

 In[4]:=
 Out[4]=

Permutation represented as Cycles:

 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=

Properties and Relations (1)

Permutation cycles graph can also be constructed, possibly less efficiently, by finding the ordering of a permutation:

 In[7]:=
 In[8]:=
 Out[8]=
 In[9]:=
 Out[9]=

Possible Issues (3)

PermutationCyclesGraph of a permutation represented as cycles does not include fixed points; neither does the Cycles representation:

 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=

Construct a permutation list to include fixed points:

 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

Alternatively, use an arbitrary head, rather than Cycles, when computing permutation cycles:

 In[14]:=
 Out[14]=
 In[15]:=
 Out[15]=

Version History

• 1.0.0 – 14 September 2020