needed to eliminate loops from the procedure make it slower in practice. Related structures Permutohedron The set of all permutations of items may be represented geometrically by a permutohedron, the polytope formed from the convex hull of vectors, the permutations of the vector . Although defined in this way in -dimensional space, it is actually an -dimensional polytope; for example, the permutohedron on four items is a three-dimensional polyhedron, the truncated octahedron. If each vertex of the permutohedron is labeled by the inverse permutation to the permutation defined by its vertex coordinates, the resulting labeling describes a Cayley graph of the symmetric group of permutations on items, as generated by the permutations that swap adjacent pairs of items. Thus, each two consecutive permutations in the sequence generated by the Steinhaus–Johnson–Trotter algorithm correspond in this way to two vertices that form the endpoints of an edge in the permutohedron, and the whole sequence of permutations describes a Hamiltonian path in the permutohedron, a path that passes through each vertex exactly once. If the sequence of permutations is completed by adding one more edge from the last permutation to the first one in the sequence, the result is instead a Hamiltonian cycle. Gray codes A Gray code for numbers in a given radix is a sequence that contains each number up to a given limit exactly once, in such a way that each pair of consecutive numbers differs by one in a single digit. The permutations of the numbers from 1 to may be placed in one-to-one correspondence with the numbers from 0 to by pairing each permutation with the sequence of numbers that count the number of positions in the permutation that are to the right of value and that contain a value less than (that is, the number of inversions for which is the larger of the two inverted values), and then interpreting these sequences as numbers in the factorial number system, that is, the mixed radix system with radix sequence For instance, the permutation would give the values , , , , and . The sequence of these values, , gives the number Consecutive permutations in the sequence generated by the Steinhaus–Johnson–Trotter algorithm have numbers of inversions that differ by one, forming a Gray code for the factorial number system. More generally, combinatorial algorithms researchers have defined a Gray code for a set of combinatorial objects to be an