permucycle returns a matrix containing information of a permutation. See the Value section for details.
permucycle(x)
Given a permutation x of the numbers 1, 2, ..., n, and i with value from 1 to n. permucycle() returns a (n+1) by (n+1) matrix A with
the total number of cycles
the length of the i-th cycle
the members of the i-th cycle
For example, permucycle(c(3,2,1)) will produce the following matrix:
[,1] [,2] [,3] [,4]
[1,] 2 0 0 0
[2,] 2 1 3 0
[3,] 1 2 0 0
[4,] 0 0 0 0
The 2 in the first row means there are two cycles;
The second row means there is a cycle of length 2, with members (1,3);
The third row means there is a cycle of length 1, with member (2);
The fourth row is redundant for this specific case.
One can read from the output of permucycle() to obtain cycle notation (13)(2) of the permutation, and other information.
a permutation
perm
, permuorder
,cycledisplay