I have the following list representing a permutation on 26 characters:
{{G, G}, {O, P}, {V, L}, {Y, Y}, {C, X}, {H, I}, {P, S}, {W, R},
{I, H}, {Q, D}, {X, C}, {J, B}, {D, M}, {K, O}, {R, N}, {Z, K},
{L, Q}, {M, F}, {S, A}, {N, Z}, {A, T}, {E, U}, {T, W}, {B, V},
{F, E}, {U, J}}
How can I "simplify" this list to show the cyclic form of the permutations? A possibility of the above list would be:
{{A, T, W, R, N, Z, K, O, P, S}, {B, V, L, Q, D, M, F, E, U, J},
{C, X}, {G}, {H, I}, {Y}}
I'm new to Mathematica and I could write an ugly loop to do this, but I've noticed that Mathematica usually has elegant solutions for problems like this that I wouldn't be able to think of on my own. Thus, I haven't tried to do anything because I couldn't find anything while searching for this.
I could still be overlooking something, but I tried converting the list to numeral values with A=1 and I got the following error:
Cycles::reppoint: Cycles[{{7, 7}, {15, 16}, {22, 12},
{25, 25}, {3, 24}, {8, 9}, {16, 19}, {23, 18}, {9, 8},
{17, 4}, {24, 3}, {10, 2}, {4, 13}, {11, 15}, {18, 14},
{26, 11}, {12, 17}, {13, 6}, {19, 1}, {14, 26}, {1, 20},
{5, 21}, {20, 23}, {2, 22}, {6, 5}, {21, 10}}]
contains repeated integers.
Cycles[]
? $\endgroup$