next up previous contents index
suivant: Product of disjoint cycles monter: Permutations précédent: Random permutation : randperm   Table des matières   Index


Decomposition as a product of disjoint cycles :
permu2cycles

permu2cycles takes as argument a permutation.
permu2cycles returns its decomposition as a product of disjoint cycles.
Input :
permu2cycles([1,3,4,5,2,0])
Output :
[[0,1,3,5],[2,4]]
In the answer the cycles of size 1 are omitted, except if n - 1 is a fixed point of the permutation (this is required to find the value of n from the cycle decomposition).
Input :
permu2cycles([0,1,2,4,3,5])
Output :
[[5],[3,4]]
Input :
permu2cycles([0,1,2,3,5,4])
Output :
[[4,5]]



giac documentation written by Renée De Graeve and Bernard Parisse