prefix reversal gray codes
play

Prefix-reversal Gray codes Alexey Medvedev Sobolev Institute of - PowerPoint PPT Presentation

Prefix-reversal Gray codes Alexey Medvedev Sobolev Institute of Mathematics, Novosibirsk, Russia joint work with Elena Konstantinova, Sobolev Institute of Mathematics Symmetries of Graphs and Networks IV Rogla, Slovenia, June 29July 5, 2014


  1. Prefix-reversal Gray codes Alexey Medvedev Sobolev Institute of Mathematics, Novosibirsk, Russia joint work with Elena Konstantinova, Sobolev Institute of Mathematics Symmetries of Graphs and Networks IV Rogla, Slovenia, June 29–July 5, 2014 Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 1 / 20

  2. Gray codes Combinatorial Gray codes [J. Joichi et al., (1980)] A combinatorial Gray code is now referred as a method of generating combinatorial objects so that successive objects differ in some pre-specified, usually small, way. [D.E. Knuth, The Art of Computer Programming, Vol.4 (2010)] Knuth recently surveyed combinatorial generation: Gray codes are related to efficient algorithms for exhaustively generating combinatorial objects. (tuples, permutations, combinations, partitions, trees) Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 2 / 20

  3. Examples Hamming cube H n [F. Gray, (1953), U.S. Patent 2,632,058] The first Gray code was introduced relative to binary strings n = 2 : 00 01 | 11 10 n = 3 : 000 001 011 010 | 110 111 101 100 110 111 10 11 010 011 100 101 00 01 000 001 H 3 H 2 1110 1111 Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 3 / 20

  4. Examples Symmetric group Sym n [R. Eggleton, W. Wallis, (1985); D. Rall, P. Slater, (1987)] The group of permutations: Q: Is it possible to list all permutations in a list so that each one differs from its predecessor in every position? A: YES! [1234] [3124] [2314] [4123] [4312] [4231] [2341] [1243] [3142] [3412] [2431] [1423] [1324] [3214] [2134] [4132] [4321] [4213] [3241] [2143] [1342] [2413] [1432] [3421] Generating permutations in Sym 4 Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 4 / 20

  5. Gray codes: generating permutations [S. Zaks, (1984)] Zaks’ algorithm: each successive permutation is generated by reversing a suffix of the preceding permutation. Describe in terms of prefixes: Start with I n = [12 . . . n ] ; Let ζ n be the sequence of sizes of these prefixes defined by recursively as follows: ζ 2 = 2 ζ n = ( ζ n − 1 n ) n − 1 ζ n − 1 , n > 2 , where a sequence is written as a concatenation of its elements; Flip prefixes according to the sequence. Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 5 / 20

  6. Zaks’ algorithm: examples If n = 2 then ζ 2 = 2 and we have: [12] [21] If n = 3 then ζ 3 = 23232 and we have: [123] [312] [231] [213] [132] [321] If n = 4 then ζ 4 = 23232423232423232423232 and we have: [1234] [4123] [3412] [2341] [2134] [1423] [4312] [3241] [3124] [2413] [1342] [4231] [1324] [4213] [3142] [2431] [2314] [1243] [4132] [3421] [3214] [2143] [1432] [4321] Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 6 / 20

  7. Greedy Gray code: generating permutations [A. Williams, J. Sawada, (2013)] Describe in terms of prefixes: Start with I n = [12 . . . n ] ; Take the largest size prefix we can flip not repeating a created permutation; Flip this prefix. Example: for n = 4 then we have [1234] [4321] [2341] [1432] [3412] [2143] [4123] [3214] [2314] [4132] [3142] [2413] [1423] [3241] [4231] [1324] [3124] [4213] [1243] [3421] [2431] [1342] [4312] [2134] Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 7 / 20

  8. Prefix–reversal Gray codes: generating permutations Each ’flip’ is formally known as prefix–reversal. The Pancake graph P n is the Cayley graph on the symmetric group Sym n with generating set { r i ∈ Sym n , 1 � i < n } , where r i is the operation of reversing the order of any substring [1 , i ] , 1 < i � n, of a permutation π when multiplied on the right, i.e., [ π 1 . . . π i π i +1 . . . π n ] r i = [ π i . . . π 1 π i +1 . . . π n ] . Cycles in P n [A. Kanevsky, C. Feng, (1995); J.J. Sheu, J.J.M. Tan, K.T. Chu, (2006)] All cycles of length ℓ , where 6 � ℓ � n ! , can be embedded in the Pancake graph P n , n � 3 , but there are no cycles of length 3 , 4 or 5 . Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 8 / 20

  9. Pancake graphs: hierarchical structure P n consists of n copies of P n − 1 ( i ) = ( V i , E i ) , 1 � i � n , where the vertex set V i is presented by permutations with the fixed last element. P 1 P 4 [1] [1234] [4321] r 4 r 2 r 3 r 3 r 2 P 2 [3214] [2341] [2134] [3421] r 2 r 2 r 2 r 3 r 3 [12] [21] [3124] [2431] [2314] [3241] r 2 r 3 r 2 r 3 r 4 P 3 [1324] [4231] r 4 r 4 r 4 r 4 [3142] [2413] [123] r 4 r 4 r 4 r 3 r 2 r 2 r 2 r 3 r 3 [4132] [1423] [321] [213] [1342] [4213] r 3 r 3 r 2 r 2 r 2 r 3 [1243] [4312] [1432] [4123] [231] [312] r 2 r 2 r 3 r 3 r 3 r 2 r 4 [3412] [2143] [132] Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 9 / 20

  10. � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � Two scenarios of generating permutations: Zaks | Williams Both algorithms are based on independent cycles in P n . Zaks’ prefix–reversal Gray code: Williams’ prefix–reversal Gray code: ( r 2 r 3 ) 3 – flip the minimum number ( r n r n − 1 ) n – flip the maximum of topmost pancakes that gives a number of topmost pancakes that new stack. gives a new stack. r 4 r 2 r 4 r 3 r 2 r 3 r 4 r 4 r 4 r 3 r 3 r 3 r 2 r 2 r 3 r 2 r 3 r 3 r 4 r 4 r 2 r 2 r 4 r 4 r 4 r 4 r 3 r 3 r 2 r 2 r 2 r 2 r 4 r 4 r 4 r 3 r 3 r 2 r 2 r 3 r 3 r 4 r 4 r 3 r 3 r 2 r 2 r 3 (a) Zaks’ code in P 4 (b) Williams’ code in P 4 Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 10 / 20

  11. Independent cycles in P n Theorem 1. (K., M.) The Pancake graph P n , n � 4 , contains the maximal set of n ! ℓ independent ℓ –cycles of the canonical form C ℓ = ( r n r m ) k , (1) where ℓ = 2 k , 2 � m � n − 1 and m � ⌊ n  O (1) if 2 ⌋ ;  m > ⌊ n k = O ( n ) if 2 ⌋ and n ≡ 0 (mod n − m ) ; (2) O ( n 2 ) else .  Corollary The cycles presented in Theorem 1 have no chords. Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 11 / 20

  12. Hamilton cycles based on small independent even cycles Hamilton cycle or path in P n ⇒ PRGC Definition The Hamilton cycle H n based on independent ℓ –cycles is called a Hamilton cycle in P n , consisting of paths of lengths l = ℓ − 1 of independent cycles, connected together with external to these cycles edges. Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 12 / 20

  13. � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � Hamilton cycles based on small independent even cycles Definition The complementary cycle H ′ n to the Hamilton cycle H n based on independent cycles is defined on unused edges of H n and the same external edges. H ′ H 4 4 (c) Hamilton cycle H 4 in P 4 (d) Complementary cycle H ′ 4 in P 4 Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 13 / 20

  14. Non-existence of Hamilton cycles n has form ( r m r j ) t , where Suppose the complementary cycle H ′ m ∈ { 2 , . . . , n } , r j ∈ PR \{ r m } . Theorem 2. (K., M.) The only Hamilton cycles H n based on independent cycles from Theorem 1 n of form ( r m r j ) t , where m ∈ { 2 , . . . , n } , with the complementary cycle H ′ are Zaks’, Greedy and Hamilton cycle based on ( r 4 r 2 ) 4 in P 4 . n = ( r m r j ) t ⇒ H ′ Proof. H ′ n has form from Theorem 1. Thus, the following inequality should hold n ! 2 � L max , (3) L max where L max is the maximal length of cycles from Theorem 1. Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 14 / 20

  15. Non-existence of Hamilton cycles The length L max can be estimated as L max � n ( n + 2) , and therefore 2 n ! � L 2 max , n ! � 1 2 n 2 ( n + 2) 2 . The inequality does not hold starting from n = 7 . For n from 4 to 6 it is easy to verify using the exact lengths that inequality holds only for n = 4 . ✷ Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 15 / 20

  16. Non-existence of Hamilton cycles n = ( r m r ξ ) t , where by Suppose the complementary cycle H ′ n has form H ′ r ξ we mean that every second reversal may be different from previous. Another way of thinking of it is to treat r ξ as a random variable taking values in PR \{ r n , r m } with some distribution. Theorem 3. (K., M.) The only Hamilton cycles H n based on independent cycles from n of form ( r m r ξ ) t , where Theorem 1 with the complementary cycle H ′ m � = { n, n − 2 } and r ξ ∈ PR \{ r n , r m } is Greedy Hamilton cycle in P n . Proof is based on structural properties of the graph, hierarchical structure and length’s argument above. Remark. Existence in the case m = n − 2 is only unresolved when ℓ = O ( n ) . Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 16 / 20

  17. Hamilton cycles based on small independent even cycles Open problem n = ( r η r ξ ) t , where Suppose the complementary cycle H ′ n has form H ′ r η ∈ { r n , r m } and r ξ ∈ PR \{ r n , r m } . Alexey Medvedev (Sobolev I.Math) Prefix-reversal Gray codes Rogla–2014 17 / 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend