Efficient computation of middle levels Gray codes
Preprint
Abstract
For any integer $n\geq 1$ a middle levels Gray code is a cyclic listing of all bitstrings of length $2n+1$ that have either $n$ or $n+1$ entries equal to 1 such that any two consecutive bitstrings in the list differ in exactly one bit. The question whether such a Gray code exists for every $n\geq 1$ has been the subject of intensive research during the last 30 years, and has been answered affirmatively only recently [T. M\"utze. Proof of the middle levels conjecture. arXiv:1404.4442, 2014]. In this work we provide the first efficient algorithm to compute a middle levels Gray code. For a given bitstring, our algorithm computes the next $\ell$ bitstrings in the Gray code in time $\mathcal{O}(n\ell(1+\frac{n}{\ell}))$, which is $\mathcal{O}(n)$ on average per bitstring provided that $\ell=\Omega(n)$.
Keywords
All Related Versions
This publication has 21 references indexed in Scilit:
- The Prism Over the Middle-levels Graph is HamiltonianOrder, 2005
- Monotone Gray codes and the middle levels problemJournal of Combinatorial Theory, Series A, 1995
- An explicit 1-factorization in the middle of the boolean latticeJournal of Combinatorial Theory, Series A, 1994
- On Rotations and the Generation of Binary TreesJournal of Algorithms, 1993
- Adjacent interchange generation of combinationsJournal of Algorithms, 1988
- Explicit matchings in the middle levels of the Boolean latticeOrder, 1988
- Lexicographic matchings cannot form Hamiltonian cyclesOrder, 1988
- The rotation graph of binary trees is HamiltonianJournal of Algorithms, 1987
- An algorithm for generating subsets of fixed size with a strong minimal change propertyInformation Processing Letters, 1984
- Gray codes with restricted densityDiscrete Mathematics, 1984