Cycles in Random Sample Permutations
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
The top left plot represents a random permutation of grays. The top right plot colors the pixels according to the memberships of sampled numbers in the cycles of this sampled permutation. Members of the largest cycle are marked black. The lower plot sorts the pixels according to cycle membership. The red numbers in the grid count the elements in the cycles; the black numbers give these cycles or the first few members of longer cycles.
Contributed by: Michael Schreiber (March 2011)
Open content licensed under CC BY-NC-SA
Snapshots
Details
As an example, the permutation {1, 3, 2, 5, 6, 4, 8, 9, 7, 11, 12, 13, 14, 15, 16, 10} can be written in terms of cycles as (1)(2, 3)(4, 5, 6)(7, 8, 9)(10, 11, 12, 13, 14, 15, 16).
For these five cycles black pixels mark the positions {10, 11, 12, 13, 14, 15, 16}. Two colors would mark positions corresponding to members of the two length-three cycles (4, 5, 6) and (7, 8, 9). A fourth color is needed to represent the transposition pair (2, 3) and a fifth color marks the singleton cycle (1). Sorting all pixel color values and partitioning gives the matrix: {{1, 1, 1, 1}, {1, 1, 1, 2}, {2, 2, 3, 3}, {3, 4, 4, 5}}.
Permanent Citation
"Cycles in Random Sample Permutations"
http://demonstrations.wolfram.com/CyclesInRandomSamplePermutations/
Wolfram Demonstrations Project
Published: March 7 2011