WLJS LogoWLJS Notebook

PermutationCycles

PermutationCycles[perm] gives a disjoint cycle representation of permutation perm.

Examples

Get the cycle representation of a permutation list:

PermutationCycles[{3, 1, 4, 2}]
(* Cycles[{{1, 3, 4, 2}}] *)

Convert a cycle representation to a permutation list:

PermutationList[Cycles[{{1, 3, 4, 2}}]]
(* {3, 1, 4, 2} *)

Find cycles for the identity permutation:

PermutationCycles[{1, 2, 3, 4}]
(* Cycles[{}] *)

Please visit the official Wolfram Language Reference for more details.

On this page