Ghost Leg (Chinese: 畫鬼腳), known in Japan as Amidakuji (阿弥陀籤, "Amida lottery", so named because the paper was folded into a fan shape resembling Amida's halo1) or in Korea as Sadaritagi (사다리타기, literally "ladder climbing"), is a method of lottery designed to create random pairings between two sets of any number of things, as long as the number of elements in each set is the same. This is often used to distribute things among people, where the number of things distributed is the same as the number of people.
The picture depicts how the game is played

You can add as many rungs on the ladders as you want. But the minimal rungs needed to show the same permutation of above and below elements is what wikipedia calls 'Prime Ladder'.
To get a prime ladder Wikipedia describes bubble sort method where 2 operations happen usually.
These 2 operations :

These 2 operations reduce the number of rungs keeping the permutation of elements as the same when the rungs were not reduced.
The second operation of eliminating 2 rungs consecutively can be easily understood since you go to the other vertical line through one rung and come back to the original vertical line through the next rung.
But why does the first operation work? How can we mirror switch the rungs like shown in the 1st operation.
To get more clarity about this question you can go here
For both pairs the ladders are equivalent: The first pair of ladders maps (a,b,c) to (3,2,1), the second pair of ladders maps (a,b) to (1,2)
Another interesting question is, why is this always a permutation? Is it possible the at two letters are assigned to the same number? With induction we can prove that it this mapping is always a permutation. We start with a ladder with no rungs. This is always a permutation (if we identify a with 1, b with 2,...)
Now assume that we have already assigned some rungs. We are not interested in details, so we don't show the actual rungs. We only assume that all rungs are in the black area.
If we now add a new rung, e.g. the red one, we still have a permutation. The only thing that changes is that the letter that had previously assigned 3 has now assigned 4 and the latter that had previously assigned 4 has now assigned 3. So we can build such a ladder step by step and we will always have a permutation after each step. From these pictures we also can deduce: Every segment on the horizontal line is traversed only by one path, every rung is traversed exactly two times. These two traversals have opposite direction.