I am trying to essentially do what was done at this link, except for five elements instead of four.
The link gives all of the possible sequences of permutations of four elements with the following 2 constraints:
- Only neighbor swaps are allowed to get the next permutation in the sequence
- The sequence has to end on the same permutation it started on - it's a cycle
I'm trying to solve the same problem with 5 elements, find all sequences of 120 swaps that visit every permutation. There are 7 valid swaps for each row:
I can only think to make a graph and find all the Hamiltonian cycles on it, and I don't know how to do that without making it take til the sun burns out. Is there a way to solve this in a reasonable amount of time?