134 research outputs found

    A constant-time algorithm for middle levels Gray codes

    Get PDF
    For any integer n≥1n\geq 1 a middle levels Gray code is a cyclic listing of all nn-element and (n+1)(n+1)-element subsets of {1,2,…,2n+1}\{1,2,\ldots,2n+1\} such that any two consecutive subsets differ in adding or removing a single element. The question whether such a Gray code exists for any n≥1n\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. Proc. London Math. Soc., 112(4):677--713, 2016]. In a follow-up paper [T. M\"utze and J. Nummenpalo. An efficient algorithm for computing a middle levels Gray code. To appear in ACM Transactions on Algorithms, 2018] this existence proof was turned into an algorithm that computes each new set in the Gray code in time O(n)\mathcal{O}(n) on average. In this work we present an algorithm for computing a middle levels Gray code in optimal time and space: each new set is generated in time O(1)\mathcal{O}(1) on average, and the required space is O(n)\mathcal{O}(n)

    Generating Signed Permutations by Twisting Two-Sided Ribbons

    Full text link
    We provide a simple and natural solution to the problem of generating all 2n⋅n!2^n \cdot n! signed permutations of [n]={1,2,…,n}[n] = \{1,2,\ldots,n\}. Our solution provides a pleasing generalization of the most famous ordering of permutations: plain changes (Steinhaus-Johnson-Trotter algorithm). In plain changes, the n!n! permutations of [n][n] are ordered so that successive permutations differ by swapping a pair of adjacent symbols, and the order is often visualized as a weaving pattern involving nn ropes. Here we model a signed permutation using nn ribbons with two distinct sides, and each successive configuration is created by twisting (i.e., swapping and turning over) two neighboring ribbons or a single ribbon. By greedily prioritizing 22-twists of the largest symbol before 11-twists of the largest symbol, we create a signed version of plain change's memorable zig-zag pattern. We provide a loopless algorithm (i.e., worst-case O(1)\mathcal{O}(1)-time per object) by extending the well-known mixed-radix Gray code algorithm.Comment: 15 pages, 7 figure

    Pop & Push: Ordered Tree Iteration in ?(1)-Time

    Get PDF

    Trimming and Gluing Gray Codes

    Get PDF
    We consider the algorithmic problem of generating each subset of [n]:={1,2,...,n} whose size is in some interval [k,l], 0 <= k <= l <= n, exactly once (cyclically) by repeatedly adding or removing a single element, or by exchanging a single element. For k=0 and l=n this is the classical problem of generating all 2^n subsets of [n] by element additions/removals, and for k=l this is the classical problem of generating all n over k subsets of [n] by element exchanges. We prove the existence of such cyclic minimum-change enumerations for a large range of values n, k, and l, improving upon and generalizing several previous results. For all these existential results we provide optimal algorithms to compute the corresponding Gray codes in constant time O(1) per generated set and space O(n). Rephrased in terms of graph theory, our results establish the existence of (almost) Hamilton cycles in the subgraph of the n-dimensional cube Q_n induced by all levels [k,l]. We reduce all remaining open cases to a generalized version of the middle levels conjecture, which asserts that the subgraph of Q_(2k+1) induced by all levels [k-c,k+1+c], c in {0, 1, ...k}, has a Hamilton cycle. We also prove an approximate version of this conjecture, showing that this graph has a cycle that visits a (1-o(1))-fraction of all vertices

    Space-Optimal Quasi-Gray Codes with Logarithmic Read Complexity

    Get PDF
    A quasi-Gray code of dimension n and length l over an alphabet Sigma is a sequence of distinct words w_1,w_2,...,w_l from Sigma^n such that any two consecutive words differ in at most c coordinates, for some fixed constant c>0. In this paper we are interested in the read and write complexity of quasi-Gray codes in the bit-probe model, where we measure the number of symbols read and written in order to transform any word w_i into its successor w_{i+1}. We present construction of quasi-Gray codes of dimension n and length 3^n over the ternary alphabet {0,1,2} with worst-case read complexity O(log n) and write complexity 2. This generalizes to arbitrary odd-size alphabets. For the binary alphabet, we present quasi-Gray codes of dimension n and length at least 2^n - 20n with worst-case read complexity 6+log n and write complexity 2. This complements a recent result by Raskin [Raskin \u2717] who shows that any quasi-Gray code over binary alphabet of length 2^n has read complexity Omega(n). Our results significantly improve on previously known constructions and for the odd-size alphabets we break the Omega(n) worst-case barrier for space-optimal (non-redundant) quasi-Gray codes with constant number of writes. We obtain our results via a novel application of algebraic tools together with the principles of catalytic computation [Buhrman et al. \u2714, Ben-Or and Cleve \u2792, Barrington \u2789, Coppersmith and Grossman \u2775]

    Group field theories for all loop quantum gravity

    Full text link
    Group field theories represent a 2nd quantized reformulation of the loop quantum gravity state space and a completion of the spin foam formalism. States of the canonical theory, in the traditional continuum setting, have support on graphs of arbitrary valence. On the other hand, group field theories have usually been defined in a simplicial context, thus dealing with a restricted set of graphs. In this paper, we generalize the combinatorics of group field theories to cover all the loop quantum gravity state space. As an explicit example, we describe the GFT formulation of the KKL spin foam model, as well as a particular modified version. We show that the use of tensor model tools allows for the most effective construction. In order to clarify the mathematical basis of our construction and of the formalisms with which we deal, we also give an exhaustive description of the combinatorial structures entering spin foam models and group field theories, both at the level of the boundary states and of the quantum amplitudes.Comment: version published in New Journal of Physic

    A constant-time algorithm for middle levels Gray codes

    Get PDF
    For any integer~n≥1n\geq 1, a \emph{middle levels Gray code} is a cyclic listing of all nn-element and (n+1)(n+1)-element subsets of {1,2,…,2n+1}\{1,2,\ldots,2n+1\} such that any two consecutive sets differ in adding or removing a single element. The question whether such a Gray code exists for any~n≥1n\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. \textit{Proc. London Math. Soc.}, 112(4):677--713, 2016]. In a follow-up paper [T.~M\"utze and J.~Nummenpalo. An efficient algorithm for computing a middle levels Gray code. \textit{ACM Trans. Algorithms}, 14(2):29~pp., 2018] this existence proof was turned into an algorithm that computes each new set in the Gray code in time~\cO(n) on average. In this work we present an algorithm for computing a middle levels Gray code in optimal time and space: each new set is generated in time~\cO(1), and the required space is~\cO(n)
    • …
    corecore