Constant Time Generation of Linear Extensions Akimitsu Ono Shin-ichi Nakano Gunma Univ. Out put Complete List of Linear Extensions of P Input Partial ordering P
Generation Problems Given a class C of objects we wish to enumerate efficiently every object in C without duplications Application: Test data
Basic Enumeration Algorithm 1 Define a dictionary 2 Design two methods find-first-One find-next-of(x) Based on this technique many enumeration algorithms have designed. Algorithm Enumeration x = Find-first-One while x != NIL do Output x x = find-next-of (x)
Improvement In general, the output of enumeration algorithm is huge and dominates the running time. If we only output the difference of the objects, then we can improve the running time a lot (Combinatorial) Gray Code O(n) time/each O(1) time/each
Hamiltonian Path Vertex Object obj
Hamiltonian Path Vertex Object Edge difference is constnat obj
Hamiltonian Path Vertex Object Edge difference is constnat Hamiltonian Path dictionary obj
Unfortunately Hamiltonian Path may not exist! Vertex Object Edge difference is constnat No Hamiltonian Path No dictionary obj
Idea: However A Spanning Tree always exists! obj
Our Enummeration Algorithm 1 Define a spanning tree 2 Design two method find-root find-children-of(x) Algorithm enumeration x = find-root find-children-of (x) Algorithm find-children-of(x) Output(x) as a difference find-children-of(x) for each child xi do find-children-of(xi) obj If we can find k children in O(k) time, then we can find each object O(1) time for each
Our Enumeration Algorithms Based on this technique (output only difference) + (tree structure) we have designed many enumeration algorithms. Biconnected plane triangulations ICALP2001 Triconnected plane triangulations COCOON 2001 Floorplan ISAAC 2001 Planted tree IPL 2002 Free tree WG2004 Linear extension This Talk plane graph
Linear Extensions Out put A Linear Extension of P Input Partial ordering P Many scheduling problems with precedence constraints are modeled by a linear extension of a partial ordering Given a partial ordering P, one can compute a linear extension of P in O(n+m) time. See page 549 of (All arrow go right!) job
Generating All Linear Extensions Out put Complete List of Linear Extensions of P Input Partial ordering P
Known Enumeration Algorithms for Linear Extensions Well 71 O(n)time / each Knuth, Szwarcfiter 74 O(m+n)time / each Vorol and Rotem 81 O(n)time / each Pruesse and Ruskey 94 O(1)time / each on average This Talk O(1)time / each (worst case)
Pruesse and Ruskey 94 Input Partial ordering P
Pruesse and Ruskey 94 Input Partial ordering P If we can find a Hamiltonian Path then we can output each in O(1) time. However, …..
Pruesse and Ruskey 94 Input Partial ordering P
Pruesse and Ruskey 94 Input Partial ordering P G X K 2 Hamiltonian ! O(n) time for Trace Output O(1) time/each
Our Algorithm Root Define A sequence of linear extensions for each A linear extension P Parent of P within n step we always reach the Root
Family Tree of Linear Extensions
Our Algorithm 1234
Root Child of Root
Our Algorithm
Example Input Partial ordering P
How can we find children Input Partial ordering P #Type 1 Child 0 #Type 2 Child 3 #Type 3 Child 0 We can find k children in O(k) time
Running Time Preprocessing find root linear extension O(m+n) time Then trace the tree in O(n) time O(1) time / each on average
Odd-Even Travarsal Algorithm find-children-of(x) If depth is odd Output(x) for each child xi do find-children-of(xi) If depth is even Output(x)
Running Time Preprocessing find root linear extension O(m+n) time Then O(1) time / each on average ( in worst case)
Summary A simple enumeration algorithm for linear extensions Preprocessing find a linear extension O(m+n) time then trace the tree in O(n) time Output O(1) time / each
Future Works Can we estimate # of descendant objects in the tree without constructing the tree? load balancing
Thank you for your attention! Give me questions and suggestions!