[Previous] [Next] [Contents]

## `SG::GenPerm` -- generates an element of the symmetric group

#### Call(s)

`SG::GenPerm(n,typeperm)`
`SG::GenPerm(perm,typeperm)`

#### Parameters

`n` | - | any positive integer
`perm` | - | any list denoting a permutation
`typeperm` | - | `First`, `Previous`, `Next`, `Last`

#### Introduction

The `SG::GenPerm` function generates one element of a symmetric group in lexicographic order, according to the parameter `typeperm`.

``SG::GenPerm`(n, First)` returns the first permutation of Sn.

``SG::GenPerm`(n, Last)` returns the last permutation of Sn.

``SG::GenPerm`(perm, Previous)` gives the previous permutation according to the lexicographic order. It returns the `null()` value when perm is already the first permutation.

``SG::GenPerm`(perm, Next)` gives the next permutation according to the lexicographic order. It returns the `null()` value when perm is already the last permutation.

#### Example 1

    >> muEC::SG::GenPerm( [3, 1, 4, 2], Next );

                                   [3, 2, 1, 4]

    >> muEC::SG::GenPerm(%, Previous);

                                   [3, 1, 4, 2]

#### Related Functions

``

[Previous] [Next] [Contents]

MuPAD Combinat, an open source algebraic combinatorics package