Download presentation
Presentation is loading. Please wait.
1
Trimming and gluing Gray codes
Torsten Mütze joint work with Petr Gregor (Charles University Prague)
2
Combinatorial Gray codes
Goal: Generate all objects in a combinatorial class (permutations, subsets, strings, trees, Dyck paths, etc.) such that consecutive objects differ only ‚a little bit‘ Ideally: Generate each new object in time Fundamental task in combinatorial algorithms [Nijenhuis, Wilf 75] [Knuth TAOCP Vol. 4A, 11]
3
Two classical Gray code problems
Problem 1: cyclically generate all subsets of by element additions/removals Example: 000 100 110 010 011 111 101 001 {} {1} {1,2} {2} {2,3} {1,2,3} {1,3} {3} this is achieved by the Gray binary code [Gray 53] there is a simple loopless algorithm to compute it (running time O(1) per generated bitstring) [Ehrlich 73], [Bitner, Ehrlich, Reingold 76]
4
Two classical Gray code problems
Problem 2: cyclically generate all subsets of of by element exchanges Example: this can be done by a simple loopless algorithm [Tang, Liu 73], [Ehrlich 73], [Bitner, Ehrlich, Reingold 76] {1,2} {2,3} {1,3} {3,4} {2,4} {1,4} 1100 0110 1010 0011 0101 1001 one may even impose further restrictions on the allowed exchanges [Eades, Hickey, Read 84], [Eades, McKay 84], [Ruskey 88], [Chase 89], [Jenkyns, McCarthy 95], [Ruskey, Williams 09]
5
A vast generalization Problem: For a given interval , generate all subsets whose size is in this interval by element additions/removals/exchanges Special cases: and : Problem 1 : Problem 2 0000 1000 0100 0010 1010 0110 1100 1110 1001 0101 0011 1011 0111 0001 1101 1111 The cube level
6
A vast generalization Problem: For a given interval , generate all subsets whose size is in this interval by element additions/removals/exchanges Equivalently, does have a Hamilton cycle? Note that partition classes of this graph have the same size only if is odd and Two more general notions: Saturating cycle := all vertices in the smaller partition class are visited Tight enumeration := only distance-2 steps in the bigger partition class
7
A vast generalization Problem: For a given interval , generate all subsets whose size is in this interval by element additions/removals/exchanges Q1: For which does have a saturating cycle? Q2: For which does have a tight enumeration? Two weaker notions: Saturating cycle := all vertices in the smaller partition class are visited Tight enumeration := only distance-2 steps in the bigger partition class
8
Hard special cases 11...1 `middle levels conjecture (MLC)‘ [Havel 83], [Buck, Wiedemann 84] Theorem ([M. 16 PLMS]): For any , the graph has a Hamilton cycle. Conjecture ([Gregor, Škrekovski 10]): For any and , the graph has a Hamilton cycle. 00...0 Known cases of the `generalized middle levels conjecture (GMLC)‘ [M. 16] [Gray 53] [El-Hashash, Hassan 01], [Locke, Stong 03] [Gregor, Škrekovski 10] ?
9
Our results in a nutshell
Q1: For which does have a saturating cycle? Q2: For which does have a tight enumeration? We answer these questions positively for a large range of parameters We provide corresponding constant-time generation algorithms. All remaining open cases are reduced to the GMLC.
10
Our results - saturating cycles
Theorem 1: , , has a saturating cycle in the following cases: [Gray 53] [El-Hashash, Hassan 01], [Locke, Stong 03] [Gregor, Škrekovski 10] [M. 16] open [M., Su 16] 1 1 1 1
11
Our results - tight enumerations
Theorem 2: , , has a tight enumeration in the follow. cases: [Gray 53] [El-Hashash, Hassan 01], [Locke, Stong 03] [Gregor, Škrekovski 10] [M. 16] open [Tang, Liu 73] 2 2 2 2 2
12
Our results – efficient algorithms
Theorem 3: (a) For cases (i) and (ii) in Theorem 1+2, there is an algorithm with running time O(1) in the worst case per generated vertex (i.e., a loopless algorithm). (b) For case (iii) in Theorem 1+2, there is an algorithm with running time O(1) on average per generated vertex. Remarks The algorithms for part (a) are considerably simpler (1 page) than those for part (b) (in (b) we use the rather complex MLC algorithm presented in [M., Nummenpalo SODA 17]) Initialization time is O(n) and required space is O(n) C++ code available on our website
13
Our results Theorem 4 (approximate version of `generalized middle levels conjecture‘): For any and , the graph has an `almost‘ Hamilton cycle, i.e., a cycle that visits a fraction of all vertices.
14
Trimming Gray codes Recall the standard binary Gray code:
Lemma ([Tang, Liu 73]): For any two consecutive vertices in , we have := subsequence of consisting of all vertices on level
15
Trimming Gray codes (tight enumerations)
Corollary: If is even or or , then taking shortcuts (distance-2 steps) at levels and/or yields a tight enumeration. Lemma ([Tang, Liu 73]): For any two consecutive vertices in , we have
16
Trimming Gray codes (tight enumerations)
Lemma ([Tang, Liu 73]): For any two consecutive vertices in , we have Corollary: If is even or or , then taking shortcuts (distance-2 steps) at levels and/or yields a tight enumeration. [Gray 53] [El-Hashash, Hassan 01], [Locke, Stong 03] [Gregor, Škrekovski 10] [M. 16] open [Tang, Liu 73] 2 2 2 2 2
17
Trimming Gray codes (saturating cycles)
Lemma ([Tang, Liu 73]): For any two consecutive vertices in , we have
18
Trimming Gray codes (saturating cycles)
Lemma ([Tang, Liu 73]): For any two consecutive vertices in , we have upward/downward vertices sequence of up-/down-neighbors of for all upward/downward vertices
19
Trimming Gray codes (saturating cycles)
Lemma: All vertices in and are distinct.
20
Trimming Gray codes (saturating cycles)
Theorem: For any interval with , the graph has a cycle that visits all vertices except possibly some vertices in levels and . Proof: Trim
21
Trimming Gray codes (saturating cycles)
Corollary: If is even or or , then the omitted vertices are from the same partition class (i.e., all vertices from the other partition class are visited), yielding a saturating cycle.
22
Trimming Gray codes (saturating cycles)
Corollary: If is even or or , then the omitted vertices are from the same partition class (i.e., all vertices from the other partition class are visited), yielding a saturating cycle. [Gray 53] [El-Hashash, Hassan 01], [Locke, Stong 03] [Gregor, Škrekovski 10] [M. 16] open [M., Su 16] 1 1 1 1
23
Gluing Gray codes (saturating cycles)
omitted vertices [Gray 53] [El-Hashash, Hassan 01], [Locke, Stong 03] [Gregor, Škrekovski 10] [M. 16] open [M., Su 16] 1 1 1 1
24
Efficient algorithms Trimming simple loopless algorithms with running time O(1) in the worst case per generated vertex (simple bitflip rules) Gluing rather complex algorithms with running time O(1) on average per generated vertex (base case is the MLC algorithm presented in [M., Nummenpalo SODA 17])
25
Open problems Conjecture ([Gregor, Škrekovski 10]): For any and , the graph has a Hamilton cycle.
26
The entire -parameter space
27
Thank you!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.