• No results found

Gray codes and symmetric chains

N/A
N/A
Protected

Academic year: 2020

Share "Gray codes and symmetric chains"

Copied!
14
0
0

Loading.... (view fulltext now)

Full text

(1)

Petr Gregor

Department of Theoretical Computer Science and Mathematical Logic, Charles University, Prague, Czech Republic

[email protected]

Sven Jäger

Institut für Mathematik, Technische Universität Berlin, Germany [email protected]

Torsten Mütze

Institut für Mathematik, Technische Universität Berlin, Germany [email protected]

Joe Sawada

School of Computer Science, University of Guelph, Canada [email protected]

Kaja Wille

Institut für Mathematik, Technische Universität Berlin, Germany [email protected]

Abstract

We consider the problem of constructing a cyclic listing of all bitstrings of length 2n+ 1 with Hamming weights in the interval [n+ 1−`, n+`], where 1≤`n+ 1, by flipping a single bit in each step. This is a far-ranging generalization of the well-known middle two levels problem (`= 1). We provide a solution for the case`= 2 and solve a relaxed version of the problem for general values of`, by constructing cycle factors for those instances. Our proof uses symmetric chain decompositions of the hypercube, a concept known from the theory of posets, and we present several new constructions of such decompositions. In particular, we construct four pairwise edge-disjoint symmetric chain decompositions of then-dimensional hypercube for any n≥12.

2012 ACM Subject Classification Mathematics of computing→Combinatorics, Mathematics of computing→Graph theory

Keywords and phrases Gray code, Hamilton cycle, hypercube, poset, symmetric chain

Digital Object Identifier 10.4230/LIPIcs.ICALP.2018.66

Related Version A full version is available athttps://arxiv.org/abs/1802.06021.

1

Introduction

Gray codes are named after Frank Gray, a researcher at Bell Labs, who described a simple method to generate all 2n bitstrings of length n by flipping a single bit in each step [8], now known as the binary reflected Gray code. This code found widespread use, e.g., in circuit design and testing, signal processing and error correction, data compression, etc.; many more applications are mentioned in the survey [28]. The binary reflected Gray code is also implicit in the well-known Towers of Hanoi puzzle and the Chinese ring puzzle that date back to the 19th century. The theory of Gray codes has developed considerably in the last decades, and the term is now used more generally to describe an exhaustive listing of any class of combinatorial objects where successive objects in the list differ by a

EA

TC

S

© Petr Gregor, Sven Jäger, Torsten Mütze, Joe Sawada, and Kaja Wille; licensed under Creative Commons License CC-BY

(2)

small amount. In particular, such generation algorithms have been developed for several fundamental combinatorial objects of interest for computer scientists, such as bitstrings, permutations, partitions, trees, etc., all of which are covered in depth in the most recent volume of Knuth’s seminal seriesThe Art of Computer Programming[20].

Since the discovery of the binary reflected Gray code, there has been continued interest in developing Gray codes for bitstrings of lengthnthat satisfy various additional constraints. For instance, a Gray code with the property that each bit is flipped (almost) the same number of times was first constructed by Tootill [35]. Goddyn and Gvozdjak constructed an n-bit Gray code in which any two flips of the same bit are almostnsteps apart [7], which is best possible. These are only two examples of a large body of work on possible Gray code transition sequences; see also [3, 5, 34]. Savage and Winkler constructed a Gray code that generates all 2n bitstrings such that all bitstrings with Hamming weightkappear before all bitstrings with weightk+ 2, for each 0≤kn−2 [29], where the Hamming weight of a bitstring is the number of its 1-bits. They used this construction to tackle the infamous middle two levels problem, which asks for a cyclic listing of all bitstrings of length 2n+ 1 with weights in the interval [n, n+ 1] by flipping a single bit in each step. This problem was raised in the 1980s and received considerable attention in the literature (a detailed historic account is given in [22]). A general existence proof for such a Gray code for anyn≥1 has been found only recently [12, 22], and an algorithm for computing it usingO(1) amortized time andO(n) space was subsequently presented in [23]. The starting point of this work is the following more general problem raised in [13, 27].

IProblem M (middle2`levels problem). For anyn≥1and1≤`n+ 1, construct a cyclic listing of all bitstrings of length2n+ 1with Hamming weights in the interval[n+ 1−`, n+`] by flipping a single bit in each step.

The special case`= 1 of Problem M is the middle two levels problem mentioned before. The case`=n+ 1 is solved by the binary reflected Gray code discussed in the beginning. Moreover, the cases`=nand`=n−1 were settled in [6, 21] and [13], respectively.

A natural framework for studying such Gray code problems is the n-dimensional hy-percube Qn, or n-cube for short, the graph formed by all bitstrings of lengthn, with an edge between any two bitstrings that differ in exactly one bit. The 5-cube is illustrated in Figure 1 (a). Thekth level of the n-cube is the set of all bitstrings with Hamming weight exactlyk. In this terminology, Problem M asks for a Hamilton cycle in the subgraph of the (2n+ 1)-cube induced by the middle 2` levels.

The most general version of this problem is whether the subgraph of then-cube induced by all levels in an arbitrary weight interval [a, b] has an (almost) Hamilton cycle. This was solved in [11] for all possible values ofn≥1 and 0≤abn, except in the cases when the lengthnof the bitstrings is odd and the levelsaandbare symmetric around the middle, which is exactly Problem M. For all other cases that paper provides algorithms that generate each bitstring in those Gray codes in constant time.

1.1

Our results

In this work we solve the case`= 2 of Problem M, i.e., we construct a cyclic listing of all bitstrings of length 2n+ 1 with Hamming weights in the interval [n−1, n+ 2].

(3)

Q5

(a) (b)

level 1

level 4

11111

11110 11101 11011 10111 01111

11100 11010 10110

01101 10011 10101 11001

01011 00111 01110

10010 01010

00101 01001 10001 10100

11000 01100 00011

00110

00010 00001 01000

10000 00100

00000

M M0

Figure 1(a) The 5-cube with the (standard) symmetric chain decomposition D0, where the edges along the chains are highlighted by thick lines. (b) Building a cycle factor through the middle four levels of the 5-cube as explained in the proof of Theorem 2 with SCDsD:=D0 (black) and D0

:=D0 (red). The edges that are removed fromDandD0

are dotted, so the solid and dashed edges are the two matchingsM andM0 whose union forms the cycle factor. It has three cycles of lengths 4, 4 and 22, visiting all 30 bitstrings with Hamming weight in the interval [1,4].

Combining Theorem 1 with the results from [11] shows more generally that the subgraph of then-cube induced by any four consecutive levels has an ‘almost’ Hamilton cycle.1

As another partial result towards Problem M, we show that the subgraph of the (2n+ 1)-cube induced by the middle 2`levels has a cycle factor. A cycle factor is a collection of disjoint cycles which together visit all vertices of the graph. In particular, a Hamilton cycle is a cycle factor consisting only of a single cycle. Note here that the existence of a cycle factor for general values of` is not an immediate consequence of Hall’s theorem, which is applicable only for`= 1 and `=n+ 1, as only in those cases all vertices of the underlying graph have the same degree.

ITheorem 2. For anyn≥1 and 1≤`n+ 1, the subgraph of the(2n+ 1)-cube induced by the middle2`levels has a cycle factor.

Our proof of Theorem 2 is concise and illustrative, and it motivates the subsequent discussion, so we present it right now. It uses a well-known concept from the theory of partially ordered sets (posets), a so-called symmetric chain decomposition. Here we define this term for the n-cube using graph-theoretic language. A symmetric chain inQn is a path (xk, xk+1, . . . , xnk) in then-cube wherexi is from levelifor allkink, and a symmetric chain decomposition, or SCD for short, is a partition of the vertices ofQn into symmetric chains. For illustration, an SCD ofQ5is shown in Figure 1 (a). We say that two SCDs areedge-disjointif the corresponding paths in the graphQn are edge-disjoint, i.e., if there are no two consecutive vertices in one chain of the first SCD that are also contained in one chain of the second SCD. There is a well-known construction of two edge-disjoint SCDs in then-cube for any n≥1 [31], which we will discuss momentarily.

1 If the four levels are not symmetric around the middle, then this subgraph of then-cube has two

(4)

1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 110 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 11 00 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 11 00 0 1 1 1 1 1 1 0 1 1 0 110 1 0 0 1 100 0 0 1 1 1 1 1 1 0 110 100 1 0 0 1 1 0 0 0 0 1 1 1 1 110 100 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 11 00 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1

1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1

) ) ) ( ( ( ) ( ( ) ( ( ) ( ( ) ) ( ( ( ( )

11 00 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1

1 00 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1

00 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1

x=

Figure 2The parenthesis matching approach for constructing the symmetric chain containing a bitstringx, yielding the symmetric chain decompositionD0. The highlighted bits are the leftmost unmatched 0 and the rightmost unmatched 1 in each bitstring.

Proof of Theorem 2. The proof is illustrated in Figure 1 (b). Consider two edge-disjoint SCDsDandD0 in the (2n+ 1)-cube. LetRandR0 be the chains obtained fromDandD0, respectively, by restricting them to the middle 2`levels, so chains that are longer than 2`−1 get shortened on both sides. As all chains inRandR0 start and end at symmetric levels and the dimension 2n+ 1 is odd, all these paths have odd length (possible lengths are 1,3, . . . ,2`−1). Therefore, by taking every second edge on every path fromRand R0, we obtain two perfect matchingsM andM0 in the subgraph of the (2n+ 1)-cube induced by the middle 2` levels. As the paths inRandR0 are edge-disjoint, the matchingsM andM0 are also edge-disjoint. Therefore, the union ofM andM0 is the desired cycle factor. J

This proof motivates the search for a large collection of pairwise edge-disjoint SCDs in then-cube. We can then use any two of them to construct a cycle factor as described in the previous proof, and use this cycle factor as a starting point for building a Hamilton cycle. This two-step approach of building a Hamilton cycle via a cycle factor proved to be very successful for such problems (see e.g. [15, 16, 17, 18, 22, 24, 30]). Consequently, for the rest of this section we focus on edge-disjoint SCDs in then-cube.

There is a well-known construction of an SCD for then-cube that is best described by the following parenthesis matching approach pioneered by Greene and Kleitman [9]; see Figure 2. For any vertexxof then-cube, we interpret the 0s inxas opening brackets and the 1s as closing brackets. By matching closest pairs of opening and closing brackets in the natural way, the chain containingxis obtained by flipping the leftmost unmatched 0 to move up the chain, or the rightmost unmatched 1 to move down the chain, until no more unmatched bits can be flipped. It is easy to see that this indeed yields an SCD of then-cube for anyn≥1. We denote this standard SCD byD0; it is shown in Figure 1 (a) forn= 5.

By taking complements, we obtain another SCD, which we denote byD0. It is not hard to see thatD0 andD0 are in fact edge-disjoint for anyn≥1 [31]. Figure 1 (b) shows both SCDs forn= 5, and how they are used for building a cycle factor. Apart from this standard construction, we are not aware of any other construction of an SCD in then-cube, even though there are several different ways to describe the same SCD (see e.g. [1, 4, 36]).

Our next result is a simple construction of another SCD in then-cube foreven values ofn≥2, which we callD1. This construction is based on lattice paths and will be explained in Section 4 below. It has the additional feature that D0, D0, D1 and D1 are pairwise edge-disjoint forn≥6.

(5)

Figure 3The edge-disjoint SCDsD0(dashed vertical paths) andD1 (solid paths; chains of the same length are drawn with the same color) in the 6-cube. The bitstrings are drawn with white squares representing 0s and black squares representing 1s.

Table 1Known pairwise edge-disjoint SCDs in then-cube forn= 1,2, . . . ,11. The definitions ofX5,Y5,Z5andX7,Y7 are given in Section 4.3.

n 1 2 3 4 5 6 7 8 9 10 11

bn/2c+ 1 1 2 2 3 3 4 4 5 5 6 6

SCDs D0 D0,D0 D0,D0 D0,D0, X5,Y5, D0,D0, X7,X7 D0,D0, D0,D0 D0,D0, D0,D0

D1 Z5 D1,D1 Y7,Y7 D1,D1 D1,D1

Figure 3 shows the SCDsD0andD1inQ6. Their complementsD0andD1are not shown for clarity. Note that four edge-disjoint SCDs are best possible forQ6, as they use up all edges incident with the middle level.

For odd values of n, we can still construct four edge-disjoint SCDs in then-cube (except in a few small cases). However, the construction is not as direct and explicit as for evenn.

ITheorem 4. Forn= 7and any oddn≥13, then-cube contains four pairwise edge-disjoint SCDs.

For oddn, we can combine any two of the four edge-disjoint SCDs in then-cube guaranteed by Theorem 4 to a cycle factor in the middle 2`levels, as explained before, yielding in total

4 2

= 6 distinct cycle factors, four of which are non-isomorphic. To prove Theorem 4, we construct four edge-disjoint SCDs in the 7-cube in an ad hoc fashion and then apply the following product construction.

ITheorem 5. IfQaandQbeach containkpairwise edge-disjoint SCDs, thenQa+bcontainsk pairwise edge-disjoint SCDs.

(6)

1.2

Related work

Apart from building Gray codes, symmetric chain decompositions have many other interesting applications, e.g., to construct rotation-symmetric Venn diagrams forn sets when nis a prime number [14, 26], and to solve the Littlewood-Offord problem on sums of vectors [2].

A notion that is closely related to edge-disjoint SCDs is that oforthogonal chain decompo-sitions, which were first considered by Shearer and Kleitman [31]. Two chain decompositions are calledorthogonalif every pair of chains has at most one vertex in common, where one also allows chains that are not symmetric around the middle or chains that skip some levels. Shearer and Kleitman showed in their paper thatD0 andD0 are almost orthogonal (only the longest chains have two elements in common), and they conjectured that then-cube has bn/2c+ 1 pairwise orthogonal chain decompositions where each decomposition consists of

n bn/2c

many chains. Spink recently made some progress towards this conjecture, by showing that then-cube has three orthogonal chain decompositions [32].

Pikhurko showed via a parenthesis matching argument that all edges of then-cube can be decomposed into symmetric chains [25]. However, it is not clear whether these chains contain a subset that forms an SCD. Another interesting construction relating Hamilton cycles and SCDs in then-cube was presented by Streib and Trotter [33]. They inductively construct a Hamilton cycle in then-cube for anyn≥2 that can be partitioned into symmetric chains forming an SCD. This Hamilton cycle has the minimal number of ‘peaks’ where the differences in the Hamming weight change sign.

1.3

Outline of this paper

In Section 2 we introduce several definitions that will be used throughout this paper. In Section 3 we sketch the main ideas for proving Theorem 1. The full proof is omitted due to space constraints and can be found in the preprint [10]. In Section 4 we present the proofs of Theorems 3–5, and we describe the construction of the SCDD1and of the SCDs in Q5 andQ7 referred to in Table 1. We conclude in Section 5 with some open problems.

2

Preliminaries

We begin by introducing some terminology that is used throughout the following sections.

2.1

Bitstrings and lattice paths

We useLn,k to denote the set of all bitstrings of lengthnwith Hamming weightk, so this is exactly thekth level ofQn. For any bitstringx, we writexfor its complement and rev(x) for the reversed bitstring. We often interpret a bitstringxas a path in the integer latticeZ2 starting at the origin (0,0), where every 1-bit is interpreted as an%-step that changes the current coordinate by (+1,+1) and every 0-bit is interpreted as a&-step that changes the current coordinate by (+1,−1); see Figure 4. Note that for any bitstringx, the inverted bitstring x corresponds to mirroring the lattice path horizontally, and the inverted and reversed bitstring rev(x) corresponds to mirroring the lattice path vertically.

2.2

Lexical matchings

(7)

0 1

3 2

5 4

8 7

10

6 9

12 11 x= 1110001001001001100001

x=Mn,k11,↓(y)

x

levelk= 9

n= 22

Mn,k11,Mn,k11,

2 1

0

3

5 7

10 8

12

11 9

6 4

y= 1110001001001001100101

y=Mn,k11,↑(x)

y

levelk+ 1 = 10

Figure 4Definition ofi-lexical matchings between levels 9 and 10 ofQ22, where steps flipped along the i-lexical matching edge are marked with i. Between those two levels, the vertexx is incident withi-lexical matching edges for each i∈ {0,1, . . . ,12}, and the vertexyis incident with

i-lexical matching edges for eachi∈ {0,1, . . . ,12} \ {4,6,9}.

to tackle the middle two levels problem. We first generalize them to then-cube for arbitraryn and an arbitrary pair of consecutive levelsk andk+ 1. Fori∈ {0,1, . . . , n−1}the i-lexical matching is defined as follows; see Figure 4. We interpret a bitstringxas a lattice path, and we letx↑ denote the lattice path that is obtained by appending&-steps toxuntil the resulting path ends at height−1. Ifxends at a height less than−1, thenx:=x. Similarly, we letx↓ denote the lattice path obtained by appending %-steps to xuntil the resulting path ends at height +1. Ifxends at a height more than +1, thenx↓:=x. We define the matching by two partial mappingsMn,ki,↑:Ln,kLn,k+1 and Mn,ki,↓:Ln,k+1→Ln,k defined as follows: For anyxLn,k we consider the lattice pathx↑ and scan it row-wise from top to bottom, and from right to left in each row. The partial mappingMn,ki,↑(x) is obtained by flipping theith&-step encountered in this fashion, where counting starts with 0,1, . . ., if this &-step is part ofx; otherwisexis left unmatched. Similarly, for anyxLn,k+1 we consider the lattice pathx↓ and scan it row-wise from top to bottom, and from left to right in each row. The partial mappingMn,ki,↓(x) is obtained by flipping the ith %-step encountered in this fashion if this%-step is part ofx; otherwisexis left unmatched. It is straightforward to verify that these two partial mappings are inverse to each other, so they indeed define a matching between levelskandk+ 1 ofQn, which we denote byMn,ki .

The following properties of lexical matchings are direct consequences of these definitions.

ILemma 6. Let0≤kn−1andl:= max{k, n−k−1}. The lexical matchings defined before have the following properties.

(i) For every0≤il, the matching Mi

n,k saturates all vertices in the smaller of the two levels kandk+ 1.

(ii) The matchingsMi

n,k, i= 0,1, . . . , l, form a partition of all edges of the subgraph ofQn between levelsk andk+ 1.

(iii) For every0≤il we have Mi n,k=M

li

n,nk−1 andrev(M i

n,k) =M li

(8)

C0

C1

C2

Figure 5Joining two cyclesC1 andC2 (black) from our cycle factor by taking the symmetric difference with a 6-cycleC0 (gray).

Property (i) holds as in the smaller of the two levelskandk+ 1, no steps are appended to the lattice paths when computing thei-lexical matching between those levels. Property (ii) holds as the vertices in the smaller of the two levelsk andk+ 1 have degreel+ 1 and the matchingsMn,ki ,i= 0,1, . . . , l, are all disjoint. Property (iii) follows from the observation that complementing a bitstring corresponds to mirroring the lattice path horizontally, and reverting a bitstring corresponds to mirroring the lattice path horizontally and vertically.

3

The middle four levels problem

In this section we outline the main steps for proving Theorem 1. The proof proceeds similarly as the proof of the middle two levels problem [12, 22]. In a first step, we construct a cycle factor in the middle four levels of the (2n+ 1)-cube, and in a second step we modify the cycles in the factor locally to join them to a Hamilton cycle. The cycle factor is constructed by taking the union of the following edge sets: alln-lexical and (n+ 1)-lexical matching edges between the upper two levelsn+ 1 andn+ 2 and between the lower two levelsn−1 andn, as well as certain carefully chosen edges from the (n−2)-lexical, the (n−1)-lexical, and then-lexical matching between the middle two levels nandn+ 1. The most technical step here is to choose an appropriate set of edges between the middle two levels, so that the resulting subgraph has degree two at every vertex. When this is accomplished, we define a set of 6-cycles between levels n+ 1 and n+ 2 such that any two of these 6-cycles are edge-disjoint and every such 6-cycleC0 intersects with two cyclesC1andC2 from our cycle factor as shown in Figure 5. Consequently, taking the symmetric difference of the edge sets ofC1,C2, andC0 results in a single cycle on the same vertex set asC1 andC2. We repeat this joining process until we end up with a single Hamilton cycle. In this process, we exploit that all of the 6-cycles used for the joining are edge-disjoint, and that on any cycle of the factor, no pairs of edges that two 6-cycles have in common with this cycle are interleaved, so there are never any conflicts between them. The main advantage of this two-step approach to proving Hamiltonicity is that it effectively reduces the problem of proving that a graph has a Hamilton cycle to the problem of proving that a suitably defined auxiliary graph is connected, which is much easier. All details of this proof can be found in [10].

4

Pairwise edge-disjoint SCDs

We proceed to prove Theorems 3–5.

4.1

Proof of Theorem 3

(9)

x= 1111101001001001100001 n 1 2 3 4 5 1 2 3 4 5

1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 1 1 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1

5 4 3 2 1 1 2 3 4 5 x=

C0(x)

x= 1111101001001001100001

n 1 2 3 5 4 1 2 3 4 5

1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1

5 4 3 2 1 1 2 3 4 5 x=

C1(x)

Figure 6 The labeling procedures that define the symmetric chains C0(x) (top) and C1(x) (bottom). The markers that define the upward and downward steps of the chains are drawn as a

square and a diamond, respectively. The chainC0(x) is the same as the one shown in Figure 2.

For evenn≥2, we consider a vertexxLn,n/2in the middle level n/2 ofQn, and we define the sequence of vertices reached from xwhen moving up the corresponding chain, and the sequence of vertices reached when moving down the chain. For this we consider the lattice path corresponding to the bitstringx. This lattice path ends at the coordinate (n,0) as the number of 0s equals the number of 1s. We now label a subsequence of&-steps of this lattice path with integersj= 1,2, . . .according to the following procedure; see the top part of Figure 6 for an illustration:

(a0) We place a marker at the rightmost highest point of xand set j:= 1.

(b0) If the marker is at height h≥1, we label the&-step starting at the marker withj, and we move the marker to the starting point of the rightmost &-step starting at heighth−1. We set j:=j+ 1 and repeat.

(c0) If the marker is at heighth= 0, we stop.

Flipping the&-steps ofxmarked with 1,2, . . .in this order yields the sequence of vertices reached fromxwhen moving up the chain containingx. An analogous labeling procedure obtained by interchanging left and right, &-steps and%-steps, and starting with ending points yields the sequence of vertices reached from xwhen moving down this chain. We denote this chain byC0(x). Observe thatC0(x) is a symmetric chain, as the height of the marker decreases by 1 in each step, so the number of edges we move up fromxequals the number of edges we move down from x. It is easy to verify that the SCDD0defined before via the parenthesis matching approach satisfiesD0=SxLn,n/2C0(x).

Proof of Theorem 3. We first define a setD1 of chains inQn for even values ofn≥2 via a labeling rule similar to the rule for D0 described before. From this definition it follows immediately that all chains inD1are symmetric. We then use an equivalent characterization ofD0andD1as the unions of certain lexical matchings to show that the chains inD1 form a partition of all vertices ofQn, proving thatD1 is an SCD, and thatD0,D0,D1, andD1 are pairwise edge-disjoint.

For evenn≥2, we consider a vertexxLn,n/2 in the middle level ofQn. We interpret it as a lattice path, and label some of its&-steps as follows; see the bottom part of Figure 6:

(10)

level 0 level 1 level 2 level 3 level 4 level 5 level 6

M0 M1 M2 M3 M0 M1 M2 M3 M0 M1 M2 M3 M0 M1 M2 M3 M0 M1 M2 M3 M0 M1 M2 M3

M4 M4 M4 M4

M5 M5

D0 D1 D1 D0

Figure 7 Unions of lexical matchingsMi=Mn,ki yielding edge-disjoint chain decompositions

inQnforn= 6. The resulting chains inD0 andD1 inQ6 are shown in Figure 3.

(b1) If the marker is at heighth≥2, we label the rightmost&-step starting at heighth−1 withj. We consider all &-steps starting at heighth−2 to the right of the labeled step and the&-step starting at the marker, we label the second step from the right from this set withj+ 1, and we move the marker to the starting point of the rightmost &-step starting at heighth−2. We set j:=j+ 2 and repeat.

(c1) If the marker is at heighth= 1 orh= 0, we stop.

We letC1(x) denote the chain obtained by flipping bits according to this labeling rule and the corresponding symmetric rule obtained by interchanging left and right,&-steps and %-steps, and starting with ending points. Observe thatC1(x) is a symmetric chain, as the height of the marker decreases by 2 in each iteration (and we label two steps in each iteration) and the conditional marking in step (a1) occurs if and only if the highest point ofxis unique, so the number of edges we move up fromxequals the number of edges we move down fromx. At this point it is not clear yet that the chainsC1(x),xLn,n/2, are disjoint, nor that they cover all vertices ofQn. This is what we will argue about next, which will prove that

D1:=

[

xLn,n/2

C1(x) (1)

is actually an SCD ofQn.

By property (i) from Lemma 6, for any sequence i := (i0, i1, . . . , in−1) of indices ik∈ {0,1, . . . ,max{k, n−k−1}}the union

Di:=

[n−1

k=0M ik

n,k (2)

is a chain decomposition ofQn. The resulting chains are not necessarily symmetric, though. From the definitions in Section 2.2 it also follows thatD0 equals the union of the 0-lexical matchings, and that for evenn≥2,D1 as defined in (1) equals the union of the 1-lexical matchings; formally we have

D0=D(0,0,...,0)=

[n−1

k=0M 0

n,k , D1=D(1,1,...,1)=

[n−1

k=0M 1 n,k .

Consequently,D1is indeed a chain decomposition, and by the definition ofD1via the labeling procedure, all chains in this decomposition are symmetric, soD1is indeed an SCD. The fact thatD0, D0,D1, andD1 are pairwise edge-disjoint can be seen by applying property (iii) from Lemma 6 and by observing that by property (ii), Di and Dj as defined in (2) are

(11)

Qa Qb Qa+b=Qa×Qb A

A1 A2

B

B1 B2

A×B C

1

C1

(x1, y1)

(x1, yβ) (xα, yβ)

Figure 8Illustration of the proof of Theorem 5. Construction of two edge-disjoint SCDs inQ5 from two edge-disjoint SCDs inQ2 and two edge-disjoint SCDs inQ3. The chains of the SCDC1 ofQ5 as constructed in the proof are highlighted in gray.

Clearly,D(0,0,...,0)as defined in (2) equalsD0forevery n≥1, so the union of all 0-lexical matchings forms an SCD in any dimension. In contrast to that, the union of all 1-lexical matchingsD(1,1,...,1)only forms an SCD foreven n≥2.

4.2

Proof of Theorem 5

Proof of Theorem 5. For the reader’s convenience, this proof is illustrated in Figure 8. LetA1,A2, . . . ,Ak andB1,B2, . . . ,Bk denotekpairwise edge-disjoint SCDs ofQa andQb, respectively. We will think ofQa+b as the Cartesian productQa×Qb of Qa andQb. We show how to construct for everyi∈[k] an SCDCi ofQa+b=Qa×Qb which uses only edges of the form ((u, v),(u0, v0)) where (u, u0) is an edge from Ai or (v, v0) is an edge fromBi. From this it follows that the SCDsC1,C2, . . . ,Ck are pairwise edge-disjoint.

The SCDCiofQa+bis defined as follows: The Cartesian productsA×Bof chainsA∈ Ai and B ∈ Bi partition the vertices of Qa+b into two-dimensional grids. Ci is obtained by partitioning each of those grids into symmetric chains in the natural way; see Figure 8 (cf. [4]): Specifically, letA=: (x1, . . . , xα) andB=: (y1, . . . , yβ) be the vertices in the chainsAandB from bottom to top. As A and B are symmetric, we know that |x1|+|xα| = a and |y1|+|yβ|=b, where|x|denotes the Hamming weight of the bitstringx. This implies that |(x1, y1)|+|(xα, yβ)|=|x1|+|y1|+|xα|+|yβ|=a+b, i.e., the bottom and top vertex of the gridA×B are on symmetric levels inQa+b. We may therefore decomposeA×B into disjoint symmetric chainsCj,j = 1,2, . . . ,min{α, β}, by setting

Cj := (x1, yj),(x2, yj), . . . ,(j+1, yj),(j+1, yj+1), . . . ,(j+1, yβ) . J

4.3

Proof of Theorem 4

We begin by constructing the SCDs inQ5 andQ7mentioned in Table 1.

I Lemma 7. Q5 contains three pairwise edge-disjoint SCDs, Q7 contains four pairwise edge-disjoint SCDs, and this is best possible.

(12)

N

5

10000 11000 11100

11110

10100 10110

N

7

1110000 1011000 1101000

1010100 1001100

1111000 1011100 1101100 1001110 1010110

1111100 1011110 1101110

1100000 1010000 1001000

1000000 1111110

X

5

Y

5

Z

5

X

7

X

7

Y

7

Y

7

(a)

Z

5

(b)

Figure 9 Illustration of the three edge-disjoint SCDs inN5 (a) and four edge-disjoint SCDs inN7 (b). The names of the SCDs correspond to the ones used in Table 1.

The resulting graph Nn is a multigraph version of the cover graph of thenecklace poset. Specifically, the multiplicity of the edges inNn corresponds to the number of ways a bit from a necklace can be flipped to reach the corresponding adjacent necklace. E.g., inN5 the necklace x:= 10000 has two edges leading to y := 11000, as we can flip the second or the fifth bit inxto reachy. This way, a necklace on level khas nk edges going up, andkedges going down, like the vertices inQn. The multigraphsN5 andN7 are shown in Figure 9. Ifnis prime, then every SCD inNn corresponds to an SCD inQn, by turning each chain fromNn intonchains inQn obtained by rotating a representative of each necklace in all possible ways. Moreover, one of the chains of lengthn−2 needs to be extended by the all-zero and all-one bitstring to a chain of lengthninQn. Observe that in this way, k edge-disjoint SCDs inNn give rise tok edge-disjoint SCDs inQn.

Asn= 5 andn= 7 are prime, we thus obtain three edge-disjoint SCDs inQ5 from the SCDs inN5shown in Figure 9 (a), and four edge-disjoint SCDs in Q7 from the SCDs inN7 shown in Figure 9 (b). These SCDs use up all middle edges, so this is best possible. J

Proof of Theorem 4. For n = 7 the statement follows from Lemma 7. For odd n ≥ 13 we apply Theorem 5 to Qn−7 andQ7, using the four edge-disjoint SCDs in Qn−7 given by Theorem 3 (note that n−7 ≥ 6), and the four edge-disjoint SCDs in Q7 given by

Lemma 7. J

5

Open problems

Understanding the structure of the cycle factors constructed as in the proof of Theorem 2 is an important step towards a general solution of Problem M. We performed some computer experiments in this direction; see [10]. What is the number and length of cycles in these factors? Is there a combinatorial interpretation of those numbers?

Are there other explicit constructions of SCDs in then-cube, different fromD0,D1, and their complements?

(13)

References

1 M. Aigner. Lexicographic matching in Boolean algebras.J. Combin. Theory Ser. B, 14:187– 194, 1973.

2 B. Bollobás.Combinatorics: set systems, hypergraphs, families of vectors and combinatorial probability. Cambridge University Press, Cambridge, 1986.

3 B. Bultena and F. Ruskey. Transition restricted Gray codes.Electron. J. Combin., 3(1):Pa-per 11, 11 pp., 1996. URL: http://www.combinatorics.org/Volume_3/Abstracts/ v3i1r11.html.

4 N. de Bruijn, C. van Ebbenhorst Tengbergen, and D. Kruyswijk. On the set of divisors of a number. Nieuw Arch. Wiskunde (2), 23:191–193, 1951.

5 D. Dimitrov, T. Dvořák, P. Gregor, and R. Škrekovski. Linear time construction of a compressed Gray code. European J. Combin., 34(1):69–81, 2013. doi:10.1016/j.ejc. 2012.07.015.

6 M. El-Hashash and A. Hassan. On the Hamiltonicity of two subgraphs of the hypercube. In Proceedings of the Thirty-second Southeastern International Conference on Combinatorics, Graph Theory and Computing (Baton Rouge, LA, 2001), volume 148, pages 7–32, 2001.

7 L. Goddyn and P. Gvozdjak. Binary Gray codes with long bit runs. Electron. J. Com-bin., 10:Paper 27, 10 pp., 2003. URL: http://www.combinatorics.org/Volume_10/ Abstracts/v10i1r27.html.

8 F. Gray. Pulse code communication, 1953. March 17, 1953 (filed Nov. 1947). U.S. Patent 2,632,058.

9 C. Greene and D. J. Kleitman. Strong versions of Sperner’s theorem. J. Combin. Theory Ser. A, 20(1):80–88, 1976.

10 P. Gregor, S. Jäger, T. Mütze, J. Sawada, and K. Wille. Gray codes and symmetric chains. arXiv:1802.06021. Preprint version of the present article, 2018.

11 P. Gregor and T. Mütze. Trimming and gluing Gray codes. Theoret. Comput. Sci., 714:74– 95, 2018. doi:10.1016/j.tcs.2017.12.003.

12 P. Gregor, T. Mütze, and J. Nummenpalo. A short proof of the middle levels theorem. To appear inDiscrete Analysis.arXiv:1710.08249, 2018.

13 P. Gregor and R. Škrekovski. On generalized middle-level problem. Inform. Sci., 180(12):2448–2457, 2010. doi:10.1016/j.ins.2010.02.009.

14 J. Griggs, C. E. Killian, and C. D. Savage. Venn diagrams and symmetric chain decom-positions in the Boolean lattice. Electron. J. Combin., 11(1):Paper 2, 30 pp., 2004. URL: http://www.combinatorics.org/Volume_11/Abstracts/v11i1r2.html.

15 A. E. Holroyd. Perfect snake-in-the-box codes for rank modulation. IEEE Trans. Inform. Theory, 63(1):104–110, 2017. doi:10.1109/TIT.2016.2620160.

16 A. E. Holroyd, F. Ruskey, and A. Williams. Shorthand universal cycles for permutations. Algorithmica, 64(2):215–245, 2012. doi:10.1007/s00453-011-9544-z.

17 J. R. Johnson. Universal cycles for permutations.Discrete Math., 309(17):5264–5270, 2009. doi:10.1016/j.disc.2007.11.004.

18 J. R. Johnson. An inductive construction for Hamilton cycles in Kneser graphs. Electron. J. Combin., 18(1):Paper 189, 12 pp., 2011.

19 H. A. Kierstead and W. T. Trotter. Explicit matchings in the middle levels of the Boolean lattice. Order, 5(2):163–171, 1988. doi:10.1007/BF00337621.

20 D. E. Knuth. The Art of Computer Programming. Vol. 4A. Combinatorial Algorithms. Part 1. Addison-Wesley, Upper Saddle River, NJ, 2011.

21 S. Locke and R. Stong. Problem 10892: Spanning cycles in hypercubes. Amer. Math. Monthly, 110:440–441, 2003.

(14)

23 T. Mütze and J. Nummenpalo. A constant-time algorithm for middle levels Gray codes. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2238–2253. SIAM, Philadelphia, PA, 2017. doi:10.1137/1.9781611974782.147.

24 T. Mütze, J. Nummenpalo, and B. Walczak. Sparse Kneser graphs are Hamiltonian. To appear inProceedings of the 50th Annual ACM Symposium on the Theory of Computing (STOC 2018).arXiv:1711.01636, 2018.

25 O. Pikhurko. On edge decompositions of posets. Order, 16(3):231–244 (2000), 1999. doi: 10.1023/A:1006419611661.

26 F. Ruskey, C. D. Savage, and S. Wagon. The search for simple symmetric Venn diagrams. Notices Amer. Math. Soc., 53(11):1304–1312, 2006.

27 C. D. Savage. Long cycles in the middle two levels of the Boolean lattice. Ars Combin., 35(A):97–108, 1993.

28 C. D. Savage. A survey of combinatorial Gray codes. SIAM Rev., 39(4):605–629, 1997. doi:10.1137/S0036144595295272.

29 C. D. Savage and P. Winkler. Monotone Gray codes and the middle levels problem. J. Combin. Theory Ser. A, 70(2):230–248, 1995. doi:10.1016/0097-3165(95)90091-8.

30 J. Sawada and A. Williams. A Hamilton path for the sigma-tau problem. In Pro-ceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 568–575, 2018. doi: 10.1137/1.9781611975031.37.

31 J. Shearer and D. J. Kleitman. Probabilities of independent choices being ordered. Stud. Appl. Math., 60(3):271–276, 1979. doi:10.1002/sapm1979603271.

32 H. Spink. Orthogonal symmetric chain decompositions of hypercubes. arXiv:1706.08545, June 2017.

33 N. Streib and W. T. Trotter. Hamiltonian cycles and symmetric chains in Boolean lattices. Graphs Combin., 30(6):1565–1586, 2014. doi:10.1007/s00373-013-1350-8.

34 I. N. Suparta and A. J. van Zanten. A construction of Gray codes inducing complete graphs. Discrete Math., 308(18):4124–4132, 2008. doi:10.1016/j.disc.2007.07.116.

35 G. C. Tootill. The use of cyclic permuted codes in relay counting circuits.Proceedings IEE, Part B Supplement, 103, 1956.

References

Related documents

18 Francee Anderson, Sylvia Bremer and Dorothy Cumming received their training, and their start in their profession, at Sydney’s three major schools of elocution, Lawrence Campbell’s

MetroFibre targets customers that value the long-term nature of fibre access infrastructure, such as real-estate companies or local authorities, as well as customers that

In addition, the findings further reveal that none of the studies investigate the mediating effect of the nature of innovation (incremental and radical) on the relationship

innovation in payment systems, in particular the infrastructure used to operate payment systems, in the interests of service-users 3.. to ensure that payment systems

Prereq or concur: Honors standing, and English 1110 or equiv, and course work in History at the 3000 level, or permission of instructor.. Repeatable to a maximum of 6

Calculate viscosity (dynamic or absolute, and kinematic) and determine how this property varies with changes in temperature for a constant-composition multi-component

Effective immediately, the first paragraph in the section of each Fund’s summary prospectuses entitled “Management” and prospectuses entitled

Class K Shares of the Fund are available only to (i) employer-sponsored retirement plans (not including SEP IRAs, SIMPLE IRAs and SARSEPs) (“Employer-Sponsored Retirement Plans”),