• No results found

Finding a Triangle in a Graph

Finally we consider a related search problem, which is to find a triangle in a labeled graph, provided one exists. Consider again the setting for computing graph properties of Section 2.7.3. There is an undirected graph G = (V, E) on

|V | = n nodes with |E| = m edges. There are N =¡n

2

¢edge slots for the elements of E, which we can query as in Section 2.7.3. The triangle-finding problem is the following:

Triangle-finding problem

Given undirected labeled graph G = (V, E), find distinct vertices a, b, c∈ V such that (a, b), (a, c), (b, c)∈ E.

Since there are¡n

3

¢< n3triples a, b, c, and we can decide whether a given triple is a triangle using 3 queries, we can use Grover’s algorithm to find a triangle in O(n3/2) queries. Below we give an algorithm that works more efficiently for sparse graphs.

Algorithm Triangle-finder

Apply amplitude amplification on steps 1–2:

1. Quantum search for an edge (a, b)∈ E among all ¡n

2

¢ potential edges.

2. Quantum search for a node c∈ V such that a, b, c is a triangle.

Step 1 takes O(p

n2/m) queries and step 2 takes O(√

n) queries. If there is a triangle in the graph, then the probability that step 1 finds an edge belonging to this specific triangle is Θ(1/m). If step 1 indeed finds an edge of a triangle, then with probability at least 1/2, step 2 finds a c that completes the triangle.

Thus the success probability of steps 1–2 is Θ(1/m) and the overall amplitude amplification requires O(√

m) iterations of steps 1–2. The total complexity is

4.6. Summary 75 thus O((p

n2/m +√ n)√

m) = O(n + √

nm). If G is sparse in the sense that m = |E| ∈ o(n2), then o(n3/2) queries suffice. Of course for dense graphs our algorithm will still require Θ(n3/2) queries.

We again obtain lower bounds by a reduction from the ORN-problem. Con-sider an ORN-input x ∈ {0, 1}(n2) as a graph on n nodes. Let G be the graph obtained from this by adding an (n + 1)st node and connecting this to all other n nodes. Now G has|x| + n edges, and ORN(x) = 1 iff G contains a triangle. This gives Ω(n2) bounds for exact quantum algorithms and bounded-error classical algorithms, and an Ω(n) bound for bounded-error quantum algorithms. We have shown:

4.5.1. Theorem (BDHHMSW [45]). If Ω(n) ≤ |E| ≤ ¡n

2

¢, then the quantum query complexity of triangle-finding is

• Ω(n) ≤ Q2(Triangle)≤ O(n +√ nm)

• QE(Triangle)∈ Θ(n2)

where n =|V | and m = |E| for the input graph G = (V, E).

Note that for graphs with Θ(n) edges, the bounded-error quantum bound becomes Θ(n) queries, whereas the classical bound remains Θ(n2). Thus we have a quadratic gap for such very sparse graphs.

4.6 Summary

The claw-finding problem is: given functions f and g, find x, y such that f (x) = g(y). We gave a quantum algorithm that finds a collision between arbitrary functions f and g having a domain of size N . The algorithm uses about N3/4 comparisons. This implies an N3/4 algorithm for both the problem of finding a collision in a single function and for the element distinctness problem (which is:

are all elements on a list of N numbers distinct?). This shows that for a quantum computer, element distinctness is significantly easier than sorting (which takes Ω(N log N ) comparisons classically as well as quantumly) and contrasts with the classical case, where both sorting and element distinctness require about N log N comparisons. The main problem left open by this chapter is to close the gap between upper and lower bounds for element distinctness. An interesting direction could be to take into account simultaneously time complexity and space complexity, as has been done for classical algorithms in e.g. [166, 2, 18].

Chapter 5

Average-Case and Non-Deterministic Query Complexity

This chapter is based on the papers

• A. Ambainis and R. de Wolf. Average-Case Quantum Query Complexity. In Proceedings of 17th Annual Symposium on Theoretical Aspects of Computer Science (STACS 2000), LNCS 1770, pages 133–144, Springer, 2000. Journal version to appear in the Journal of Physics A, 2001.

• R. de Wolf. Characterization of Non-Deterministic Quantum Query and Quantum Communication Complexity. In Proceedings of 15th IEEE An-nual Conference on Computational Complexity (CCC 2000), pages 271–278, 2000.

5.1 Introduction

The interest in quantum computers mainly derives from the fact that they are much faster (or in some other way better) than classical computers for some inter-esting problems—sometimes even exponentially faster. As we saw in Chapter 1, virtually all existing quantum algorithms work in the query complexity model. In Chapter 2 we proved the somewhat disappointing result that the maximal possi-ble quantum speed-up in this model is only polynomial, for all total functions. In other words, in the standard model of query complexity, exponential speed-ups can only be attained for specific promise-problems, like Simon’s and Shor’s. In this chapter we analyze two other common computational models—average-case complexity and non-deterministic complexity—and prove that in both of these models there are total functions for which quantum algorithms require at least exponentially fewer queries than classical algorithms.

In our query complexity setting, average-case complexity concerns the ex-pected number of queries needed to compute some function f when the input is

77

distributed according to some given probability distribution µ. If the hard inputs (i.e., those requiring many queries) receive little µ-probability, then average-case complexity can be significantly smaller than worst-case complexity. Let Dµ(f ), Rµ2(f ), and Qµ2(f ) denote the average-case analogues of the worst-case complex-ities D(f ), R2(f ), and Q2(f ), respectively, to be defined more precisely in the next section. By definition we have Qµ2(f ) ≤ Rµ2(f ) ≤ Dµ(f ); the objective of the following sections is to compare these measures and to investigate the possible gaps between them. Our main results for average-case complexity are:

• Under the uniform distribution µ, there is a total function f such that Qµ2(f ) is exponentially less than Rµ2(f ). Thus the polynomial relation that holds between quantum and classical query complexities in the case of worst-case complexity (Theorem 2.5.15) does not carry over to the average-case setting.

• Under non-uniform µ the gap can be even larger: we give distributions µ where Qµ2(ORN) is constant, whereas Rµ2(ORN) is almost √

N .

• For the MAJORITY-function under uniform µ, we have Qµ2(MAJN) ∈ O(√

N (log N )2) and Qµ2(MAJN) ∈ Ω(√

N ). In contrast, Rµ2(MAJN) ∈ Ω(N ).

In the second part of the chapter we deal with non-deterministic complexity.

We define a non-deterministic algorithm for a Boolean function f as an algorithm that has positive acceptance probability if f (x) = 1 and that has acceptance prob-ability 0 if f (x) = 0 (other definitions of non-deterministic complexity are possible and will be discussed below). We use N (f ) and N Q(f ) for the non-deterministic query complexity of f on classical and quantum computers, respectively. While the classical complexity N (f ) equals the certificate complexity C(1)(f ), we prove that the quantum complexity N Q(f ) equals the minimal degree of a so-called non-deterministic polynomial for f , up to a factor of 2. This contrasts with the standard model of computation, where the quantum complexities are polynomi-ally related to the respective degrees (Section 2.5)

deg(f )

2 ≤ QE(f )≤ 2 deg(f)4 and gdeg(f )

2 ≤ Q2(f )≤ 512 gdeg(f )6, but where a linear relation is not known to hold (nor not to hold). We also exhibit a total function f on N variables with a very large gap between quantum and classical non-deterministic complexity: N Q(f ) = 1 and N (f ) = N . This is the largest possible gap allowed by the query complexity model.