Class PermutationGroup


public class PermutationGroup extends Object

A permutation group with a Schreier-Sims representation. For a number n, a list of permutation sets is stored (U0,...,Un-1). All n! permutations of [0...n-1] can be reconstructed from this list by backtracking - see, for example, the generateAll method.

So if G is a group on X = {0, 1, 2, 3, ..., n-1}, then:

G0 = {g ∈ G : g(0) = 0}
G1 = {g ∈ G0 : g(1) = 1}
G2 = {g ∈ G1 : g(2) = 2}
Gn-1 = {g in Gn-2 : g(n - 1) = n - 1} = {I}
and G0, G1, G2, ..., Gn-1 are subgroups of G.

Now let orb(0) = {g(0) : g ∈ G} be the orbit of 0 under G. Then |orb(0)| (the size of the orbit) is n0 for some integer 0 < n0 ≤ n and write orb(0) = {x0,1, x0,2, ..., x0,n₀} and for each i, 1 ≤ i ≤ n0 choose some h0,1 in G such that h0,i(0) = x0,1. Set U0 = {h0,1, ..., h0,n₀}.

Given the above, the list of permutation sets in this class is [U0,..,Un]. Also, for all i = 1, ..., n-1 the set Ui is a left transversal of Gi in Gi-1.

This is port of the code from the C.A.G.E.S. book [Kreher, Donald and Stinson, Douglas, Combinatorial Algorithms Generation Enumeration and Search, 1998, CRC Press]. The mathematics in the description above is also from that book (pp. 203).

Belongs to CDK module:
  • Constructor Details

    • PermutationGroup

      public PermutationGroup(int size)
      Make a group with just a single identity permutation of size n.
      size - the number of elements in the base permutation
    • PermutationGroup

      public PermutationGroup(Permutation base)
      Creates the initial group, with the base base.
      base - the permutation that the group is based on
    • PermutationGroup

      public PermutationGroup(int size, List<Permutation> generators)
      Creates a group from a set of generators. See the makeSymN method for where this is used to make the symmetric group on N using the two generators (0, 1) and (1, 2, ..., n - 1, 0)
      size - the size of the group
      generators - the generators to use to make the group
  • Method Details

    • makeSymN

      public static PermutationGroup makeSymN(int size)
      Make the symmetric group Sym(N) for N. That is, a group of permutations that represents _all_ permutations of size N.
      size - the size of the permutation
      a group for all permutations of N
    • getSize

      public int getSize()
      Get the number of elements in each permutation in the group.
      the size of the permutations
    • order

      public long order()
      Calculates the size of the group.
      the (total) number of permutations in the group
    • get

      public Permutation get(int uIndex, int uSubIndex)
      Get one of the permutations that make up the compact representation.
      uIndex - the index of the set U.
      uSubIndex - the index of the permutation within Ui.
      a permutation
    • getLeftTransversal

      public List<Permutation> getLeftTransversal(int index)
      Get the traversal Ui from the list of transversals.
      index - the index of the transversal
      a list of permutations
    • transversal

      public List<Permutation> transversal(PermutationGroup subgroup)
      Generate a transversal of a subgroup in this group.
      subgroup - the subgroup to use for the transversal
      a list of permutations
    • apply

      public void apply(PermutationGroup.Backtracker backtracker)
      Apply the backtracker to all permutations in the larger group.
      backtracker - a hook for acting on the permutations
    • all

      public List<Permutation> all()
      Generate the whole group from the compact list of permutations.
      a list of permutations
    • changeBase

      public void changeBase(Permutation newBase)
      Change the base of the group to the new base newBase.
      newBase - the new base for the group
    • enter

      public void enter(Permutation g)
      Enter the permutation g into this group.
      g - a permutation to add to the group
    • test

      public int test(Permutation permutation)
      Test a permutation to see if it is in the group. Note that this also alters the permutation passed in.
      permutation - the one to test
      the position it should be in the group, if any
    • toString

      public String toString()
      toString in class Object