This line in the WikiPedia article "all elements greater than the chosen element have their directions set to positive or negative, according to whether they are concentrated at the start or the end of the permutation respectively" has thrown me. The mis-interpretation I made, resulted in any permutation beyond 7 to falsly miss out on quite a number of permutations.
The implementation has now been fixed in version 0.2.2.
Last edit: Willem van Asperen 2013-10-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In my tests the permutation iterator does not generate all permutations when 8 or more elements are used:
The output is:
Correct! Thanks for picking this up!
I found this description of the Johnson-Trotter Algorithm that more clearly describes it: http://www.cut-the-knot.org/Curriculum/Combinatorics/JohnsonTrotter.shtml
This line in the WikiPedia article "all elements greater than the chosen element have their directions set to positive or negative, according to whether they are concentrated at the start or the end of the permutation respectively" has thrown me. The mis-interpretation I made, resulted in any permutation beyond 7 to falsly miss out on quite a number of permutations.
The implementation has now been fixed in version 0.2.2.
Last edit: Willem van Asperen 2013-10-11