Exact Weight Subgraphs and the k-Sum Conjecture Amir Abboud and Kevin Lewi Computer Science Department, Stanford University {abboud,klewi}@cs.stanford.edu
Abstract. We consider the E XACT-W EIGHT-H problem of finding a (not necessarily induced) subgraph H of weight 0 in an edge-weighted graph G. We show that for every H, the complexity of this problem is strongly related to that of the infamous k- SUM problem. In particular, we show that under the k- SUM Conjecture, we can achieve tight upper and lower bounds for the E XACT-W EIGHT-H problem for various subgraphs H such as matching, star, path, and cycle. One interesting consequence is that improving on the O(n3 ) upper bound for E XACT-W EIGHT-4- PATH or E XACT-W EIGHT-5- PATH will imply improved algorithms for 3- SUM, 5- SUM, A LL -PAIRS S HORTEST PATHS and other fundamental problems. This is in sharp contrast to the minimum-weight and (unweighted) detection versions, which can be solved easily in time O(n2 ). We also show that a faster algorithm for any of the following three problems would yield faster algorithms for the others: 3- SUM, E XACT-W EIGHT-3- MATCHING, and E XACT-W EIGHT-3- STAR.
1 Introduction Two fundamental problems that have been extensively studied separately by different research communities for many years are the k- SUM problem and the problem of finding subgraphs of a certain form in a graph. We investigate the relationships between these problems and show tight connections between k- SUM and the “exact-weight” version of the subgraph finding problem. The k- SUM problem is the parameterized version of the well known NP-complete problem SUBSET- SUM, and it asks if in a set of n integers, there is a subset of size k whose integers sum to 0. This problem can be solved easily in time O(nk/2 ), and Baran, Demaine, and Pˇatras¸cu [3] show how the 3- SUM problem can be solved in time O(n2 / log2 n) using certain hashing techniques. However, it has been a longstanding open problem to solve k- SUM for some k in time O(nk/2− ) for some > 0. In certain restricted models of computation, an Ω(nk/2 ) lower bound has been established initially by Erickson [7] and later generalized by Ailon and Chazelle [1], and recently, Pˇatras¸cu and Williams [16] show that no(k) time algorithms for all k would refute the Exponential Time Hypothesis. The literature seems to suggest the following hypothesis, which we call the k- SUM Conjecture:
This work was done while the author was supported by NSF grant CCF-1212372.
F.V. Fomin et al. (Eds.): ICALP 2013, Part I, LNCS 7965, pp. 1–12, 2013. c Springer-Verlag Berlin Heidelberg 2013
2
A. Abboud and K. Lewi
Conjecture 1 [The k- SUM Conjecture]. There does not exist a k ≥ 2, an ε > 0, and a randomized algorithm that succeeds (with high probability) in solving k- SUM in time k O(n 2 −ε ). The presumed difficulty of solving k- SUM in time O(nk/2−ε ) for any ε > 0 has been the basis of many conditional lower bounds for problems in computational geometry. The k = 3 case has received even more attention, and proving 3- SUM-hardness has become common practice in the computational geometry literature. In a recent line of work, Pˇatras¸cu [15], Vassilevska and Williams [17], and Jafargholi and Viola [11] show conditional hardness based on 3- SUM for problems in data structures and triangle problems in graphs. The problem of determining whether a weighted or unweighted n-node graph has a subgraph that is isomorphic to a fixed k node graph H with some properties has been well-studied in the past [14,12,6]. There has been much work on detection and counting copies of H in graphs, the problem of listing all such copies of H, finding the minimum-weight copy of H, etc. [17,13]. Considering these problems for restricted types of subgraphs H has received further attention, such as for subgraphs H with large indepedent sets, or with bounded treewidth, and various other structures [17,18,13,8]. In this work, we focus on the following subgraph finding problem. Definition 1 (The E XACT-W EIGHT-H Problem). Given an edge-weighted graph G, does there exist a (not necessarily induced) subgraph isomorphic to H such that the sum of its edge weights equals a given target value t?1 No non-trivial algorithms were known for this problem. Theoretical evidence for the hardness of this problem was given in [17], where the authors prove that for any H of size k, an algorithm for the exact-weight problem can give an algorithm for the minimum-weight problem with an overhead that is only O(2k · log M ), when the weights of the edges are integers in the range [−M, M ]. They also show that improving on the trivial O(n3 ) upper bound for E XACT-W EIGHT-3- CLIQUE to O(n3−ε ) for any ˜ 3−ε ) algorithm2 for the minimum-weight 3- CLIQUE ε > 0 would not only imply an O(n problem, which from [19] is in turn known to imply faster algorithms for the canoni cal A LL -PAIRS S HORTEST PATHS problem, but also an O(n2−ε ) upper bound for the 3- SUM problem, for some ε > 0. They give additional evidence for the hardness of the exact-weight problem by proving that faster than trivial algorithms for the k- CLIQUE problem will break certain cryptographic assumptions. Aside from the aforementioned reduction from 3- SUM to E XACT-W EIGHT-3- CLIQUE, few other connections between k- SUM and subgraph problems were known. The standard reduction from Downey and Fellows [5] gives a way to reduce the unweighted k- CLIQUE detection problem to k2 - SUM on n2 numbers. Also, in [15] and [11], strong connections were shown between the 3- SUM problem (or, the similar 3- XOR problem) and listing triangles in unweighted graphs. 1
2
We can assume, without loss of generality, that the target value is always 0 and that H has no isolated vertices. ˜ (n)) will hide polylog(n) factors. In our bounds, k is treated as a constant. The notation O(f
Exact Weight Subgraphs and the k-Sum Conjecture
3
1.1 Our Results In this work, we study the exact-weight subgraph problem and its connections to k- SUM. We show three types of reductions: k- SUM to subgraph problems, subgraphs to other subgraphs, and subgraphs to k- SUM. These results give conditional lower bounds that can be viewed as showing hardness either for k- SUM or for the subgraph problems. We focus on showing implications of the k- SUM Conjecture and therefore view the first two kinds as a source for conditional lower bounds for E XACT-W EIGHT-H, while we view the last kind as algorithms for solving the problem. Our results are summarized in Table 1 and Figure 1, and are discussed below. Hardness. By embedding the numbers of the k- SUM problem into the edge weights of the exact-weight subgraph problem, using different encodings depending on the structure of the subgraph, we prove four reductions that are summarized in Theorem 1: Theorem 1. Let k ≥ 3. If for all ε > 0, k- SUM cannot be solved in time O(nk/2−ε ), then none of the following problems3 can be solved in time O(nk/2−δ ), for any δ > 0: – – – –
E XACT-W EIGHT-H on a graph on n nodes, for any subgraph H on k nodes. √ E XACT-W EIGHT-k- MATCHING on a graph on n nodes. E XACT-W EIGHT-k- STAR on a graph on n(1−1/k) nodes. E XACT-W EIGHT-(k-1)- PATH on a graph on n nodes.
An immediate implication of Theorem 1 is that neither 3- STAR can be solved in time O(n3−ε ), nor can 3- MATCHING be solved in time O(n4−ε ) for some ε > 0, unless 3- SUM can be solved in time O(n2−ε ) for some ε > 0. We later show that an O(n2−ε ) ˜ 3−ε ) algorithm for 3- STAR algorithm for 3- SUM for some ε > 0 will imply both an O(n 4−2ε ˜ and an O(n ) algorithm for 3- MATCHING. In other words, either all of the following three statements are true, or none of them are: – 3- SUM can be solved in time O(n2−ε ) for some ε > 0. – 3- STAR can be solved in time O(n3−ε ) for some ε > 0. – 3- MATCHING can be solved in time O(n4−ε ) for some ε > 0. From [17], we already know that solving 3- CLIQUE in time O(n3−ε ) for some ε > 0 implies that 3- SUM can be solved in time O(n2−ε ) for some ε > 0. By Theorem 1, this would imply faster algorithms for 3- STAR and 3- MATCHING as well. Another corollary of Theorem 1 is the fact that 4- PATH cannot be solved in time O(n3−ε ) for some ε > 0 unless 5- SUM can be solved in time O(n3−ε ) for some ε > 0. This is in sharp contrast to the unweighted version (and the min-weight version) of 4- PATH, which can both be solved easily in time O(n2 ). Theorem 1 shows that the k- SUM problem can be reduced to the E XACT-W EIGHT-H problem for various types of subgraphs H, and as we noted, this implies connections between the exact-weight problem for different subgraphs. It is natural to ask if for any other subgraphs the exact-weight problems can be related to one another. We will 3
k- MATCHING denotes the k-edge matching on 2k nodes. k- STAR denotes the k-edge star on k + 1 nodes. k- PATH denotes the k-node path on k-1 edges.
4
A. Abboud and K. Lewi
answer this question in the affirmative—in particular, we show a tight reduction from 3- CLIQUE to 4- PATH. To get this result, we use the edge weights to encode information about the nodes in order to prove a reduction from E XACT-W EIGHT-H1 to E XACT-W EIGHT-H2 , where H1 is what we refer to as a “vertex-minor” of H2 . Informally, a vertex-minor of a graph is one that is obtained by edge deletions and node identifications (contractions) for arbitrary pairs of nodes of the original graph (see Section 4 for a formal definition). For example, the triangle subgraph is a vertex-minor of the path on four nodes, which is itself a vertex-minor of the cycle on four nodes. Theorem 2. Let H1 , H2 be subgraphs such that H1 is a vertex-minor of H2 . For any α ≥ 2, if E XACT-W EIGHT-H2 can be solved in time O(nα ), then E XACT-W EIGHT-H1 ˜ α ). can be solved in time O(n Therefore, Theorem 2 allows us to conclude that 4- CYCLE cannot be solved in time ˜ 3−ε ), which cannot O(n3−ε ) for some ε > 0 unless 4- PATH can be solved in time O(n 3−ε ˜ happen unless 3- CLIQUE can be solved in time O(n ). To complete the picture of relations between 3-edge subgraphs, consider the subgraph composed of a 2-edge path along with another (disconnected) edge. We call this the “VI” subgraph and we define the E XACT-W EIGHT-VI problem appropriately. Since the path on four nodes is a vertex-minor of VI, we have that an O(n3−ε ) for some ε > 0 ˜ 3−ε ) algorithm for 4- PATH. In Figalgorithm for E XACT-W EIGHT-VI implies an O(n ure 1, we show this web of connections between the exact-weight 3-edge subgraph problems and its connection to 3- SUM, 5- SUM, and A LL -PAIRS S HORTEST PATHS. In fact, we will soon see that the conditional lower bounds we have established for these 3-edge subgraph problems are all tight. Note that the detection and minimum-weight versions of some of these 3-edge subgraph problems can all be solved much faster than O(n3 ) (in particular, O(n2 )), and yet such an algorithm for the exact-weight versions for any of these problems will refute the 3- SUM Conjecture, the 5- SUM Conjecture, and lead to breakthrough improvements in algorithms for solving A LL -PAIRS S HORTEST PATHS and other important graph and matrix optimization problems (cf. [19])! Another O(n3 ) solvable problem is the E XACT-W EIGHT-5- PATH, and by noting that both 4- CYCLE and VI are vertex-minors of 5- PATH, we get that improved algorithms for 5- PATH will yield faster algorithms for all of the above problems. Moreover, from Theorem 1, 6- SUM reduces to 5- PATH. This established E XACT-W EIGHT-5- PATH as the “hardest” of the O(n3 ) time problems that we consider. We also note that Theorem 2 yields some interesting consequences under the assumption that the k- CLIQUE problem cannot be solved in time O(nk−ε ) for some ε > 0. Theoretical evidence for this assumption was provided in [17], where they show how an O(nk−ε ) for some ε > 0 time algorithm for E XACT-W EIGHT-k- CLIQUE yields a subexponential time algorithm for the multivariate quadratic equations problem, a problem whose hardness is assumed in post-quantum cryptography. We note that the 4-clique is a vertex-minor of the 8-node path, and so by Theorem 2, an O(n4−ε ) for some ε > 0 algorithm for 8- PATH will yield a faster 4- CLIQUE algorithm. Note that an O(n5−ε ) algorithm for 8- PATH already refutes the 9- SUM
Exact Weight Subgraphs and the k-Sum Conjecture
5
Conjecture. However, this by itself is not known to imply faster clique algorithms4. Also, there are other subgraphs for which one can only rule out O(nk/2−ε ) for ε > 0 upper bounds from the k- SUM Conjecture, while assuming hardness for the k- CLIQUE problem and using Theorem 2, much stronger lower bounds can be achieved. All-Pairs Shortest Paths
MW-3-clique
(n3 )
(n3 )
EW-3-clique (n3 )
5-sum
EW-4-path
(n3 )
(n3 )
EW-3-star (n3 )
EW-VI
3-sum
EW-4-cycle
3
3
(n )
(n )
EW-3-matching
(n2 )
(n4 )
6-sum (n3 )
EW-5-path (n3 )
Fig. 1. A diagram of the relationships between E XACT-W EIGHT-H (denoted EW , for small subgraphs H) and other important problems. The best known running times are given for each problem, and an arrow A → B denotes that A can be tightly reduced to B, in the sense that improving the stated running time for B will imply an improvement on the stated running time for A. The reductions established in this work are displayed in bold, the others are due to [19], [17].
Algorithms. So far, our reductions only show one direction of the relationship between k- SUM and the exact-weight subgraph problems. We now show how to use k- SUM to solve E XACT-W EIGHT-H, which will imply that many of our previous reductions are indeed tight. The technique for finding an H-subgraph is to enumerate over a set of d smaller subgraphs that partition H in a certain way. Then, in order to determine whether the weights of these d smaller subgraphs sum up to the target weight, we use d- SUM . We say that (S, H1 , . . . , Hd ) is a d-separator of H iff S, H1 , . . . , Hd partition V (H) and there are no edges between a vertex in Hi and a vertex in Hj for any distinct i, j ∈ [d]. Theorem 3. Let (S, H1 , . . . , Hd ) be a d-separator of H. Then, E XACT-W EIGHT-H can ˜ |S| ) instances of d- SUM each on max{n|H1 | , . . . , n|Hd | } numbers. be reduced to O(n By using the known d- SUM algorithms, Theorem 3 gives a non-trivial algorithm for exact-weight subgraph problems. The running time of the algorithm depends on the choice of the separator used for the reduction. We observe that the optimal running 4
It is not known whether the assumption that k- CLIQUE cannot be solved in time O(nk−ε ) for any ε > 0 is stronger or weaker than the k- SUM Conjecture.
6
A. Abboud and K. Lewi
time can be achieved even when d = 2, and can be identified (naively, in time O(3k )) using the following expression. Let γ(H) =
min
(S,H1 ,H2 ) is a 2-separator
{|S| + max {|H1 |, |H2 |}} .
˜ γ(H) ). Corollary 1. E XACT-W EIGHT-H can be solved in time O(n Corollary 1 yields the upper bounds that we claim in Figure 1 and Table 1. For example, to achieve the O(n(k+1)/2 ) time complexity for k- PATH, observe that we can choose the set containing just the “middle” node of the path to be S, so that the graph H \ S is split into two disconnected halves H1 and H2 , each of size at most (k − 1)/2. Note that this is the optimal choice of a separator, and so γ(k- PATH) = 1 + (k − 1)/2 = (k + 1)/2. It is interesting to note that this simple algorithm achieves running times that match many of our conditional lower bounds. This means that in many cases, improving on this algorithm will refute the k- SUM Conjecture, and in fact, we are not aware of any subgraph for which a better running time is known. E XACT-W EIGHT-H is solved most efficiently by our algorithm when γ(H) is small, that is, subgraphs with small “balanced” separators. Two such cases are when H has a large independent set and when H has bounded treewidth. We show that s E XACT-W EIGHT-H can be solved in time O(nk− 2 ), if α(H) = s, and in time 2 O(n 3 ·k+tw(H) ). Also, we observe that our algorithm can be modified slightly to get an algorithm for the minimization problem. Theorem 4. Let H be a subgraph on k nodes, with independent set of size s. Given a graph G on n nodes with node and edge weights, the minimum total weight of a (not necessarily induced) subgraph of G that is isomorphic to H can be found in time ˜ k−s+1 ). O(n This algorithm improves on the O(nk−s+2 ) time algorithm of Vassilevska and Williams [17] for the M IN -W EIGHT-H problem. Organization. We give formal definitions in Section 2. In Section 3 we present reductions from k- SUM to exact-weight subgraph problems that prove Theorem 1. In Section 4 we define vertex-minors and outline the proof of Theorem 2. In Section 5, we present the reduction of Theorem 3.
2 Preliminaries and Basic Constructions For a graph G, we will use V (G) to represent the set of vertices and E(G) to represent the set of edges. The notation N (v) will be used to represent the neighborhood of a vertex v ∈ V (G). 2.1 Reducibility We will use the following notion of reducibility between two problems. In weighted graph problems where the weights are integers in [−M, M ], n will refer to the number
Exact Weight Subgraphs and the k-Sum Conjecture
7
Table 1. The results shown in this work for E XACT-W EIGHT-H for various H. The second column has the upper bound achieved by our algorithm from Corollary 1. Improvements on the lower bound in the third column will imply improvements on the best known algorithms for the problems in the condition column. These lower bounds are obtained by our redctions, except for the first row which was proved in [17]. For comparison, we give the running times for the (unweighted) detection and minimum-weight versions of the subgraph problems. The last row shows our conditional lower bounds for k- SUM. α(H) represents the independence number of H, tw(H) is its treewidth. The results for the “Any” row hold for all subgraphs on k nodes. ETH stands for the Exponential Time Hypothesis. Subgraph
Exact
Lower Bound Condition
Detection
Min
3- CLIQUE 4- PATH
n3 n3
n3 n3
3- SUM, APSP 3- CLIQUE, 5- SUM
nω [10] n2
n3 n2
k- SUM
n2
n2
(k+1)- SUM
n
n2
n2
n2
2
k- MATCHING n2· 2 k
k- STAR k- PATH
k n 2 +1
k n2· 2 k+1 n 2
k k n 2 · k−1 k+1 k+1 n 2 n 2
k- CYCLE
k+1 k n 2 +1 n 2
Any
nk
k- SUM k- SUM k- PATH
n
n3
k- SUM (ETH)
nωk/3 [12]
nk
α(H) = s
nk/2 nεk s k nk− 2 n 2
k- SUM
nk−s+1 [13] nk−s+1 [Thm. 4]
tw(H) = w
n
k- SUM
nw+1 [2]
k- SUM
k n 2
2 k+w 3
k n 2 k n 2
k- MATCHING, k- STAR -
n2w [8] -
of nodes times log M . For k- SUM problems where the input integers are in [−M, M ], n will refer to the number of integers times log M . In the full version of the paper we formally define our notion of reducibility, which follows the definition of subcubic reductions in [19]. Informally, for any two decision problems A and B, we say that A a≤b B if for any > 0, there exists a δ > 0 such that if B can be solved (w.h.p.) in time nb− , then A can be solved (w.h.p.) in time O(na−δ ), where n is the size of the input. Note that polylog(n) factor improvements in solving B may not imply any improvements in solving A. Also, we say that A a≡b B if and only if A a≤b B and B b≤a A. 2.2 The k- SUM Problem Throughout the paper, it will be more convenient to work with a version of the k- SUM problem that is more structured than the basic formulation. This version is usually referred to as either TABLE -k- SUM or k- SUM , and is known to be equivalent to the basic formulation, up to k k factors (by a simple extension of Theorem 3.1 in [9]). For con-
8
A. Abboud and K. Lewi
venience, and since f (k) factors are ignored in our running times, we will refer to this problem as k- SUM. Definition 2 (k- SUM). Given k lists L1 , . . . , Lk each with n numbers where Li = {xi,j }j∈[n] ⊆ Z, do there exist k numbers x1,a1 , . . . , xk,ak , one from each list, such that ki=1 xi,ai = 0? In our proofs, we always denote an instance of k- SUM by L1 , . . . , Lk , where Li = {xi,j }j∈[n] ⊆ Z, so that xi,j is the j th number of the ith list Li . We define a k-solution to be a set of k numbers {xi,ai }i∈[k] , one from each list. The sum of a k-solution k {xi,ai }i∈[k] will be defined naturally as i=1 xi,ai . In [15], Pˇatras¸cu defines the CONVOLUTION -3- SUM problem. We consider a natural extension of this problem. Definition 3 (CONVOLUTION -k- SUM). Given k lists L1 , . . . , Lk each with n numbers, where Li = {xi,j }j∈[n] ⊆ Z, does there exist a k-solution {xi,ai }i∈[k] such that ak = a1 + · · · + ak−1 and ki=1 xi,ai = 0? Theorem 10 in [15] shows that 3- SUM 2≤2 CONVOLUTION -3- SUM. By generalizing the proof, we show the following useful lemma (see proof in the full version of the paper). Lemma 1. For all k ≥ 2, k- SUM
k/2≤k/2 CONVOLUTION -k- SUM .
2.3 H-Partite Graphs Let H be a subgraph on k nodes with V (H) = {h1 , . . . , hk }. Definition 4 (H-partite graph). Let G be a graph such that V (G) can be partitioned into k sets Ph1 , . . . , Phk , each containing n vertices. We will refer to these k sets as the super-nodes of G. A pair of super-nodes (Phi , Phj ) will be called a super-edge if (hi , hj ) ∈ E(H). Then, we say that G is H-partite if every edge in E(G) lies in some super-edge of G. We denote the set of vertices of an H-partite graph G by V (G) = {vi,j }i∈[k],j∈[n] , where vi,j is the j th vertex in super-node Phi . We will say that G is the complete Hpartite graph when (vi,a , vj,b ) ∈ E(G) if and only if (Phi , Phj ) is a super-edge of G, for all a, b ∈ [n]. An H-subgraph of an H-partite graph G, denoted by χ = {vi,ai }i∈[k] ⊆ V (G), is a set of vertices for which there is exactly one vertex vi,ai from each super-node Phi , where ai is an index in [n]. Given a weight function w : (V (G) ∪ E(G)) → Z for the nodes and edges of G, the total weight of the subgraph χ is defined naturally as w(vi,ai ) + w(vi,ai , vj,aj ). w(χ) = hi ∈V (H)
(hi ,hj )∈E(H)
Now, we define a more structured version of the E XACT-W EIGHT-H problem which is easier to work with.
Exact Weight Subgraphs and the k-Sum Conjecture
9
Definition 5 (The E XACT-H Problem). Given a complete H-partite graph graph G with a weight function w : (V (G) ∪ E(G)) → Z for the nodes and edges, does there exist an H-subgraph of total weight 0? In the full version of the paper, we prove the following lemma, showing that the two versions of the E XACT-W EIGHT-H problem are reducible to one another in a tight manner. All of our proofs will use the formulation of E XACT-H, yet the results will also apply to E XACT-W EIGHT-H. Note that our definitions of H-partite graphs uses ideas similar to color-coding [2]. Lemma 2. Let α > 1. E XACT-W EIGHT-H α≡α E XACT-H.
3 Reductions from k- SUM to Subgraph Problems In this section we prove Theorem 1 by proving four reductions, each of these reductions uses a somewhat different way to encode k- SUM in the structure of the subgraph. First, we give a generic reduction from k- SUM to E XACT-H for an arbitrary H on k nodes. We set the node weights of the graph to be the numbers in the k- SUM instance, in a certain way. See the full version of the paper for a detailed proof. Lemma 3 (k- SUM k/2≤k/2 E XACT-H ). Let H be a subgraph with k nodes. Then, k- SUM on n numbers can be reduced to a single instance of E XACT-H on kn vertices. We utilize the edge weights of the graph, rather than the node weights, to prove a tight reduction to k- MATCHING. See the full version of the paper for a detailed proof. Lemma 4 (k- SUM k/2≤2·k/2E XACT-k- MATCHING). Let H be the k- MATCHING subgraph. Then, k- SUM on n numbers can be reduced to a single instance of E XACT-H √ on k n vertices. Another special type of subgraph which can be shown to be tightly related to the k- SUM problem is the k-edge star subgraph. ≤ E XACT-k- STAR ). Let H be the k- STAR subgraph, k k2 k2 · k−1 and let α > 2. If E XACT-H can be solved in O(nα ) time, then k- SUM can be solved in ˜ (1−1/k)·α ) time. O(n
Lemma 5 (k- SUM
To prove the lemma we define the problem k- SUMn to be the following. Given a sequence of n k- SUM instances, each on n numbers, does there exist an instance in the sequence that has a solution of sum 0? Then, we prove two claims. The first showing that k- SUMn can be reduced to k- STAR, by associating a node in the graph with a k- SUM instance, and setting the weights of the edges incident to it to the numbers of that instance, such that each k-solution of that instance will be a k- STAR centered on that node. The second claim shows that k- SUM can be reduced to k- SUMn by showing a self reduction for k- SUM. We use a hashing scheme due to Dietzfelbinger [4], to hash the numbers into O(n1/k ) buckets with O(n1−1/k ) numbers each, such that for every
10
A. Abboud and K. Lewi
k − 1 numbers, the numbers that can complete a k-solution of sum 0 can only lie in certain k buckets. We utilize this to generate O((n1/k )k−1 ) instances of k- SUM, each with O(n1−1/k ) numbers, such that one of them will have a solution iff the original k- SUM instance had a solution. This is a k- SUMN instance, for N = O(n1−1/k ). A more detailed proof is given in the full version of the paper. Our final reduction between k- SUM and E XACT-H for a class of subgraphs H is as follows. First, define the k- PATH subgraph H to be such that V (H) = {h1 , . . . , hk } and E(H) = {(h1 , h2 ), (h2 , h3 ), . . . , (hk−1 , hk )}. ≤ E XACT-(k-1)- PATH). Let H be the k- PATH subgraph. k2 k2 If E XACT-H can be solved in time O(nk/2−ε ) for some ε > 0, then k+1- SUM can be solved in time O(nk/2−ε ), for some ε > 0.
Lemma 6 (k- SUM
Proof. We prove that an instance of CONVOLUTION -(k+1)- SUM on n numbers can be reduced to a single instance of E XACT-k- PATH, and by applying Lemma 1, this completes the proof. Given k + 1 lists L1 , . . . , Lk+1 each with n numbers as the input to CONVOLUTION -(k+1)- SUM, we will construct a complete H-partite graph G on kn nodes. For every r and s such that r − s ∈ [n], for all i ∈ [k], define the edge weights of G in the following manner. ⎧ ⎪ if i = 1 ⎨x1,r + x2,s−r , w(vi,r , vi+1,s ) = xi+1,s−r , if 1 < i < k ⎪ ⎩ xk,s−r + xk+1,s , if i = k Otherwise, if r − s ∈ [n], we set w(vi,r , vi+1,s ) = −∞ for all i ∈ [k]. Now to see the correctness of the reduction, take any H-subgraph {vi,ai }i∈[k] of G, and consider the (k + 1)-solution {xi,bi }i∈[k+1] , where b1 = a1 , bk+1 = ak , and for 2 ≤ i ≤ k, bi = ai − ai−1 . First, note that the (k + 1)-solution satisfies the property that b1 + k . . . + bk = bk+1 . Now, note that its total weight is i=1 w(vi,ai , vi+1,ai+1 ) = x1,a1 + x2,a2 −a1 + x3,a3 −a2 + . . . + xk−1,ak−1 −ak−2 + xk,ak −ak−1 + xk+1,ak = k+1 i=1 xi,bi which is exactly the sum of the (k+1)-solution. For the other direction, consider the (k+1)-solution {xi,bi }i∈[k+1] for which bk+1 = b1 + . . . + bk+1 . Then, the H-subgraph {vi,ai }i∈[k] , where ai = b1 + . . . + bi , has total weight k+1 i=1 xi,bi . Therefore, there is a k-solution of sum 0 iff there is an H-subgraph in G of total weight 0.
4 Relationships between Subgraphs In this section we outline the proof of Theorem 2 showing that E XACT-H1 can be reduced to E XACT-H2 if H1 is a vertex-minor of H2 . The complete proof is in the full version of the paper, along with an additional observation that gives a reverse reduction. We start by defining vertex-minors. Definition 6 (Vertex-Minor). A graph H1 is called a vertex-minor of graph H2 , and denoted H1 ≤vm H2 , if there exists a sequence of subgraphs H (1) , . . . , H () such that H1 = H (1) , H2 = H () , and for every i ∈ [ − 1], H (i) can be obtained from H (i+1) by either
Exact Weight Subgraphs and the k-Sum Conjecture
11
– Deleting a single edge e ∈ E(H (i+1) ), or – Contracting two nodes5 hj , hk ∈ V (H (i+1) ) to one node hjk ∈ V (H (i) ), such that N (hjk ) = N (hj ) ∪ N (hk ). To prove Theorem 2 it suffices to show how to reduce E XACT-H1 to E XACT-H2 when H1 is obtained by either a single edge deletion or a single edge contraction. The edge deletion reduction is easy, and the major part of the proof will be showing the contraction reduction. The main observation is that we can make two copies of nodes and change their node weights in a way such that any H2 -subgraph of total weight 0 that contains one of the copies will have to contain the other. This will allow us to claim that the subgraph obtained by replacing the two copies of a node with the original will be an H1 -subgraph of total weight 0.
5 Reductions to k- SUM (and Upper Bounds) In this section we explain the reduction used to prove Theorem 3. The full version of the paper has the proof of correctness, followed by a discussion of the algorithmic implications of Theorem 3, including Corollary 1, and Theorem 4. Recall the definition of a d-separator (S, H1 , . . . , Hd ) of graph H. To solve E XACT-H, we do the following. For each choice of an S-subgraph χS = {vj,aj }hj ∈S of G, we create an instance of d- SUM where the lists L1 , . . . , Ld are of size max{n|H1 | , . . . , n|Hd | }. We construct Li by iterating over each Hi -subgraph χHi = {vj,aj }hj ∈Hi and adding the total weight of the (Hi ∪ S)-subgraph χHi ∪ χS as an integer to Li . This process is repeated for each Li , and the target of the d- SUM instance is set to be w(χS ) · (d − 1). Then, if the input graph has an H-subgraph of total weight 0, then for some choice of an S-subgraph, the corresponding d- SUM instance will have a d-solution with sum equal to the target value.
6 Conclusions We conclude with two interesting open questions: 1. Perhaps the simplest subgraph for which we cannot give tight lower and upper bounds is the 5- CYCLE subgraph. Can we achieve O(n4−ε ) for some ε > 0 without breaking the k- SUM Conjecture, or can we prove that it is not possible? 2. Can we prove that E XACT-W EIGHT-4- PATH 3≤3 E XACT-W EIGHT-3- STAR? This would show that breaking the 3- SUM Conjecture will imply an O(n3−ε ) for some ε > 0 algorithm for A LL -PAIRS S HORTEST PATHS. Acknowledgements. The authors would like to thank Ryan and Virginia Williams for many helpful discussions and for sharing their insights, and Hart Montgomery for initiating the conversation that led up to this work. We would also like to thank the anonymous reviewers for their comments and suggestions. 5
The difference between our definition of vertex-minor and the usual definition of a graph minor is that we allow contracting two nodes that are not necessarily connected by an edge.
12
A. Abboud and K. Lewi
References 1. Ailon, N., Chazelle, B.: Lower bounds for linear degeneracy testing. J. ACM 52(2), 157–171 (2005) 2. Alon, N., Yuster, R., Zwick, U.: Color-coding. J. ACM 42(4), 844–856 (1995) 3. Baran, I., Demaine, E.D., Pˇatras¸cu, M.: Subquadratic algorithms for 3SUM. Algorithmica 50(4), 584–596 (2008); In: Dehne, F., L´opez-Ortiz, A., Sack, J.-R. (eds.) WADS 2005. LNCS, vol. 3608, pp. 409–421. Springer, Heidelberg (2005) 4. Dietzfelbinger, M.: Universal hashing and k-wise independent random variables via integer arithmetic without primes. In: Puech, C., Reischuk, R. (eds.) STACS 1996. LNCS, vol. 1046, pp. 569–580. Springer, Heidelberg (1996) 5. Downey, R.G., Fellows, M.R.: Fixed-parameter tractability and completeness ii: On completeness for w[1] (1995) 6. Eisenbrand, F., Grandoni, F.: On the complexity of fixed parameter clique and dominating set. Theor. Comput. Sci. 326(1-3), 57–67 (2004) 7. Erickson, J.: Lower bounds for linear satisfiability problems. In: Clarkson, K.L. (ed.) SODA, pp. 388–395. ACM/SIAM (1995) 8. Fomin, F.V., Lokshtanov, D., Raman, V., Saurabh, S., Raghavendra Rao, B.V.: Faster algorithms for finding and counting subgraphs. J. Comput. Syst. Sci. 78(3), 698–706 (2012) 9. Gajentaan, A., Overmars, M.H.: On a class of o(n2 ) problems in computational geometry. Computational Geometry 5(3), 165–185 (1995) 10. Itai, A., Rodeh, M.: Finding a minimum circuit in a graph. In: STOC 1977, pp. 1–10. ACM, New York (1977) 11. Jafargholi, Z., Viola, E.: 3sum, 3xor, triangles. Electronic Colloquium on Computational Complexity (ECCC) 20, 9 (2013) 12. Kloks, T., Kratsch, D., M¨uller, H.: Finding and counting small induced subgraphs efficiently. Inf. Process. Lett. 74(3-4), 115–121 (2000) 13. Kowaluk, M., Lingas, A., Lundell, E.-M.: Counting and detecting small subgraphs via equations and matrix multiplication. In: SODA 2011, pp. 1468–1476. SIAM (2011) 14. Neetil, J., Poljak, S.: On the complexity of the subgraph problem. Commentationes Mathematicae Universitatis Carolinae 026(2), 415–419 (1985) 15. Pˇatras¸cu, M.: Towards polynomial lower bounds for dynamic problems. In: Proc. 42nd ACM Symposium on Theory of Computing (STOC), pp. 603–610 (2010) 16. Pˇatras¸cu, M., Williams, R.: On the possibility of faster sat algorithms. In: Proc. 21st ACM/SIAM Symposium on Discrete Algorithms (SODA), pp. 1065–1075 (2010) 17. Vassilevska, V., Williams, R.: Finding, minimizing, and counting weighted subgraphs. In: Mitzenmacher, M. (ed.) STOC, pp. 455–464. ACM (2009) 18. Williams, R.: Finding paths of length k in o* (2k ) time. Inf. Process. Lett. 109(6), 315–318 (2009) 19. Williams, V.V., Williams, R.: Subcubic equivalences between path, matrix and triangle problems. In: FOCS, pp. 645–654. IEEE Computer Society (2010)