Complexity Theory of Polynomial-Time Problems Lecture 5: Subcubic Equivalences Karl Bringmann
Reminder: Relations = Reductions transfer hardness of one problem to another one by reductions problem P instance I size n reduction r(n) time problem Q instance J size s(n) I is a yes -instance () J is a yes -instance t(n) algorithm for Q implies a r n + t(s n ) algorithm for P if P has no r n + t(s n ) algorithm then Q has no t(n) algorithm
Reminder: Relations = Reductions problem P instance I size n reduction total time r(n) problem Q instance I 1 size n. instance I k size n 0
Subcubic Reduction A subcubic reduction from P to Q is an algorithm A for P with oracle access to Q s.t.: problem P instance I reduction problem Q instance I 1 size n. Properties: size n total time r(n) instance I k size n 0 for any instance I, algorithm A(I) correctly solves problem P on I A runs in time r(n) = O(n 567 ) for some γ > 0 for any ε > 0 there is a δ > 0 s.t. 0 n 56? >@. > n 56B
Subcubic Reduction A subcubic reduction from P to Q is an algorithm A for P with oracle access to Q with: Properties: problem Q problem P reduction instance I instance A subcubic I reduction implies: 1 size n. If Q has an O(n 56C ) algorithm for some α > 0, then P has an O(n 56E ) algorithm for some β > 0 size n total time instance I k r(n) size n 0 for any instance I, algorithm A(I) correctly solves problem P on I A runs in time r(n) = O(n 567 ) for some γ > 0 for any ε > 0 there is a δ > 0 s.t. 0 n 56? >@. > n 56B similar: subquadratic/subquartic reductions
Subcubic Reduction subcubic reduction: write P Q subcubic equivalent: write P Q if P Q and Q P Transitivity: (Exercise) For problems A, B, C with A B and B C we have A C. In particular: If A B and B C and C A then A, B, C are subcubic equivalent. B A C Lemma: (without proof) If A B and B is in time O n 5 /2N(OPQ R)S/T then A is in time O n 5 /2 N(OPQ R)S/T.
Reminder All-Pairs-Shortest-Paths (APSP): given a weighted directed graph G, compute the (length of the) shortest path between any pair of vertices each edge has a weight in {1,.., n W } Floyd-Warshall 62: O(n 5 )... Williams 14: O n 5 /2N(OPQ R)S/T Conjecture: for any ε > 0 APSP has no O n 56? algorithm there exists c > 0 such that
Reminder Min-Plus Matrix Product: each entry in {1,.., n W, } given n. n [ -matrix A and n [ n 5 -matrix B, define their min-plus product as the n. n 5 -matrix C with C >,\ = min.`0`r T A >,0 + B 0,\ from definition: O n 5 (if n = n. = n [ = n 5 ) Conjecture: for any ε > 0 there is no O n 56? algorithm there exists c > 0 such that
Reminder Thm: If APSP has a T(n) algorithm then Min-Plus Product has an O(T n + n [ ) algorithm. Thm: If Min-Plus Product has a T(n) algorithm then APSP has an O((T n + n [ ) log n) algorithm. Consider adjacency matrix A of G n n n Add selfloops with cost 0: A + I Square log n times using Min-Plus w i, k = A[i, k] w k, j = B[k, j] Product: B (A + I) [ mno p Then B >,\ is the length of the shortest path from i to j
Subcubic Reduction A subcubic reduction from P to Q is an algorithm A for P with oracle access to Q with: problem P instance I reduction problem Q instance I 1 size n. Properties: size n total time r(n) instance I k size n 0 for any instance I, algorithm A(I) correctly solves problem P on I A runs in time r(n) = O(n 567 ) for some γ > 0 for any ε > 0 there is a δ > 0 s.t. 0 n 56? >@. > n 56B
Subcubic Equivalences Thm: IfAPSP has a T(n) algorithm then Min-Plus Product has an O(T(n)) algorithm. Thm: If Min-Plus Product has a T(n) algorithm then APSP has an O(T n log n) algorithm. APSP and Min-Plus Product are subcubic equivalent Cor: APSP has an O(n 56? ) algorithm for some ε > 0 if and only if Min-Plus Product has an O(n 56B ) algorithm for some δ > 0 Cor: Min-Plus Product is in time O n 5 /2N(OPQ R)S/T
Subcubic Equivalences 2 nd Shortest Path Maximum Submatrix Metricity APSP Min-Plus Product All-Pairs- Negative- Negative Betweenness Centrality Radius Median [Vassilevska-Williams,Williams 10] [Abboud,Grandoni,Vassilevska-Williams 15]
Problems Negative each edge has a weight in { n W,.., n W } Given a weighted directed graph G Decide whether there are vertices i, j, k such that w j, i + w i, k + w k, j < 0 from definition: O(n 5 ) no O n 56? algorithm known (which works for all c > 0) Intermediate problem: All-Pairs-Negative- Given a weighted directed graph G with vertex set V = I J K Decide for every i I, j J whether there is a vertex k K s.t. w j, i + w i, k + w k, j < 0
Subcubic Equivalences 2 nd Shortest Path Maximum Submatrix Metricity APSP Min-Plus Product All-Pairs- Negative- Negative Betweenness Centrality Radius Median [Vassilevska-Williams,Williams 10] [Abboud,Grandoni,Vassilevska-Williams 15]
Neg- to Min-Plus-Product Given a weighted directed graph G on vertex set {1,, n} Adjacency matrix A: A >,\ = weight of edge i, j, or if the edge does not exist Min-Plus Product Negative 1. Compute Min-Plus Product B A A: B >,\ = min 0 A >,0 + A 0,\ 2. Compute min >,\ A \,> + B >,\ this equals min >,\,0 A \,> + A >,0 + A 0,\ i.e. the smallest weight of any triangle thus we solved Negative A: 3 1 4 1 5 2 2 7 1 Running Time: T Q ƒ QO n T ˆO Š n + O(n [ ) subcubic reduction
Subcubic Equivalences 2 nd Shortest Path Maximum Submatrix Metricity APSP Min-Plus Product All-Pairs- Negative- Negative Betweenness Centrality Radius Median [Vassilevska-Williams,Williams 10] [Abboud,Grandoni,Vassilevska-Williams 15]
3 1 4 2 1 A Min-Plus to All-Pairs-Neg- I 2 1 3 1 4 2 K 5 7 2 4 5 7 2 4 7 Add all edges from J to I with (carefully chosen) weights w(j, i) Run All-Pairs-Negative- algorithm J B n = 4 in the picture Min-Plus Product All-Pairs- Negative- Result: for all i, j, is there a k such that w j, i + w i, k + w k, j < 0? w i, k + w k, j < w j, i WANTED: Min-Plus: for all i, j: min 0 w i, k + w k, j = minimum number z s.t. there is a k s.t. w i, k + w k, j < z + 1 binary search via w j, i! simultaneous for all i, j!
3 1 4 2 1 A Min-Plus to All-Pairs-Neg- I 2 1 3 1 4 2 7 5 7 2 4 5 7 2 4 binary search via w j, i! simultaneous for all i, j! K need that all (finite) weights are in { n W,, n W } each entry of Min-Plus Product is in { 2n W,, 2n W, } binary search takes log [ 4n W + 1 = O(log n) steps J B n = 4 in the picture Min-Plus Product All-Pairs- Negative-
3 1 4 2 1 A Min-Plus to All-Pairs-Neg- I 2 1 3 1 4 2 7 K 5 7 2 4 J 5 7 2 4 binary search via w j, i! simultaneous for all i, j! B n = 4 in the picture Min-Plus Product All-Pairs- Negative- for all i, j: initialize m i, j 2n W and M(i, j): = 2n W repeat log (4n W ) times: for all i, j: set w j, i (m i, j + M(i, j))/2 compute All-Pairs-Negative- for all i, j: if i,j is in negative triangle: M i, j w j, i 1 otherwise: m i, j w j, i (missing: handling of )
3 1 4 2 1 A Min-Plus to All-Pairs-Neg- I 2 1 3 1 4 2 7 K 5 7 2 4 J 5 7 2 4 B n = 4 in the picture Min-Plus Product All-Pairs- Negative- binary search takes log [ 4n W + 1 = O(log n) steps T(n) algorithm for All-Pairs-Neg- yields O(T(n) log n) algorithm for Min-Plus Product In particular: O(n 56? ) algorithm for All-Pairs-Neg- for some ε > 0 implies O(n 56? ) algorithm for Min-Plus Product for some ε > 0 subcubic reduction
Subcubic Equivalences 2 nd Shortest Path Maximum Submatrix Metricity APSP Min-Plus Product All-Pairs- Negative- Negative Betweenness Centrality Radius Median [Vassilevska-Williams,Williams 10] [Abboud,Grandoni,Vassilevska-Williams 15]
All-Pairs-Neg- to Neg- Negative Given graph G Decide whether there are vertices i, j, k such that w j, i + w i, k + w k, j < 0 All-Pairs- Negative- Negative All-Pairs-Negative- Given graph G with vertex set V = I J K Decide for every i I, j J whether there is a vertex k K such that w j, i + w i, k + w k, j < 0 K Split I, J, K into n/s parts of size s: I.,, I R/, J.,, J R/, K.,, K R/ I K J For each of the (n/s) 5 triples (I, J, K ): consider graph G[I J K ] I J
All-Pairs-Neg- to Neg- Initialize C as n n all-zeroes matrix For each of the (n/s) 5 triples of parts (I, J, K ): While G[I J K ] contains a negative triangle: Find a negative triangle (i, j, k) in G[I J K ] Set C i, j 1 Set w(i, j) (i, j) is in no more negative triangles K All-Pairs- Negative- Negative guaranteed termination: can set n [ weights to I K J correctness: if (i, j) is in negative triangle, we will find one I J
All-Pairs-Neg- to Neg- Find a negative triangle (i, j, k) in G[I J K ] How to find a negative triangle if we can only decide whether one exists? Partition I into I (.), I ([), J into J (.), J ([), K into K (.),K ([) All-Pairs- Negative- Negative Since G[I J K ] contains a negative triangle, at least one of the 2 5 subgraphs G[I (š) J ( ) K (W) ] contains a negative triangle K Decide for each such subgraph whether it contains a negative triangle I J Recursively find a triangle in one subgraph
All-Pairs-Neg- to Neg- Find a negative triangle (i, j, k) in G[I J K ] How to find a negative triangle if we can only decide whether one exists? Partition I into I (.), I ([), J into J (.), J ([), K into K (.),K ([) All-Pairs- Negative- Negative Since G[I J K ] contains a negative triangle, at least one of the 2 5 subgraphs G[I (š) J ( ) K (W) ] contains a negative triangle Running Time: T œ Q ƒ QO n Decide for each such subgraph whether it contains a negative triangle Recursively find a triangle in one subgraph 2 5 T Ÿ Q ƒ QO (n) + T œ Q ƒ QO n/2 = O(T Ÿ Q ƒ QO n )
All-Pairs-Neg- to Neg- Initialize C as n n all-zeroes matrix All-Pairs- Negative- For each of the (n/s) 5 triples of parts (I, J, K ): While G[I J K ] contains a negative triangle: Find a negative triangle (i, j, k) in G[I J K ] Set C i, j 1 Set w(i, j) ( ) Negative Running Time: ( ) = O(T œ Q ƒ QO (s)) = O(T Ÿ Q ƒ QO (s)) Total time: #triples + #triangles found ( ) n/s 5 + n [ T Ÿ Q ƒ QO (s) Set s = n./5 and assume T Ÿ Q ƒ QO n = O(n 56? ) Total time: O n [ n.6?/5 = O(n 56?/5 )
Subcubic Equivalences 2 nd Shortest Path Maximum Submatrix Metricity APSP Min-Plus Product All-Pairs- Negative- Negative Betweenness Centrality Radius Median [Vassilevska-Williams,Williams 10] [Abboud,Grandoni,Vassilevska-Williams 15]
Radius G is a weighted directed graph d(u, v) is the distance from u to v in G Radius: min max d(u, v) u is in some sense the most central vertex u w(u, v) v Radius APSP compute all pairwise distances, then evaluate definition of radius in time O(n [ ) subcubic reduction Radius is in time O n 5 /2N(OPQ R)S/T
Negative to Radius Radius Negative instance: graph G with n nodes, edge-weights in { n W,, n W } i w(i, j) j Radius instance: graph H with O(n) nodes, edge-weights in {0,, O(n W )} i i i i ¹ j j j j ¹ Negative M = 3n W 1) Make four layers with n nodes 2) For any edge (i, j): Add i, j, i, j, i,j ¹ with weight M + w(i, j) A B C D
Negative to Radius Radius Negative instance: graph G with n nodes, edge-weights in { n W,, n W } i w(i, j) j k (i, j, k) has weight W Radius instance: graph H with O(n) nodes, edge-weights in {0,, O(n W )} i i ¹ j k Negative M = 3n W 1) Make four layers with n nodes 2) For any edge (i, j): Add i, j, i, j, i,j ¹ with weight M + w(i, j) A B C D path has length 3M + W i, j, k,i ¹ -path of length 3M 1?
Negative to Radius Radius Negative instance: graph G with n nodes, edge-weights in { n W,, n W } i w(i, j) j k (i, j, k) has weight W Radius instance: graph H with O(n) nodes, edge-weights in {0,, O(n W )} i i ¹ j k Negative M = 3n W 1) Make four layers with n nodes 2) For any edge (i, j): Add i, j, i, j, i,j ¹ with weight M + w(i, j) A B C D path has length 3M + W 3) Add edges of weight 3M 1 from any i to all nodes except i ¹ (and i ) i, j, k,i ¹ -path of length 3M 1? Radius: min max d(u, v) Claim: Radius of H is 3M 1 iff there is a negative triangle in G
Negative to Radius Radius Claim: Proof: Radius of H is 3M 1 iff there is a negative triangle in G Negative If there is a negative triangle (i, j, k) then i is in distance 3M 1 to i ¹ (by (2)), and in distance 3M 1 to any other vertex (by (3)), so the radius is max d i, v 3M 1 If there is no negative triangle i, j, k : Any node u of the form i /i /i ¹ cannot reach A, so it has max d u, v = Any i is in distance 3M to i ¹, since there is no i, j, k,i ¹ -path of length 3M 1 (note that the edges added in (3) also do not help) Hence, for all u, max d u, v 3M, and thus the radius is at least 3M
Subcubic Equivalences 2 nd Shortest Path Maximum Submatrix Metricity APSP Min-Plus Product All-Pairs- Negative- Negative Betweenness Centrality Radius Median [Vassilevska-Williams,Williams 10] [Abboud,Grandoni,Vassilevska-Williams 15]
MaxSubmatrix MaxSubmatrix: given an n n matrix A with entries in { n W,.., n W } Σ B sum of all entries of matrix B compute maximum Σ B over all submatrices B of A y. y [ A B x. x [ Thm: MaxSubmatrix is subcubic equivalent to APSP [Tamaki,Tokuyama 98] [Backurs,Dikkala,Tzamos 16] there are O(n ¾ ) possible submatrices B computing Σ B : O(n [ ) trivial running time: O(n ) Exercise: design an O(n 5 ) algorithm
MaxSubmatrix MaxSubmatrix: given an n n matrix A with entries in { n W,.., n W } Σ B sum of all entries of matrix B compute maximum Σ B over all submatrices B of A y. y [ A B x. x [ Thm: MaxSubmatrix is subcubic equivalent to APSP [Tamaki,Tokuyama 98] [Backurs,Dikkala,Tzamos 16] MaxCenteredSubmatrix: compute maximum Σ B over all submatrices B of A containing the center of A i.e. we require x. n/2 < x [ and y. n/2 < y [ Thm: MaxCenteredSubmatrix is subcubic equ. to APSP A we only prove: Negative MaxCenteredSubmatrix B Exercise: MaxCenteredSubmatrix APSP
Neg to MaxCentSubmatrix A Positive instance: graph G with n nodes, edge-weights in { n W,, n W } i w(i, j) MaxCenteredSubmatrix: 2n 2n-matrix A entries in { n Â(W),, n  (W) } y. y [ B x. x [ M 2n WÃ5 j k y. = k II I In quadrant II we want for any k, i: R R Æ Æ A, = w(k, i) Σ B ÄÄ = w(k, i) Σ B Ä = w(j, k) @0 @> this is satisfied by defining: A 0,> w k, i w k + 1, i y [ n = i w k, i + 1 + w(k + 1, i + 1) (where w x, y 0 for x > n or y > n) M M M M [ III M 0 M M Σ B ÄÅ = w(i, j) IV x. = i x [ n = j
Neg to MaxCentSubmatrix A Positive instance: graph G with n nodes, edge-weights in { n W,, n W } i MaxCenteredSubmatrix: 2n 2n-matrix A entries in { n Â(W),, n  (W) } y. y [ B x. x [ M 2n WÃ5 w(i, j) j k In quadrant II we want for any k, i: R R Æ Æ A, = w(k, i) @0 @> this is satisfied by defining: A 0,> w k, i w k + 1, i w k, i + 1 + w(k + 1, i + 1) (where w x, y 0 for x > n or y > n) With this definition of A, for any 1 k, i n: R R Æ Æ A, @0 @> R R = Æ Æw y, x w y + 1,x @0 @> w y, x + 1 +w(y + 1, x + 1) where any w(y,x) with k < y n and i < x n appears with factors +1 1 1 + 1 = 0 and any w y, x, s.t. exactly one of y = k or y = n + 1 or x = i or x = n + 1 holds, appears with factors +1 1 = 0 and since w(y, n + 1) = w(n + 1, x) = 0, the only remaining summand is w(k, i)
Neg to MaxCentSubmatrix A Positive instance: graph G with n nodes, edge-weights in { n W,, n W } MaxCenteredSubmatrix: 2n 2n-matrix A entries in { n Â(W),, n  (W) } y. y [ B x. x [ i w(i, j) Claim: MaxCentSubmatrix of A is > M iff G has a positive triangle M 2n WÃ5 j k y. = k II I In quadrant II we want for any k, i: R R Æ Æ A, = w(k, i) Σ B ÄÄ = w(k, i) Σ B Ä = w(j, k) @0 @> this is satisfied by defining: A 0,> w k, i w k + 1, i y [ n = i w k, i + 1 + w(k + 1, i + 1) (where w x, y 0 for x > n or y > n) M M M M [ III M 0 M M Σ B ÄÅ = w(i, j) IV x. = i x [ n = j
Summary 2 nd Shortest Path Maximum Submatrix Metricity APSP Min-Plus Product All-Pairs- Negative- Negative Betweenness Centrality Radius Median