SLIDE 1 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
SLIDE 2
Partially ordered set (poset)
A set P with an antisymmetric, transitive relation
SLIDE 3
Partially ordered set (poset)
Cover graph
SLIDE 4
Linear extensions
A linear extension = order preserving permutation
SLIDE 5
Counting linear extensions
#P-complete (Brightwell & Winkler, ’91) Applications: sequence analysis, preference reasoning, sorting, learning probabilistic models, ...
SLIDE 6 Counting linear extensions
Currently we can do O(2nn) time for n elements. We give two algorithms, based on
- 1. recursion (exploiting low connectivity)
- 2. variable elimination (exploiting low treewidth)
SLIDE 7 Counting linear extensions
Currently we can do O(2nn) time for n elements. We give two algorithms, based on
- 1. recursion (exploiting low connectivity)
- 2. variable elimination (exploiting low treewidth)
SLIDE 8 Recursive counting
ℓ(P) = the number of linear extensions of poset P Rule 1 ℓ(P) =
ℓ(P \ x) Rule 2 ℓ(P) =
ℓ(D) · ℓ(U) Rule 3 ℓ(P) =
k
ℓ(Si) Rule 4 ℓ(P) = ℓ(A) · ℓ(B) · |P| |A|
SLIDE 9
Recursive counting
P \ a P \ b P
SLIDE 10
Recursive counting
P \ a P \ b P
SLIDE 11
Recursive counting
A B P
SLIDE 12
SLIDE 13
Recursive counting
Experiments on sparse posets for n = 30, . . . , 100
20 40 60 80 100 Percentage of posets solved 10−1 100 101 102 103 Time (s)
R14-a R134 R1 R24
SLIDE 14 Counting linear extensions
Currently we can do O(2nn) time for n elements. We give two algorithms, based on
- 1. recursion (exploiting low connectivity)
- 2. variable elimination (exploiting low treewidth)
SLIDE 15 Variable elimination
φ1(a, b, d) φ2(a, c) φ3(b, c, e) φ4(d, f)
SLIDE 16 Variable elimination
φ1(a, b, d) φ2(a, c) φ3(b, c, e) φ4(d, f)
SLIDE 17 Variable elimination
φ1(a, b, d) φ2(a, c) φ3(b, c, e) φ4(d, f)
SLIDE 18 Variable elimination
φ1(a, b, d) φ2(a, c) φ3(b, c, e) φ4(d, f) Polynomial time for bounded treewidth
SLIDE 19 Variable elimination
For every permutation σ : P → [n] define Φ(σ) =
[σx < σy]
SLIDE 20 Variable elimination
For every permutation σ : P → [n] define Φ(σ) =
[σx < σy] Φ(σ) = [σa < σc] [σa < σd] [σb < σd] [σc < σe] [σd < σe]
SLIDE 21 Variable elimination
For every permutation σ : P → [n] define Φ(σ) =
[σx < σy] Then, Φ(σ) = 1, if σ is a linear extension, 0, otherwise.
SLIDE 22 Variable elimination
For every permutation σ : P → [n] define Φ(σ) =
[σx < σy] Then, Φ(σ) = 1, if σ is a linear extension, 0, otherwise. As a consequence ℓ(P) =
bijection
Φ(σ)
SLIDE 23 Variable elimination
ℓ(P) =
bijection
Φ(σ)
SLIDE 24 Variable elimination
ℓ(P) =
bijection
Φ(σ) Can’t apply variable elimination because of the bijectivity constraint.
SLIDE 25 Variable elimination
ℓ(P) =
bijection
Φ(σ) =
(−1)n−|X|
Φ(σ) =
n
n k
Φ(σ) Inclusion–exclusion principle
SLIDE 26 Variable elimination
ℓ(P) =
bijection
Φ(σ) =
(−1)n−|X|
Φ(σ) =
n
n k
Φ(σ) O(nt+4) time for treewidth t
SLIDE 27
Variable elimination
VEIE: Variable elimination via inclusion–exclusion
30 40 50 60 70 80 90 100 Poset size (n) 10−1 100 101 102 103 Time (s) t = 2
VEIE R1 R14-a
SLIDE 28
Summary
Recursion: often fast in practice Variable elimination: polynomial time for bounded treewidth Thank you!