HELSINGIN YLIOPISTO HELSINGFORS UNIVERSITET UNIVERSITY OF HELSINKI Counting Linear Extensions of Sparse Posets Kustaa Kangas , Teemu Hankala, Teppo Niinimäki, Mikko Koivisto July 13, 2016 University of Helsinki Department of Computer Science
Partially ordered set (poset) A set P with an antisymmetric, transitive relation
Partially ordered set (poset) Cover graph
Linear extensions A linear extension = order preserving permutation
Counting linear extensions #P-complete (Brightwell & Winkler, ’91) Applications: sequence analysis, preference reasoning, sorting, learning probabilistic models, ...
Counting linear extensions Currently we can do O ( 2 n n ) time for n elements. We give two algorithms, based on 1. recursion (exploiting low connectivity) 2. variable elimination (exploiting low treewidth)
Counting linear extensions Currently we can do O ( 2 n n ) time for n elements. We give two algorithms, based on 1. recursion (exploiting low connectivity) 2. variable elimination (exploiting low treewidth)
Recursive counting ℓ ( P ) = the number of linear extensions of poset P � Rule 1 ℓ ( P ) = ℓ ( P \ x ) x ∈ min ( P ) � Rule 2 ℓ ( P ) = ℓ ( D ) · ℓ ( U ) ( D , U ) k � Rule 3 ℓ ( P ) = ℓ ( S i ) i = 1 � | P | � ℓ ( P ) = ℓ ( A ) · ℓ ( B ) · Rule 4 | A |
Recursive counting P \ a P \ b P
Recursive counting P \ a P \ b P
Recursive counting A B P
Recursive counting Experiments on sparse posets for n = 30 , . . . , 100 10 3 10 2 Time (s) 10 1 R14-a R134 10 0 R1 R24 10 − 1 0 20 40 60 80 100 Percentage of posets solved
Counting linear extensions Currently we can do O ( 2 n n ) time for n elements. We give two algorithms, based on 1. recursion (exploiting low connectivity) 2. variable elimination (exploiting low treewidth)
Variable elimination � φ 1 ( a , b , d ) φ 2 ( a , c ) φ 3 ( b , c , e ) φ 4 ( d , f ) a , b , c , d , e , f
Variable elimination � φ 1 ( a , b , d ) φ 2 ( a , c ) φ 3 ( b , c , e ) φ 4 ( d , f ) a , b , c , d , e , f
Variable elimination � φ 1 ( a , b , d ) φ 2 ( a , c ) φ 3 ( b , c , e ) φ 4 ( d , f ) a , b , c , d , e , f
Variable elimination � φ 1 ( a , b , d ) φ 2 ( a , c ) φ 3 ( b , c , e ) φ 4 ( d , f ) a , b , c , d , e , f Polynomial time for bounded treewidth
Variable elimination For every permutation σ : P → [ n ] define � Φ( σ ) = [ σ x < σ y ] x ≺ y
Variable elimination For every permutation σ : P → [ n ] define � Φ( σ ) = [ σ x < σ y ] x ≺ y Φ( σ ) = [ σ a < σ c ] [ σ a < σ d ] [ σ b < σ d ] [ σ c < σ e ] [ σ d < σ e ]
Variable elimination For every permutation σ : P → [ n ] define � Φ( σ ) = [ σ x < σ y ] x ≺ y Then, � 1, if σ is a linear extension, Φ( σ ) = 0, otherwise.
Variable elimination For every permutation σ : P → [ n ] define � Φ( σ ) = [ σ x < σ y ] x ≺ y Then, � 1, if σ is a linear extension, Φ( σ ) = 0, otherwise. As a consequence � ℓ ( P ) = Φ( σ ) σ : P → [ n ] bijection
Variable elimination � ℓ ( P ) = Φ( σ ) σ : P → [ n ] bijection
Variable elimination � ℓ ( P ) = Φ( σ ) σ : P → [ n ] bijection Can’t apply variable elimination because of the bijectivity constraint.
Variable elimination � ℓ ( P ) = Φ( σ ) σ : P → [ n ] bijection � � ( − 1 ) n −| X | = Φ( σ ) X ⊆ [ n ] σ : P → X n � n � � � ( − 1 ) n − k = Φ( σ ) k k = 0 σ : P → [ k ] Inclusion–exclusion principle
Variable elimination � ℓ ( P ) = Φ( σ ) σ : P → [ n ] bijection � � ( − 1 ) n −| X | = Φ( σ ) X ⊆ [ n ] σ : P → X n � n � � � ( − 1 ) n − k = Φ( σ ) k k = 0 σ : P → [ k ] O ( n t + 4 ) time for treewidth t
Variable elimination VEIE: Variable elimination via inclusion–exclusion 10 3 t = 2 10 2 Time (s) 10 1 VEIE 10 0 R1 R14-a 10 − 1 30 40 50 60 70 80 90 100 Poset size ( n )
Summary Recursion: often fast in practice Variable elimination: polynomial time for bounded treewidth Thank you!
Recommend
More recommend