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.
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 lengththree 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}}.
