For 0 to 5 labels starting at zero, construct the whole Steinhaus-Johnson-Trotte...
https://datenvertrag.halowerk.com/v1/adjacent-swap-permutation-tourOverview
For 0 to 5 labels starting at zero, construct the whole Steinhaus-Johnson-Trotter permutation tour from identity. Each transition swaps the largest mobile value with its adjacent smaller neighbor, then reverses directions of greater values. Own direction convention stores -1 or +1 by value, initially all -1; blocked values retain direction. Return every permutation, direction vector, incoming pair of zero-based adjacent positions and moved value.