combinatorial generation via permutation languages
play

Combinatorial generation via permutation languages Torsten Mtze - PowerPoint PPT Presentation

Combinatorial generation via permutation languages Torsten Mtze (joint work with Liz Hartung, Hung P. Hoang, and Aaron Williams) Introduction In computer science, we frequently encounter different kinds of combinatorial objects Examples:


  1. Combinatorial generation via permutation languages Torsten Mütze (joint work with Liz Hartung, Hung P. Hoang, and Aaron Williams)

  2. Introduction • In computer science, we frequently encounter different kinds of combinatorial objects • Examples: 1234 • permutations 1243 • binary strings 1423 • binary trees • graphs • spanning trees • …

  3. Introduction • In computer science, we frequently encounter different kinds of combinatorial objects • Examples: 000 1234 • permutations 001 1243 • binary strings 011 1423 • binary trees • graphs • spanning trees • …

  4. Introduction • In computer science, we frequently encounter different kinds of combinatorial objects • Examples: 000 1234 • permutations 001 1243 • binary strings 011 1423 • binary trees • graphs • spanning trees • …

  5. Introduction • In computer science, we frequently encounter different kinds of combinatorial objects • Examples: 000 1234 • permutations 001 1243 • binary strings 011 1423 • binary trees • graphs • spanning trees • …

  6. Introduction • In computer science, we frequently encounter different kinds of combinatorial objects • Examples: 000 1234 • permutations 001 1243 • binary strings 011 1423 • binary trees • graphs • spanning trees • …

  7. Introduction • In computer science, we frequently encounter different kinds of combinatorial objects • Examples: 000 1234 • permutations 001 1243 • binary strings 011 1423 • binary trees • graphs • spanning trees • … • Common tasks: counting + random sampling + exhaustive generation

  8. Exhaustive generation • Goal: generate all objects of a combinatorial class efficiently [Knuth, The Art of Computer Programming Vol. 4A] • ultimately: each new object in constant time • consecutive objects differ only by `small changes‘ � Gray code

  9. Exhaustive generation • Goal: generate all objects of a combinatorial class efficiently [Knuth, The Art of Computer Programming Vol. 4A] • ultimately: each new object in constant time • consecutive objects differ only by `small changes‘ � Gray code • Examples: • binary trees by rotations [Lucas, van Baronaigien, Ruskey 93]

  10. Exhaustive generation • Goal: generate all objects of a combinatorial class efficiently [Knuth, The Art of Computer Programming Vol. 4A] • ultimately: each new object in constant time • consecutive objects differ only by `small changes‘ � Gray code • Examples: • binary trees by rotations [Lucas, van Baronaigien, Ruskey 93] • permutations by adjacent transpositions (Steinhaus ‐ Johnson ‐ Trotter algorithm [Johnson 63], [Trotter 62] )

  11. Exhaustive generation • Goal: generate all objects of a combinatorial class efficiently [Knuth, The Art of Computer Programming Vol. 4A] • ultimately: each new object in constant time • consecutive objects differ only by `small changes‘ � Gray code • Examples: • binary trees by rotations [Lucas, van Baronaigien, Ruskey 93] • permutations by adjacent transpositions (Steinhaus ‐ Johnson ‐ Trotter algorithm [Johnson 63], [Trotter 62] ) • binary strings by bitflips (binary reflected Gray code [Gray 53] )

  12. Exhaustive generation • Goal: generate all objects of a combinatorial class efficiently [Knuth, The Art of Computer Programming Vol. 4A] • ultimately: each new object in constant time • consecutive objects differ only by `small changes‘ � Gray code • Examples: • binary trees by rotations [Lucas, van Baronaigien, Ruskey 93] • permutations by adjacent transpositions (Steinhaus ‐ Johnson ‐ Trotter algorithm [Johnson 63], [Trotter 62] ) • binary strings by bitflips (binary reflected Gray code [Gray 53] ) • set partitions by element exchanges [Kaye 76]

  13. Exhaustive generation • many tailormade algorithms, few general approaches [Avis, Fukuda 92], [Li, Sawada 09], [Ruskey, Sawada, Williams 12]

  14. Exhaustive generation • many tailormade algorithms, few general approaches [Avis, Fukuda 92], [Li, Sawada 09], [Ruskey, Sawada, Williams 12] • This work: A general framework for exhaustive generation

  15. Exhaustive generation • many tailormade algorithms, few general approaches [Avis, Fukuda 92], [Li, Sawada 09], [Ruskey, Sawada, Williams 12] • This work: A general framework for exhaustive generation • Results: all aforementioned algorithms as special cases + many new results for other families of objects

  16. Exhaustive generation • many tailormade algorithms, few general approaches [Avis, Fukuda 92], [Li, Sawada 09], [Ruskey, Sawada, Williams 12] • This work: A general framework for exhaustive generation • Results: all aforementioned algorithms as special cases + many new results for other families of objects • Idea: Encode objects as a subset of permutations of length

  17. Jumps • Jump := move an entry in the permutation across some neighboring smaller entries (right or left) 4 5 1 3 2 6 4 1 3 2 5 6

  18. Jumps • Jump := move an entry in the permutation across some neighboring smaller entries (right or left) 4 5 1 3 2 6 4 1 3 2 5 6

  19. Jumps • Jump := move an entry in the permutation across some neighboring smaller entries (right or left) 4 5 1 3 2 6 4 1 3 2 5 6

  20. Jumps • Jump := move an entry in the permutation across some neighboring smaller entries (right or left) 4 5 1 3 2 6 4 1 3 2 5 6 right jump

  21. Jumps • Jump := move an entry in the permutation across some neighboring smaller entries (right or left) 4 5 1 3 2 6 4 1 3 2 5 6 left jump

  22. Jumps • Jump := move an entry in the permutation across some neighboring smaller entries (right or left) 4 5 1 3 2 6 4 1 3 2 5 6

  23. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from

  24. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created.

  25. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created. • Example: {1243,1423,4123,4213,2134}

  26. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created. • Example: {1243,1423,4123,4213,2134} minimal jumps 1243 4213

  27. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created. • Example: {1243,1423,4123,4213,2134} minimal jumps 1243 not minimal 1243 4213

  28. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created. Stop, if no jump is possible or jump direction is ambiguous. • Example: {1243,1423,4123,4213,2134} 1243 1243 1423 1423 4123 4123 4213 4213 2134

  29. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created. Stop, if no jump is possible or jump direction is ambiguous. • Example: {1243,1423,4123,4213,2134} 1243 1243 4213 4213 2134 1423 1423 4123 4123 no jump 4213 4213 2134 possible

  30. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created. Stop, if no jump is possible or jump direction is ambiguous. • Example: {1243,1423,4123,4213,2134} 1243 1243 4213 4213 1423 2134 1423 1423 direction 4123 4123 no jump 4213 4213 ambiguous 2134 possible

  31. Algorithm J Algorithm J attempts to generate a set of permutations • start with an initial permutation from • in the current permutation, perform a minimal jump of the largest possible value , so that a previously unvisited permutation from is created. Stop, if no jump is possible or jump direction is ambiguous. • If every permutation from is visited and no ambiguity arises, we say that Algorithm J generates (visiting twice is impossible) • Question: When does Algorithm J generate ?

  32. Tree of permutations • root := empty permutation

  33. Tree of permutations • root := empty permutation • given a permutation of length , its children are obtained by inserting into every possible position depth = all permutations of length

  34. Tree of permutations • root := empty permutation • given a permutation of length , its children are obtained by inserting into every possible position symbol at leftmost or rightmost position else depth = all permutations of length

Recommend


More recommend