280 likes | 296 Views
In computer science, combinatorial objects like binary trees, permutations, and binary strings are common. Efficient generation is crucial for tasks like counting and random sampling. This work presents a general framework for exhaustive generation of combinatorial classes. Generating objects as permutations with jumps allows for creating objects efficiently and in constant time. The presented algorithm provides a systematic way for generating permutations with minimal jumps, leading to a diverse set of combinatorial objects. The approach unifies existing algorithms and introduces new methods for generating various object families.
E N D
Combinatorial generationvia permutation languages Torsten Mütze (jointworkwith Liz Hartung, Hung P. Hoang, and Aaron Williams)
Introduction • In computer science, we frequently encounter differentkinds of combinatorial objects • Examples: • binarytrees • permutations • binarystrings • setpartitions • spanningtrees • … {1234} {123}{4} {12}{34} {12}{3}{4} 000 001 011 1234 1243 1423 • Common tasks: counting + randomsampling + exhaustive generation
Exhaustive generation • Goal:generate all objects of a combinatorialclassefficiently[Knuth, The Art of Computer Programming Vol. 4A] • ultimately: eachnewobject in constanttime • consecutiveobjectsdifferonlyby`smallchanges‘ Gray code • Examples: • binarytreesbyrotations [Lucas, van Baronaigien, Ruskey 93] • permutationsbyadjacenttranspositions(Steinhaus-Johnson-Trotteralgorithm [Johnson 63], [Trotter 62]) • binarystringsbybitflips(binaryreflected Gray code [Gray 53]) • setpartitionsbyelementexchanges [Kaye 76]
Exhaustive generation • manytailormadealgorithms, fewgeneralapproaches [Li, Sawada 09], [Ruskey, Sawada, Williams 12] • cf. generatingfunctionsforcounting[Flajolet, Sedgewick 09] • cf. Markovchainsforrandomsampling • Thiswork: A general framework for exhaustive generation • Results: all aforementionedalgorithms as specialcases+ manynewresultsforotherfamilies of objects • Idea: Encode objects as a subset of permutations of length
Jumps • Jump := move an entry in the permutationacrosssomeneighboringsmallerentries (right orleft) 4 51 3 2 6 4 1 3 2 5 6 • leftjump • right jump
Algorithm J Algorithm J attempts to generate a set of permutations • start with an initialpermutationfrom • in the current permutation, perform a minimal jump of the largest possible value, so that a previously unvisited permutation from is created. • Minimal jump: no shorterjump of the samevalueproduces a permutation in 4 51 3 2 6 7 8
Algorithm J Algorithm J attempts to generate a set of permutations • start with an initialpermutationfrom • in the current permutation, perform a minimal jump of the largest possible value, so that a previously unvisited permutation from is created. {1243,1423,4123,4213,2134} • Example: • minimal jumps • not minimal 1243 1243 4213
Algorithm J Algorithm J attempts to generate a set of permutations • start with an initialpermutationfrom • 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. {1243,1423,4123,4213,2134} • Example: 1243 1243 4213 4213 1423 2134 1423 1423 • directionambiguous 4123 4123 • no jumppossible 4213 4213 2134
Algorithm J Algorithm J • If every permutation from is visited and no ambiguityarises, we say that Algorithm J generates(visiting twice is impossible) attempts to generate a set of permutations • start with an initialpermutationfrom • 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. • Question: When does Algorithm J generate ?
Tree of permutations • root := emptypermutation • given a permutation of length , itschildrenareobtainedbyinsertingintoeverypossibleposition symbol at leftmostorrightmostposition else depth = allpermutationsof length
Zigzaglanguages • wemayprunesubtreesifftheirrootis • given any such pruned tree, a set of permutationsin depth is called zigzag language symbol at leftmostorrightmostposition else depth = allpermutationsof length
Zigzaglanguages • wemayprunesubtreesifftheirrootis • given any such pruned tree, a set of permutationsin depth is called zigzag language • Examples: • prunenothing: • pruneeverythingpossiblepermutationswithoutpeaks
Zigzaglanguages • wemayprunesubtreesifftheirrootis • given any such pruned tree, a set of permutationsin depth is called zigzag language Theorem:Algorithm J generates any zigzag language, using the identitypermutation for initialization. Proof: Induction over the depth. Remark: The number of zigzag languages is enormous
Examples permutationswithoutpeaks 234 1234 4123 4312 3124 3214 4321 4213 2134 000 001 011 010 110 111 101 100 1234 12431423 4123 4132 1432 1342 1324 3124 3142 3412 4312 4321 3421 3241 3214 2314 2341 2431 4231 4213 2413 2143 2134 BinaryreflectedGray code (BRGC)![Gray 53] to the right of smallerentries to the left of smallerentries Steinhaus-Johnson-Trotter![Johnson 63][Trotter 62] • not a sublist
General approach Set of permutations Combinatorialobjects • Run Algorithm J List = Algo J( ) List • DirectlyinterpretAlgorithm J under the bijection Algo J Algo J Minimal jumps ‚Small changes‘
Examples permutationswithoutpeaks 234 1234 4123 4312 3124 3214 4321 4213 2134 000 001 011 010 110 111 101 100 BinaryreflectedGray code (BRGC)![Gray 53] List List Algo J Algo J • start with the all-0 string • flip the rightmost bit that creates a new string
„Interesting“ zigzaglanguages • Applications of ourframework • pattern-avoidingpermutations • latticecongruences of the weak order on
Pattern-avoidingpermutations • Def: A permutationcontains a pattern , ifcontains a substring of entries in the same relative order as .Otherwiseavoids . contains 123 534216 avoids 123 654321
Pattern-avoidingpermutations • Def: A permutationcontains a pattern , ifcontains a substring of entries in the same relative order as .Otherwiseavoids . • set of permutationsavoiding . • A patterniscalledtame, if the largestsymbolis not at the leftmostorrightmostposition. 231 123 Theorem:If are all tame patterns, then is a zigzag language.
Pattern-avoidingpermutations Tamepatterns Combinatorialobjects Catalanfamilies 231 • binarytreesbyrotations • triangulationsbyedge flips • Dyck paths by hill flips 231 Set partitions by element exchanges Binarystringsbybitflips (BRGC) 231,132 vincularpattern: positionsmustbeadjacent Diagonal rectangulationsbyflips 2413,3142 Baxter permutations
Baxter permutations Tamepatterns Combinatorialobjects • In addition to classical and vincularpatterns: • bivincularpatterns[Bousquet-Mélou et al. 10] • barredpatterns[West 90] • meshpatterns[Brändén, Claesson 11] • monotone gridclasses[Huczynska, Vatter 06] • geometricgridclasses [Albert et al. 13] • etc. Diagonal rectangulationsbyflips 2413,3142 Baxter permutations
Latticecongruences • Def:weak order on • Inversion set of a permutation:= all pairsforwith • order permutationsbycontainment of inversionsets • cover relations= adjacenttranspositions • the weak order forms a lattice join meet
Latticecongruences • Def: A latticecongruenceis an equivalencerelationrespectingjoins and meets • Latticequotient := latticeinducedbyequivalenceclasses • Remark: The number oflattice congruences on theweak order is enormous • Tamari lattice, boolean lattice, Cambrian lattices [Reading 06]permutreelattices [Pilaud, Pons 18], etc.
Latticecongruences Theorem: For any lattice congruence,there is a set of representatives that formsa zigzag language. Moreover, the resulting jumpordering is a Hamilton path inthe cover graph of the quotient.
Latticecongruences Theorem: For any lattice congruence,there is a set of representatives that formsa zigzag language. Moreover, the resulting jumpordering is a Hamilton path inthe cover graph of the quotient. • [Pilaud-Santos 19] realized those cover graphsas polytopes, called quotientopes.They generalize permutahedra,associahedra, hypercubes etc. Corollary: Every quotientope has a Hamilton path.
Efficient algorithms • greedyalgorithm in itsstated form isveryinefficient(store and look-upexponentiallymanypreviouspermutations) • canmakeitmemoryless • running time in eachstepgivenbymembershiptests in • givespolynomial-timealgorithmforgeneratingpattern-avoidingpermutations • withmoreeffort: evenlooplessalgorithms
Thankyou! • tree of permutations • Gray codefor diagonalrectangulations • Torsten • Liz • Aaron