Skip to content

PermutationCycles ​

A permutation given as a one-line word {σ(1),…,σ(n)}\{\sigma(1), \dots, \sigma(n)\}, converted to disjoint-cycle notation (Cycles). The other direction of Permute's two conventions.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguagePermutationCycles✓
PermutationCycles(perm)the cycles of the one-line permutation perm, fixed points dropped
SageMathenumeratio_permutation_cycles(perm)
PermutationCycles(perm, f)every position, fixed points included, each wrapped as a singleton — with f used in place of Cycles
Typed signatures
TypePackageApplies
(expression<Cycles> | list<integer>, any?) -> anygroupalgebraalways

Domain: Permutations

Details
  • Cycles come out ordered by, and each starting at, its smallest point
  • Already-Cycles input passes straight through unchanged — PermutationCycles is idempotent on its own output
  • The identity permutation has no non-trivial cycles, so PermutationCycles({1, ..., n}) is Cycles({})

Examples

Basic #

positions 3, 7 and 10 are fixed and drop out

live ↗
InPermutationCycles([2,5,3,6,1,8,7,9,4,10])\mathrm{PermutationCycles}(\bigl\lbrack2, 5, 3, 6, 1, 8, 7, 9, 4, 10\bigr\rbrack)OutCycles([[1,2,5],[4,6,8,9]])\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 2, 5\bigr\rbrack, \bigl\lbrack4, 6, 8, 9\bigr\rbrack\bigr\rbrack)

the identity fixes everything

live ↗
InPermutationCycles([1,2,3,4,5])\mathrm{PermutationCycles}(\bigl\lbrack1, 2, 3, 4, 5\bigr\rbrack)OutCycles([])\mathrm{Cycles}(\bigl\lbrack\bigr\rbrack)
Scope #

with a second argument, fixed points stay as singletons and head replaces Cycles

live ↗
InPermutationCycles([2,5,3,6,1,8,7,9,4,10],head)\mathrm{PermutationCycles}(\bigl\lbrack2, 5, 3, 6, 1, 8, 7, 9, 4, 10\bigr\rbrack, \mathrm{head})Outhead([[1,2,5],[3],[4,6,8,9],[7],[10]])\mathrm{head}(\bigl\lbrack\bigl\lbrack1, 2, 5\bigr\rbrack, \bigl\lbrack3\bigr\rbrack, \bigl\lbrack4, 6, 8, 9\bigr\rbrack, \bigl\lbrack7\bigr\rbrack, \bigl\lbrack10\bigr\rbrack\bigr\rbrack)

already in cycle notation — passed through

live ↗
InPermutationCycles(Cycles([[1,3,5],[2,4,6]]))\mathrm{PermutationCycles}(\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 3, 5\bigr\rbrack, \bigl\lbrack2, 4, 6\bigr\rbrack\bigr\rbrack))OutCycles([[1,3,5],[2,4,6]])\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 3, 5\bigr\rbrack, \bigl\lbrack2, 4, 6\bigr\rbrack\bigr\rbrack)

Converts a one-line permutation to cycles, dropping fixed points

live ↗
InPermutationCycles([6,3,2,5,4,1])\mathrm{PermutationCycles}(\bigl\lbrack6, 3, 2, 5, 4, 1\bigr\rbrack)OutCycles([[1,6],[2,3],[4,5]])\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 6\bigr\rbrack, \bigl\lbrack2, 3\bigr\rbrack, \bigl\lbrack4, 5\bigr\rbrack\bigr\rbrack)
live ↗
InPermutationCycles([1,2,3,4,5],Identity)\mathrm{PermutationCycles}(\bigl\lbrack1, 2, 3, 4, 5\bigr\rbrack, \mathrm{Identity})Out[[1],[2],[3],[4],[5]]\bigl\lbrack\bigl\lbrack1\bigr\rbrack, \bigl\lbrack2\bigr\rbrack, \bigl\lbrack3\bigr\rbrack, \bigl\lbrack4\bigr\rbrack, \bigl\lbrack5\bigr\rbrack\bigr\rbrack
Applications #

Only the two nontrivial cycles survive among twenty points

live ↗
InPermutationCycles([2,3,1,4,5,6,7,8,9,10,12,11,13,14,15,16,17,18,19,20])\mathrm{PermutationCycles}(\bigl\lbrack2, 3, 1, 4, 5, 6, 7, 8, 9, 10, 12, 11, 13, 14, 15, 16, 17, 18, 19, 20\bigr\rbrack)OutCycles([[1,2,3],[11,12]])\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 2, 3\bigr\rbrack, \bigl\lbrack11, 12\bigr\rbrack\bigr\rbrack)
Properties #

Cycles are written starting from their smallest point

live ↗
InPermutationCycles([4,5,1,3,2])\mathrm{PermutationCycles}(\bigl\lbrack4, 5, 1, 3, 2\bigr\rbrack)OutCycles([[1,4,3],[2,5]])\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 4, 3\bigr\rbrack, \bigl\lbrack2, 5\bigr\rbrack\bigr\rbrack)
About
Examples8
Checked againstWolfram Language 8 agreeSageMath 6 agree
CrosswalkWolfram LanguageSageMath

Implementation

mappedsagepackages/oracle/src/mappings.ts

See also: Cycles, CycleDecomposition, Permute, InversePermutation