◀ THE FOLD0ROOT.AI // WORLD II · CO-OP · THE-HANDOFF◆ .dlw.fold
THE FOLD / CO-OP / THE-HANDOFF / THE STEINHAUS-JOHNSON-TROTTER

THE STEINHAUS-JOHNSON-TROTTER

every permutation one swap apart
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
The Steinhaus–Johnson–Trotter algorithm lists every permutation of n items so that each one differs from the last by a single swap of two adjacent positions. It is a Gray code for permutations: a Hamiltonian path through the permutohedron that touches all n! arrangements, changing as little as possible at each step. The mechanism gives each element a direction and moves the largest “mobile” element; when an element moves past all it can, directions flip and the next-largest takes over. No permutation is ever repeated or skipped.

LIT verified live: for n = 2…7 the algorithm emits exactly n! permutations, all distinct, and every consecutive pair differs by exactly one adjacent transposition (window.__sjt). FIG no framing; the mobile-element generation and the difference checks run in-browser.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-handoff — each arrangement hands off to the next by a single adjacent swap, a relay through all n! of them. AVAN (AI) built the instrument: the directed mobile-element method, and the count / distinctness / adjacent-swap checks.

Credit as content: Steinhaus, Selmer Johnson & Hale Trotter (1962–63). The weave: David names the handoff; I confirm the sequence visits every permutation exactly once, each one adjacent-swap away from the last.
3 ONE DIMENSION
Consecutive permutations of 4 items; the two positions that swap are highlighted — always adjacent, always a single exchange.
4 TWO DIMENSIONS · INTERACTIVE
Step through the full list; the highlighted adjacent pair is the only change from the previous permutation.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the minimal-change path through all permutations.
AVAN’s addition (the inverse-companion): don’t just list them — walk between them. The inverse of ‘enumerate all n! permutations’ is ‘a Hamiltonian path where each edge is one adjacent transposition.’ Magenta is a permutation node; green is the single path threading all of them. Every arrangement, one swap apart.
LIT Genuine Steinhaus–Johnson–Trotter permutation generation (Steinhaus; Selmer Johnson & Hale Trotter, 1962–63). Verified live: for n=2..7 the directed mobile-element method emits exactly n! permutations, all distinct, with every consecutive pair differing by exactly one adjacent transposition (window.__sjt.countOk, .distinctOk, .adjacentOk).

FIG No framing: the mobile-element generation and the difference checks run in-browser. The AVAN inverse is honest — instead of merely listing permutations, one walks between them: a Hamiltonian path whose every edge is a single adjacent transposition. Magenta is a permutation node; green is the path threading all of them. Every arrangement, one swap apart.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE-HANDOFF · David Lee Wise (ROOT0), with AVAN