Fast Monotone Summation over Disjoint Sets Petteri Kaski 1 , 2 Mikko Koivisto 1 , 3 Janne H. Korhonen 1 , 3 1 Helsinki Institute for Information Technology HIIT 2 Department of Information and Computer Science, Aalto University 3 Department of Computer Science, University of Helsinki
Introduction: Algebrisation and k -Path
Problem: counting 2 k -paths Input : graph G = ( V , E ) Output : number of 2 k -paths with middle vertex v
Problem: counting 2 k -paths Input : graph G = ( V , E ) Output : number of 2 k -paths with middle vertex v ◮ Trivial algorithm n O ( 1 ) � n � 2 k ◮ Counting in halves n O ( 1 ) � n � [Björklund et al. 2009] k
1. Let f ( X ) = # of k -paths on X ∪ { v } ending at v .
1. Let f ( X ) = # of k -paths on X ∪ { v } ending at v . 2. Recover the number of 2 k -paths as 1 � f ( Y ) · f ( X ) 2 X , Y : X ∩ Y = ∅
◮ Inclusion-exclusion in time n O ( 1 ) � n � : k � e ( Y ) = f ( X ) X : X ∩ Y = ∅ ( − 1 ) | X | � � e ( Y ) = f ( Z ) X ⊆ Y Z ⊇ X ◮ Recover the result as � � f ( Y ) · f ( X ) = f ( Y ) · e ( Y ) X , Y : X ∩ Y = ∅ Y
What if we do not have additive inverses?
Definition ( k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } . f ( X ) Input : for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of [ n ] of size k .
Definition ( k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } . f ( X ) Input : for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of [ n ] of size k . Inputs Outputs � n � f e � n � k k
Definition ( k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } . f ( X ) Input : for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of [ n ] of size k . �� n �� n − k �� ◮ Trivial algorithm O . k k � � n �� ◮ Inclusion-exclusion O k [Björklund et al. 2009]: k � ( − 1 ) | X | � e ( Y ) = f ( Z ) X ⊆ Y Z ⊇ X
Definition (Monotone k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f ( X ) ∈ S for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of X of size k .
Definition (Monotone k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f ( X ) ∈ S for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of X of size k . Example ( ( S , ⊕ ) = ( Q , max ) ) Input : f ( X ) ∈ Q for all X , Output : e ( Y ) = X : X ∩ Y = ∅ f ( X ) max for all Y .
Definition (Monotone k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f ( X ) ∈ S for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of X of size k . �� n �� n − k �� ◮ Trivial algorithm O . k k ◮ Inclusion-exclusion? ( − 1 ) | X | � � e ( Y ) = f ( Z ) X ⊆ Y Z ⊇ X
Definition (Monotone k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f ( X ) ∈ S for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of X of size k .
Definition (Monotone k -disjoint summation) Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f ( X ) ∈ S for all X , � Output : e ( Y ) = f ( X ) for all Y , X : X ∩ Y = ∅ where X and Y range over subsets of X of size k . Our Result Monotone k -disjoint summation can be solved in time O ( n k + 2 polylog ( n )) .
Semiring Encodings
Counting maximum-weight 2 k -paths Input : graph G = ( V , E ) with edge weights Output : number of 2 k -paths with middle vertex v and weight w ∗ , where w ∗ the maximum weight of a 2 k -path. 3 3 1 1 1 1 1 1 2 1 1 1 3 1 2 2 1 1 2 3 1 1 1 2 3 3 3 2 3 1 2 1 1 1 3 4 2 3 2 2 5 2 3 2 5 4 1 3 4 1 3 1 1 1 1 4 2 3 5 2 2 3 3 3 1 3 2 3 2 3 3 2 1 3 2 1 1 2 3 1 3 3 1 1 1 2 1 2 4 2 3 1
Counting maximum-weight 2 k -paths Input : graph G = ( V , E ) with edge weights Output : number of 2 k -paths with middle vertex v and weight w ∗ , where w ∗ the maximum weight of a 2 k -path. 1 3 3 2 1 3 2 2 5 1 1 3 1 3
Counting maximum-weight 2 k -paths Input : graph G = ( V , E ) with edge weights Output : number of 2 k -paths with middle vertex v and weight w ∗ , where w ∗ the maximum weight of a 2 k -path. ◮ If weights are integers at most W , then problem can be solved with counting in halves and polynomial encoding in time W · n O ( 1 ) � n � k
Counting maximum-weight 2 k -paths Input : graph G = ( V , E ) with edge weights Output : number of 2 k -paths with middle vertex v and weight w ∗ , where w ∗ the maximum weight of a 2 k -path. ◮ If weights are integers at most W , then problem can be solved with counting in halves and polynomial encoding in time W · n O ( 1 ) � n � k ◮ Counting in halves with semiring encoding and monotone disjoint summation n k + O ( 1 )
The Cartesian product N × ( R ∪ {−∞} ) is a commutative semiring when equipped with operations ( c , w ) if w > v , ( c , w ) ⊕ ( d , v ) = ( d , v ) if w < v , ( c + d , w ) if w = v and ( c , w ) ⊙ ( d , v ) = ( cd , w + v ) .
3 3 1 2 3 2 5 3 4 1 3 f ( X ) = (3 , 18) ◮ Let f ( X ) = ( c , w ) , where ◮ w is the maximum weight of k -path on X ∪ { v } ending at v , and ◮ c is the number of such paths with weight w .
1 3 2 3 1 2 1 2 3 2 5 3 5 1 4 1 3 1 1 3 (3 , 18) ⊗ (2 , 15) = (6 , 33) ◮ Compute ( c , w ∗ ) = � f ( Y ) ⊗ f ( X ) X , Y : X ∩ Y = ∅ ◮ Then the maximum weight of a path is w ∗ and the number of maximum weight paths is 1 2 c
Further Applications ◮ k × n matrix permanent in time n k / 2 + O ( 1 ) over noncommmutative semirings: A ∈ S k × n Input : � Output : perm ( A ) = a 1 σ ( 1 ) a 2 σ ( 2 ) · · · a k σ ( k ) σ ◮ Maximisation with restrictions, e.g. in machine � 2 : learning, n k + O ( 1 ) vs. n O ( 1 ) � n k f ( X ) ∈ Q Input : for all X Output : e ( Y ) = X : X ∩ Y = ∅ f ( X ) max for all Y
Computing Monotone Disjoint Sums
Special Case: 1-Disjoint Summation Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f i ∈ S for i = 1 , 2 , . . . , n � Output : e j = f i for j = 1 , 2 , . . . , n i � = j
Special Case: 1-Disjoint Summation Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f i ∈ S for i = 1 , 2 , . . . , n � Output : e j = f i for j = 1 , 2 , . . . , n i � = j Lemma [Valiant 1986] There is an S -arithmetic circuit of size O ( n ) for monotone 1-disjoint summation.
e ₁ e ₂ e ₃ e ₄ e ₅ e ₆ e ₇ e ₈ f ₁ f ₂ f ₃ f ₄ f ₅ f ₆ f ₇ f ₈
Monotone k -disjoint summation, extended Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f ( X ) ∈ S for all X , � e ( Y ) = f ( X ) for all Y , Output : X : X ∩ Y = ∅ where X and Y range over subsets of [ n ] of size at most k .
Monotone k -disjoint summation, extended Let [ n ] = { 1 , 2 , . . . , n } and let ( S , ⊕ ) be a commutative semigroup. Input : f ( X ) ∈ S for all X , � e ( Y ) = f ( X ) for all Y , Output : X : X ∩ Y = ∅ where X and Y range over subsets of [ n ] of size at most k . Main theorem There is an S -arithmetic circuit of size O ( n k log n ) for extended monotone k -disjoint summation. Furthermore, the circuit can be constructed in time O ( k 2 n k polylog n ) .
[ n ]
0 1 2 3 [ n ] 4
0 1 2 3 X 4
0 1 X | 2 2 3 X 4
0 X | 1 1 X | 2 2 3 X 4
0 1 W 2 3 4
0 1 W 2 3 4 Y
0 1 W 2 3 4 Y
{ r } 0 1 2 3 4 Y
Concluding Remarks ◮ Working with semigroups and -rings
Concluding Remarks ◮ Working with semigroups and -rings ◮ Open question: � � n �� O ( n k log n ) vs. O k ? k
Concluding Remarks ◮ Working with semigroups and -rings ◮ Open question: � � n �� O ( n k log n ) vs. O k ? k ◮ [Sergeev 2012]: √ � � n �� α = 3 + 5 α k O , k 2
Concluding Remarks ◮ Working with semigroups and -rings ◮ Open question: � � n �� O ( n k log n ) vs. O k ? k ◮ [Sergeev 2012]: √ � � n �� α = 3 + 5 α k O , k 2 Thank you – Questions?
Recommend
More recommend