A quantum query algorithm for the graph collision problem
We construct a new quantum algorithm for the graph collision problem; that is, the problem of deciding whether the set of marked vertices contains a pair of adjacent vertices in a known graph . The query complexity of our algorithm is , where is the number of vertices and is the maximum total degree of the vertices in an independent set of . Notably, if is a random graph where every edge is present with a fixed probability independently of other edges, then our algorithm requires queries on most graphs, which is optimal up to the factor on most graphs.
The quantum query complexity of a function is a natural counterpart of its classical query complexity; namely, it is the number of quantum oracle calls that an algorithm has to make in order to compute its value. Grover’s search algorithm [Gro96] gave the first example of a function whose quantum query complexity is significantly smaller than classical: computing the value of the OR function requires classical queries, but only quantum queries.
It has been shown by Bennett et al. [BBBV97] that Grover’s algorithm is optimal for computing the OR function. Later, Beals et al. [BBC01] proved that no total function can have the gap between its quantum and classical query complexities larger than polynomial.
Another important problem where a quantum query algorithm can be much faster than a classical one is the element distinctness problem, where elements are “colored” by an oracle and the goal is to decide whether there are at least two elements of the same color. In 2001 Buhrman et al. [BDH05] constructed an algorithm that required quantum queries, later a lower bound of was shown by Aaronson and Shi [AS04]. Finally, in 2003 Ambainis [Amb07] gave a new algorithm that had query complexity , thus matching the lower bound.
The graph collision problem was first considered by Magniez et al. [MSS07], where it was shown to have quantum query complexity . The algorithm used in [MSS07] can be viewed as a natural adaptation of Ambainis’ algorithm for the element distinctness problem. On the other hand, the lower bound techniques used in [AS04] don’t seem to be applicable to the graph collision problem, and the actual quantum query complexity of it is still an open question.
1.1 Our results and techniques
We present a new quantum algorithm for the graph collision problem. The complexity of our algorithm depends on the properties of the given graph . Throughout the paper, the quantum query complexity of a decision problem refers to that with a constant two-sided error.
For a graph on vertices, the quantum query complexity of the graph collision problem on is , where is the maximum total degree of the vertices in an independent set of .
Notably, this implies that the graph collision problem requires only quantum queries for most graphs in the following sense. Let be the distribution corresponding to choosing a graph on vertices, where every edge is present with probability independently of other edges.
For arbitrary function , let . Then the (worst-case) quantum query complexity of the graph collision problem on is almost always111Cf. Theorem 9 for the corresponding quantitative statement. .
The above result is optimal up to the factor for most random graphs, as computing the OR of variables can be reduced to solving the graph collision problem on any graph that contains non-isolated vertices.
Our algorithm for Theorem 1 works as follows. As a preprocessing, we estimate the sum of the degrees of the vertices in . If this sum is much larger than , then we answer “ is not an independent set” and halt. This requires queries, due to the approximate counting algorithm by Brassard, Høyer, and Tapp [BHT98]. To handle the remaining (main) case, we construct a span program with witness size . It was shown by Reichardt [Rei09, Rei11] that the quantum query complexity of a promise decision problem is at most a constant factor away from the witness size of a span program computing it.
1.2 Related work
Magniez, Santha, and Szegedy [MSS07] introduced the graph collision problem and gave a quantum algorithm with queries. They used it as a subroutine used in their -query algorithm for the triangle finding problem. This is the best known upper bound on the quantum query complexity of the graph collision problem. The best known lower bound for the graph collision problem is , which follows easily from the lower bound for the search problem [BBBV97]. Jeffery, Kothari, and Magniez [JKM12] recently gave a quantum algorithm for the graph collision problem on a bipartite graph which is useful when the given bipartite graph is close to the complete bipartite graph: the query complexity of their algorithm is , where is the number of missing edges compared to the complete bipartite graph.
Improving the query complexity of the graph collision problem has important consequences. First, improving it is likely to give a better algorithm for the triangle finding problem by applying the same technique as the one used in Ref. [MSS07]. Second, the graph collision problem is equivalent to the evaluation of a 2-DNF formula, and the techniques used in the graph collision problem may be also applicable to the more general -DNF evaluation.
Our algorithm for the main case of the graph collision problem, including its use of span programs, is inspired by the recent result by Belovs and Lee [BL11].
We will consider the quantum query complexity of the following problem.
Definition 1 (Graph collision problem).
Let be a graph. The graph collision problem on asks, given oracle access to a string , whether there exists an edge such that .
Note that graph is given explicitly to the algorithm, and the only part of the input which needs to be queried is the string . We call a vertex marked if . Note that the graph collision problem is equivalent to deciding whether the marked vertices form an independent set in , with the answers “yes” and “no” swapped.
In the rest of the paper, we let , where denotes the set . For a graph and a set of vertices, we denote by the sum of degrees of vertices in . For any graph , we denote by the maximum total degree of the vertices in an independent set of ; that is,
We will use the following form of Chernoff bound, as stated by Drukh and Mansour [DM05].
Lemma 3 (Chernoff bound).
Let be mutually independent random variables taking values in , such that for all . Then for any ,
All logarithms in this paper are natural.
2.1 Span programs
Span program is a linear-algebraic model of computation introduced by Karchmer and Wigderson [KW93] to study the computational power of counting in branching programs and space-bounded computation. In our context, the relevant complexity measure is its witness size introduced by Reichardt and Špalek [RŠ08]. We use a formulation closer to that used by Reichardt [Rei09].
Definition 2 (Span program).
A span program with -bit input is defined by a finite-dimensional Hilbert space over , a vector , and a finite set for each and each . This span program is said to compute a function , where , when for , we have if and only if lies in the subspace of spanned by . The vector is called the target vector of this span program .
Definition 3 (Witness size of a span program).
Let be a span program as in Definition 2.
For an input , a witness for is an -tuple of mappings , where , such that . The witness size on input , denoted by , is defined as
For an input , a witness for is a vector such that and for every . This time, the witness size on input , again denoted by , is defined as
The witness size of this span program is .
Finally, we denote by the minimum witness size of a span program which computes .
For a function , where , we denote by the quantum query complexity of with two-sided error probability at most . As is well known, changing the error probability to other constants less than affects the query complexity only within a constant factor.
Let , where . Then and coincide up to a constant factor. That is, there exists a constant which does not depend on or such that .
2.2 Quantum algorithm for approximate counting
To detect the case where marked vertices have too many edges, we will use the following result by Brassard, Høyer, and Tapp [BHT98, Theorem 5].
Theorem 5 (Approximate counting [Bht98]).
There exists a quantum algorithm which, given integers (domain size) and (precision) and oracle access to a function satisfying , makes queries to the oracle and outputs an integer , such that
with probability at least .
We can remove the assumption that by doubling the size of the domain, and we can reduce the error probability to an arbitrarily small constant by repeating the algorithm constantly many times and taking the majority vote:
Let be a constant. Then there exists a quantum algorithm which, given integers (domain size) and (precision) and oracle access to a function , makes queries to the oracle and outputs an integer satisfying the following. Let . Then it holds that
with probability at least . (The constant factor hidden in the -notation of the number of queries depends only on and not on , , or .)
3 Algorithm for the main case
The following lemma is useful in the case where not too many edges are incident to marked vertices. In the next section, we will use it with to prove Theorem 1.
Let be a graph on vertices, and let . Consider the special case of the graph collision problem on where it is promised that the set of marked vertices satisfies .
There exists a span program for this promise problem whose witness size is at most .
There exists a quantum algorithm for this promise problem with two-sided error probability at most whose query complexity is .
Item (ii) follows immediately from item (i) and Theorem 4. In the rest of the proof, we will prove item (i) by constructing a span program explicitly.
Let , and let
For and , let . Let and , where is the set of neighbors of vertex in graph . Define a span program as .
It is easy to see that computes the promise problem stated in the lemma. Indeed, if , then there exists an edge such that . Therefore, and , which implies that . On the other hand, if , then is a witness for . Indeed, , if , and if and .
From these witnesses, the witness size of can be bounded easily. If , then the witness stated above shows that the witness size for is at most . If , then the witness stated above shows that the witness size for is at most . ∎
4 Preprocessing and overall algorithm
In this section, we will prove Theorem 1.
Consider the following quantum algorithm.
Compute . Let . (Because this step does not use any queries to , how is computed does not matter as long as the query complexity is concerned.)
(Preprocessing.) Estimate the number of pairs such that and by running the approximate counting algorithm in Corollary 6 with error probability and precision parameter . If the result of counting satisfies , then answer “yes” and halt. Otherwise, proceed to the next step.
(Main case.) Run the algorithm in Lemma 7 (ii) using error probability and parameter , and answer “yes” or “no” accordingly.
Step 1 does not make any queries to . Step 2 makes queries. Step 3 makes queries. Therefore, the query complexity of the whole algorithm is .
In the rest of this section, we will show that this algorithm reports an incorrect answer with probability at most by considering the following three cases: (a) the correct answer is “yes” and , (b) the correct answer is “yes” and , (c) the correct answer is “no.”
If the correct answer is “yes” and , the only step where the algorithm reports an incorrect answer is step 3, and the promise of the algorithm in Lemma 7 (ii) is satisfied. Therefore, the error probability is at most .
If the correct answer is “yes” and , then with probability at least , satisfies that
Therefore, the algorithm reports “yes” in step 2 alone with probability at least . In this case, the promise of the algorithm in Lemma 7 (ii) is not satisfied, but it does not matter what step 3 reports.
Finally, consider the case where the correct answer is “no.” In this case, both steps 2 and 3 can report an incorrect answer, and we will bound each of these probability by . The correct answer being “no” means that the set of marked vertices is an independent set of , and therefore it holds that by the definitions of and . This implies that with probability at least , satisfies that
Therefore, step 2 reports in an incorrect answer with probability at most . Moreover, because the promise of the algorithm in Lemma 7 (ii) is satisfied, step 3 reports an incorrect answer with probability at most . By union bound, the overall error probability is at most .
5 The case of random graphs
In this section we analyze the query complexity of the graph collision problem defined over random graphs. Recall that we denote by the distribution of random graphs on vertices, where every edge is present with probability , independently of other edges.
We need the following combinatorial lemma.
For arbitrary and ,
Assume . For any , let be the expected number of independent sets that satisfy . Clearly,
and therefore we want an upper bound on .
For any it holds that
Let , to be fixed later. Then
where the last inequality follows from Lemma 3.
Fix . Then, noting , it holds that
and we continue:
The result follows. ∎
There exists a universal constant such that for any , and the following holds. For , the probability that the (worst-case) quantum query complexity of the graph collision problem on is greater than is at most .
6 Concluding remarks
We gave a quantum algorithm for the graph collision problem on graph on vertices whose query complexity is bounded as in terms of the maximum sum of degrees of the vertices in an independent set of . We used this to show that the graph collision problem has quantum query complexity for almost all graphs if a graph is chosen at random so that each edge is present with a fixed probability independently of other edges.
We conclude by stating a few open problems. Clearly improving the algorithm so that its query complexity becomes for all graphs is an important open problem. As another direction, the graph collision problem can be defined also for hypergraphs, and it is used in an algorithm for the subgraph finding problem [MSS07], a natural generalization of the triangle finding problem. Extending the present algorithm to the case of hypergraphs is another open problem.
Dmitry Gavinsky is grateful to Ryan O’Donnell, Rocco Servedio, Srikanth Srinivasan and Li-Yang Tan for helpful discussions. The authors acknowledge support by ARO/NSA under grant W911NF-09-1-0569.
- [Amb07] Andris Ambainis. Quantum walk algorithm for element distinctness. SIAM Journal on Computing, 37(1):210–239, 2007. arXiv:quant-ph/0311001v8.
- [AS04] Scott Aaronson and Yaoyun Shi. Quantum lower bounds for the collision and the element distinctness problems. Journal of the ACM, 51(4):595–605, 2004. arXiv:quant-ph/0112086v1.
- [BBBV97] Charles H. Bennett, Ethan Bernstein, Gilles Brassard, and Umesh Vazirani. Strengths and weaknesses of quantum computing. SIAM Journal on Computing, 26(5):1510–1523, 1997. arXiv:quant-ph/9701001v1.
- [BBC01] Robert Beals, Harry Buhrman, Richard Cleve, Michele Mosca, and Ronald de Wolf. Quantum lower bounds by polynomials. Journal of the ACM, 48(4):778–797, 2001. arXiv:arXiv:quant-ph/9802049v3.
- [BDH05] Harry Buhrman, Christoph Dürr, Mark Heiligman, Peter Høyer, Frédéric Magniez, Miklos Santha, and Ronald de Wolf. Quantum algorithms for element distinctness. SIAM Journal on Computing, 34(6):1324–1330, 2005. arXiv:quant-ph/0007016v2.
- [BHT98] Gilles Brassard, Peter Høyer, and Alain Tapp. Quantum counting. In Automata, Languages and Programming: 25th International Colloquium, ICALP’98: Proceedings, volume 1443 of Lecture Notes in Computer Science, pages 820–831, 1998. arXiv:quant-ph/9805082v1.
- [BL11] Aleksandrs Belovs and Troy Lee. Quantum algorithm for -distinctness with prior knowledge on the input. arXiv:1108.3022v1 [quant-ph], 2011.
- [DM05] Evgeny Drukh and Yishay Mansour. Concentration bounds for unigram language models. Journal of Machine Learning Research, 6(Aug):1231–1264, 2005.
- [Gro96] Lov K. Grover. A fast quantum mechanical algorithm for database search. In Proceedings of the 28th Annual ACM Symposium on Theory of Computing (STOC), pages 212–219, 1996. arXiv:quant-ph/9605043v3.
- [JKM12] Stacey Jeffery, Robin Kothari, and Frédéric Magniez. Improving quantum query complexity of Boolean matrix multiplication using graph collision. arXiv:1112.5855v2 [quant-ph], 2012.
- [KW93] Mauricio Karchmer and Avi Wigderson. On span programs. In Proceedings of the 8th Annual Structure in Complexity Theory Conference (CoCo), pages 102–111, 1993.
- [MSS07] Frédéric Magniez, Miklos Santha, and Mario Szegedy. Quantum algorithms for the triangle problem. SIAM Journal on Computing, 37(2):413–424, 2007. arXiv:quant-ph/0310134v3.
- [Rei09] Ben W. Reichardt. Span programs and quantum query complexity: The general adversary bound is nearly tight for every boolean function. In 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 544–551, 2009. arXiv:0904.2759v1 [quant-ph].
- [Rei11] Ben W. Reichardt. Reflections for quantum query algorithms. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 560–569, 2011. arXiv:1005.1601v1 [quant-ph].
- [RŠ08] Ben W. Reichardt and Robert Špalek. Span-program-based quantum algorithm for evaluating formulas. In Proceedings of the 40th Annual ACM Symposium on Theory of Computing (STOC), pages 103–112, 2008. arXiv:0710.2630v3 [quant-ph].