paper

Generating Signed Permutations by Twisting Two-Sided Ribbons

arXiv:2311.06974

Abstract

We provide a simple and natural solution to the problem of generating all signed permutations of . Our solution provides a pleasing generalization of the most famous ordering of permutations: plain changes (Steinhaus-Johnson-Trotter algorithm). In plain changes, the permutations of are ordered so that successive permutations differ by swapping a pair of adjacent symbols, and the order is often visualized as a weaving pattern involving ropes. Here we model a signed permutation using ribbons with two distinct sides, and each successive configuration is created by twisting (i.e., swapping and turning over) two neighboring ribbons or a single ribbon. By greedily prioritizing -twists of the largest symbol before -twists of the largest symbol, we create a signed version of plain change's memorable zig-zag pattern. We provide a loopless algorithm (i.e., worst-case -time per object) by extending the well-known mixed-radix Gray code algorithm.

15 pages, 7 figures