The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CM::Group::Sym - An implementation of the symmetric group S_n

DESCRIPTION

CM::Group::Sym is an implementation of the Symmetric Group

SYNOPSIS

    use CM::Group::Sym;
    my $G = CM::Group::Sym->new({$n=>3});

This way you will generate S_3 with all it's 6 elements which are permutations. Say you want to print the operation table(Cayley table).

    print $G

    6 5 4 3 2 1
    3 4 5 6 1 2
    2 1 6 5 4 3
    5 6 1 2 3 4
    4 3 2 1 6 5
    1 2 3 4 5 6

Note that those are only labels for the elements as printing the whole permutations would render the table useless since they wouldn't fit.

So if you want to see the meaning of the numbers(the permutations behind them) you can use str_perm()

    print $G->str_perm;

    1 -> 3 2 1
    2 -> 2 3 1
    3 -> 2 1 3
    4 -> 3 1 2
    5 -> 1 3 2
    6 -> 1 2 3

draw_cayley_digraph($path)

This method will draw the cayley digraph of the group to png to the given $path.

NOTES

Internally the permutations are stored in arrayref of arrayrefs and each cell contains a CM::Permutation object.

AUTHOR

Stefan Petrea, <stefan.petrea at gmail.com>