Quantum Walks and Electric Networks
We prove that a quantum walk can detect the presence of a marked element in a graph in steps for any initial probability distribution on vertices. Here, is the total weight of the graph, and is the effective resistance. This generalizes the result by Szegedy  that is only applicable if the initial distribution is stationary. We describe a time-efficient quantum algorithm for 3-distinctness based on these ideas.
Quantum walks are of great importance in quantum algorithms. For instance, quantum walk on the Johnson graph has been used in many applications: -distinctness and -sum problems [4, 14], triangle detection in a graph given by its adjacency matrix [25, 19], matrix product verification , restricted range associativity , and others. For more examples, refer to the survey papers by Ambainis , Kempe , or Santha .
In this paper, we deal with the problem of detecting marked vertices in a graph. Two main paradigms for this task, Szegedy-type quantum walks  and MNRS quantum walks , assume the walk is started in the stationary distribution. In particular, Szegedy showed that the presence of a marked vertex can be determined in steps of the quantum walk where is the average classical hitting time. But starting in the stationary distribution can be a strong limitation if the graph is complex or not given in advance. The main result of this paper is the generalization of the algorithm by Szegedy to arbitrary initial distribution. In order to do so, we add two new ingredients to the analysis of Szegedy-type quantum walks:
- Electric Networks.
- Effective Spectral Gap Lemma.
The effective spectral gap lemma is a very simple and powerful tool in the analysis of spectral properties of a special kind of unitary transformations . This lemma has been used to prove the optimality of the adversary bound for quantum state conversion , and for the implementation of span programs as quantum algorithms . We show that the lemma can be also applied for general quantum walks.
We show two examples of application of this quantum walk. In Section 4, we show how a general learning graph  can be implemented as a quantum walk. In Section 5, we use these ideas in a time-efficient quantum algorithm for -distinctness. The last example is interesting as a quantum walk on a graph not given in advance. This is at the very heart of classical random walks: Since only local information is required to implement a random walk, they are often used to traverse graphs whose global structure is unknown (see, e.g., [2, 29]). Quantum walks require more global information than the classical ones, and they are usually used for graphs known in advance like for the Johnson graph mentioned above.
We hope the ideas presented in this paper will be useful for implementing other quantum walks. Possible candidates could be time-efficient implementations of learning graphs and quantum analogues of random-walk-based algorithms.
The remaining part of the paper is organized as follows. In Section 2, we recall the relations between classical hitting time and electric resistance of a graph, and some tools from quantum algorithms. In Section 3, we prove the main result, and in Section 4, give an application to learning graphs. In Section 5, we apply the new quantum walk algorithm for the 3-distinctness problem.
2.1 Random Walks and Electric Networks
Let be a simple undirected graph with each edge assigned a weight . Let be the total weight. Consider the following random walk on : If the walk is at a vertex , proceed to a vertex with probability proportional to , i.e., . The random walk has a stationary probability distribution given by . One step of the random walk leaves unchanged.
Let be an initial probability distribution on the vertices of the graph, and let be some set of marked vertices. We are interested in the hitting time of the random walk: the expected number of steps of the random walk required to reach a vertex in when the initial vertex is sampled accordingly to . If is concentrated in a vertex , or consists of a single element , we often replace by or by . For instance, we have . We usually assume that and are known, and the task is to determine whether is non-empty by performing the random walk.
Assume is non-empty, and define a flow on from to as a real-valued function on the (oriented) edges of the graph satisfying the following conditions. At first, . Next, for each non-marked vertex , the flow satisfies
That is, units of the flow are injected into , it traverses through the graph, and is removed in a marked vertex. Define the energy of the flow as
Clearly, the value of (2) does not depend on the orientation of each . The effective resistance is the minimal energy of a flow from to . For , as for , we also replace and by the corresponding singletons. The resistance equals the energy dissipated by the electric flow where the edges have conductance , units of the current are injected into each , and then collected in . The following two results can be easily obtained from the results in Ref. :
If , , are as above, , are two vertices of , , and is the stationary distribution on , then
the commute time between and , , equals ;
the average hitting time equals .
We show that we obtain a quadratic improvement in the quantum case: If and are known in advance and the superposition is given, the presence of a marked vertex in can be determined in steps of the quantum walk. By combining this result with the second statement of Theorem 1, we obtain the main result of the paper by Szegedy .
2.2 Tools from Quantum Computing
We assume the reader is familiar with the basics of quantum computation  and query complexity . Although we use the language of electric networks to state our results, our algorithms still use spectral properties of unitary transformations. We start with a result we use to prove the existence of a spectral gap, and then we review how to detect it.
Lemma 2 (Effective Spectral Gap Lemma ).
Let and be two orthogonal projectors in the same vector space, and and be the reflections about their images. Assume , where , is the orthogonal projector on the span of the eigenvectors of with eigenvalues such that . Then, for any vector in the kernel of , we have
Assume a unitary is given as a black box. There exists a quantum algorithm that, given an eigenvector of with eigenvalue , outputs a real number such that with probability at least . Moreover, the algorithm uses controlled applications of and other elementary operations.
3 Quantum Walk
In this section, we construct a quantum counterpart of the random walk in Section 2.1. The quantum walk differs slightly from the quantum walk by Szegedy. The framework of the algorithm goes back to , and Lemma 2 is used to analyse its complexity. We assume the notations of Section 2.1 throughout the section.
It is customary to consider quantum walks on bipartite graphs. We keep with this tradition, and assume the graph is bipartite with parts and . Also, we assume the support of is contained in , i.e., for all . These are not very restrictive assumptions: If either of them fails, consider the bipartite graph with the vertex set , the edge set , edge weights , the initial distribution , and the set of marked vertices . Then, for the new graph, , and .
We assume the quantum walk starts in the state that is known in advance. Also, we assume there is an upper bound known on the effective resistance from to for all possible sets of marked states that might appear.
Now we define the vector space of the quantum walk. Let be the support of , i.e., the set of vertices such that . The vectors form the computational basis of the vector space of the quantum walk. Let denote the local space of , i.e., the space spanned by for and if . We have that equals the whole space of the quantum walk, and equals the subspace spanned by the vectors for .
The step of the quantum walk is defined as where and are the direct sums of the diffusion operations. Each is a reflection operation in . Hence, all in or commute, that makes them easy to implement in parallel. They are as follows:
If a vertex is marked, then is the identity, i.e., the reflection about ;
If is not marked, then is the reflection about the orthogonal complement of in , where
for some constant . This also holds for : For them, the first term in (3) disappears.
Algorithm 1 detects the presence of a marked vertex with probability at least . The algorithm uses steps of the quantum walk.
The second statement follows immediately from Theorem 3. Let us prove the correctness. If a vertex in the initial distribution is marked with probability at least , then this is detected at Step 3 with the same probability, and we are done. So, assume this probability is less than , and the measurement outcome on Step 3 is ‘not marked’. Then, the state of the algorithm collapses to a state with the support disjoint from , and . Thus, we further assume is disjoint from .
Let us consider Steps 5—8 of the algorithm. We start with the positive case. Let be a flow from to with energy at most . At first, using the Cauchy-Schwarz inequality and that is disjoint from , we get
Now, we construct an eigenvalue-1 eigenvector
of having large overlap with (assume the orientation of each edge is from to .) Indeed, by (1), is orthogonal to all , hence, is invariant under the action of both and . Moreover, , and . Since we assumed , we get that the normalized vector satisfies
Now consider the negative case. Let be defined by
Let and be the projectors on the invariant subspaces of and , respectively. Since , we get that and . Hence, by Lemma 2, we have that, if
for some constant , then the overlap of with the eigenvectors of with phase less than is at most . Comparing this with (5), we get that it is enough to execute phase estimation with precision if and are large enough. Also, assuming , we get by (4). ∎
4 Application: Learning Graphs
As a simple example, we consider an alternative way of implementing learning graphs . Originally, learning graphs were implemented via the dual adversary bound  that is later transformed into a quantum walk [27, 23]. Although this gives a query-efficient implementation, the time-efficiency of this approach is rather unsatisfactory.
Hence, from the perspective of time-efficiency, it would be preferable to implement a learning graph as a quantum walk directly. There was one attempt of doing so in Ref. . The authors use an MNRS-type quantum walk , and give quantum walks corresponding to a number of previously developed learning graphs. We, however, use the Szegedy-type quantum walk, and our construction is valid for an arbitrary learning graph.
A learning graph can be defined as a special case of a quantum walk from Section 3. A learning graph computes a function with . Vertices of the graph are subsets of , and the allowed edges are only between vertices and for some and . The initial distribution is concentrated on the vertex . For each positive input , a vertex is marked if and only if it contains a 1-certificate for , i.e., for all such that . The complexity of the learning graph is defined as in the notations of Section 2.1. It is known  that then the quantum query complexity of is . We show this again using a quantum walk from Section 3.
The learning graph is a bipartite graph: the part contains all vertices of even cardinality, and the part contains all vertices of odd cardinality. Also, the support of is concentrated in . Hence, the algorithm from Section 3 can be applied, and the presence of a marked vertex can be detected in steps of the quantum walk. It suffices to show that one step of the quantum walk can be implemented in quantum queries.
This can be done using standard techniques. Let be an input to given as an oracle. The quantum walk has two registers: the data register , and the coin register . The first register can be in a state for some . The register contains the description of the subset , the values of for , and some ancillary information. Because of the interference, it is important that is always represented in exactly the same way that only depends on and the input string . The second register stores an element . An element of the computational basis represents the edge of the learning graph connecting subsets and , where is the symmetric difference. Additionally, there is the state for the initial distribution.
The step of the quantum walk is performed as follows. Start with a superposition of and the states of the form with in . At first, perform the reflection as described in Section 3. It is possible to detect whether is marked by considering the values stored in , and does not depend on the input. Hence, this operation does not require any oracle queries. Next, apply the update operation that maps into . This represents the same edge, but with the content of the data register in . The update operation requires one oracle query in order to compute or uncompute . After that, perform similarly to , and apply the update operation once more. Hence, one step of the quantum walk requires oracle queries, and can be computed in quantum queries.
5 Application: 3-distinctness
In Section 4, we demonstrated that the quantum walk algorithm from Section 3 can be used to implement learning graphs. In this section, we show an application that uses techniques unavailable for ordinary learning graphs.
Consider the -distinctness problem (the definition follows shortly). The first quantum algorithm for this problem was constructed by Ambainis  using quantum walk on the Johnson graph. This requires queries and can be implemented in the same time complexity up to polylogarithmic factors. For , it is tight .
Recently, the query complexity of the problem was improved to using a generalized learning graph approach . For , it gives queries. However, it is unknown how to implement the algorithm time-efficiently. In this section, we describe a quantum algorithm for 3-distinctness having the same time complexity up to polylogarithmic factors. This is a different algorithm from Ref. , and is based on ideas from Ref. . Formally, we prove the following result.
The 3-distinctness problem can be solved by a quantum algorithm in time using quantum random access quantum memory (QRAQM) of size .
Recall that the Ambainis’ algorithm consists of two phases: the set-up phase that prepares the uniform superposition, and the quantum walk itself. Our algorithm also consists of these two phases. Moreover, for , it is exactly the Ambainis’ algorithm. Interestingly, in our case, the analysis of the quantum walk is quite simple, and can be easily generalized to any . It is the set-up phase that is hard to generalize. The case of has a relatively simple ad hoc solution that we describe in Section 5.3.
During the preparation of the paper, we learned about an alternative time-efficient quantum algorithm for the 3-distinctness problem by Andrew Childs, Stacey Jeffery, Robin Kothari and Frédéric Magniez (personal communication). They use an MNRS-type quantum walk. Their algorithm has a similar set-up phase as ours, but a more complicated quantum walk phase, that is hard to generalize to arbitrary .
We start the section with some notations and algorithmic primitives we need for our algorithm. For more detail on the implementation of these primitives, refer to the paper by Ambainis . Although this paper does not exactly give the primitives we need, it is straight-forward to apply the necessary modifications, so we don’t go into the detail.
Some parts of our algorithm work for the general -distinctness problem, so we describe the notation for this problem. We are given a string . A subset of size is called an -collision iff for all . In the -distinctness problem, the task is to determine whether the given input contains a -collision. Inputs with a -collision are called positives, the remaining ones are called negative.
Without loss of generality, we may assume that any positive input contains exactly one -collision. Otherwise, one can first try random subinstances of the problem, and this reduction can be made time-efficient . Also, we may assume there are -collisions by extending the input with dummy elements.
For a subset and , let denote the set of such that . Denote , and call the type of .
Our main technical tool is a dynamical quantum data structure that maintains a subset and the values for . We use notation to denote a register containing the data structure for a particular choice of .
The data structure is capable of performing a number of operations in polylogarithmic time. The initial state of the data structure is . The update operation adds or removes an element: . Recall that stands for the symmetric difference. There is a number of query operations to the data structure. It is able to give the type of . For integers and , it returns the th element of according to some internal ordering. Given an element , it detects whether it is in , and if it is, returns the tuple such that is the th element of . Given , it returns such that equals to a value in or says there is no such .
The data structure is coherence-friendly, i.e., a subset will have the same representation independently of the sequence of update operations that results in this subset. Next, it has an exponentially small error probability of failing that can be ignored. Finally, the implementation of this data structure requires quantum random access quantum memory (QRAQM) in the terms of Ref. .
5.2 Quantum Walk
In this section, we describe the quantum walk part of the algorithm. Formally, it is as follows.
Let be positive integers, be an input for the -distinctness problem, and be the set of having type . Given the uniform superposition , it is possible to solve the -distinctness problem in quantum time.
As mentioned in Section 5.1, we may assume that any input contains at most one -collision and -collisions. Define , and the type as for . Let be the set of all having type . It is consistent with our previous notation for . Denote . Also, for , define the set of dead-ends consisting of vertices of the form for and such that . Again, .
The vertex set of is . Each is connected to vertices: one for each . If , it is the vertex , otherwise, it is . A vertex is connected to vertices in differing from in one element. Each is only connected to . The weight of each edge is 1. A vertex is marked if and only if it is contained in .
Algorithm 1 is not directly applicable here because we do not know the graph in advance (it depends on the input), nor we know the amplitudes in the initial distribution . However, we know the graph locally, and our ignorance in the amplitudes of conveniently cancels out with our ignorance in the size of .
Let us briefly describe the implementation of the quantum walk on following Section 3. Let be the graph described above. It is bipartite: The part contains all and for even, and contains all and for odd. The support of is contained in . The reflections and are the direct sums of local reflections over all in and , respectively. They are as follows:
If , then is the identity in .
If , then negates the amplitude of the only edge incident to .
If for , then is the reflection about the orthogonal complement of in . If , or with , then is defined as
respectively. Here, is a constant.
The space of the algorithm consists of three registers: , and . The data register contains the data structure for . The coin register contains an integer in , and the qubit indicates whether the vertex is an element of . A combination with indicates a vertex in that is used in . A combination with indicates the edge between and or . Finally, a combination indicates the edge between and .
Similarly to Section 4, the reflections and are broken down into the diffuse and update operations. The diffuse operations perform the local reflections in the list above. For the first one, do nothing conditioned on being marked. For the second one, negate the phase conditioned on containing 1. The third reflection is the Grover diffusion  with one special element if . Similarly to Algorithm 1, the orientation of the edges may be ignored because the graph is bipartite.
The update operation can be performed using the primitives from Section 5.1. Given , calculate whether in a fresh qubit . Conditioned on , query the value of and perform the update operation for the data structure. Conditioned on not being set, flip the value of . Finally, uncompute the value in . On the last step, we use that represents an edge between vertices in if and only if does the same.
After we showed how to implement the step of the quantum walk efficiently, let us estimate the required number of steps. The argument is very similar to the one in Theorem 4. Let us start with the positive case. Assume is the unique -collision. Let denote the set of that are disjoint from , and be the uniform probability distribution on . Define the flow from to as follows. For each such that and , define flow on the edge from to . Define for all other edges . Let
This vector is orthogonal to all , hence, is invariant under the action of . Also, , and . Hence,
where stands for the asymptotic equivalence as .
In the negative case, define
Similarly to the proof of Theorem 4, we have that and .
Let us estimate . The number of edges in is at most times the number of vertices in . Thus, we have to estimate for . Consider the relation between and where and are in the relation iff consists of equal elements. Each element of has at most images in because there are at most maximal collisions in the input, and for each of them, there are at most variants to extend with. On the other hand, each element in has exactly preimages in . Thus, . Thus,
By Lemma 2, we have that if , then the overlap of with the eigenvectors of with phase less than can be made at most for any constant . Thus, it is enough to execute the phase estimation with precision if and are large enough. By Theorem 3, this requires iterations of the quantum walk. ∎
5.3 Preparation of the Initial State
Now we describe how to generate the uniform superposition over all elements in from the formulation of Lemma 6 efficiently in the special case of . Let us denote and . We start in the assumption the input is negative.
Prepare the state in time . This is very similar to the algorithm by Ambainis, and we omit the details. Measure the type of . The state of the algorithm collapses to the uniform superposition of the subsets of some type . Unfortunately, with high probability, will be of order that is much smaller than the required size .
We enlarge the size of by using the Grover search repeatedly. For each in the superposition, apply the Grover search over . An element is marked iff and is equal to an element in . This can be tested using the primitives from Section 5.1. If the Grover search fails, repeat it from the current state. If the search succeeds, the state is a superpositon of states of the form . Query the value of , and update the data structure. This gives a superposition over . Let . Apply the primitive that transforms into its number in . This gives a superposition over where . We show in a moment that, for a fixed , all states have the same amplitude, hence, the second register can be detached.
A typical subset has elements in that can be extended to a 2-collision, hence, the Grover search requires iterations. As we load additional elements, the time spent during the Grover search is .
Now assume each contains 2-collisions. Unfortunately, the state is not the uniform superposition we require for the quantum walk in Lemma 6. But due to symmetry, at any place in the algorithm, the amplitude of a subset only depends on the number of elements in that can be extended to a 2-collision. This shows that, indeed, the second register can be detached after the Grover search. Moreover, this gives us a way to generate the uniform superposition we require.
We measure the content of . Let be the outcome. The state collapses to the uniform superposition over subsets consisting of 2-collisions not using the values in . Then, we repeat the first step, i.e., for each , we construct the uniform superposition over subsets of size consisting of elements outside and having values different from the ones in . After that, we measure the type of the subset. This results in the uniform superposition over states in of type with and and avoiding elements with values in .
In the positive case, due to a similar argument, the state can be written as where is the uniform superposition over as defined in the proof of Lemma 6, and is some superposition over where intersects . One can show that is close to 1, hence, the initial state has large overlap with eigenvalue-1 eigenspace of .111One can modify the algorithm so that it does not require this observation. With probability , continue with the old algorithm, and with probability , measure the content of and search for a 2-distinctness outside having a value equal to a value in . This can be done using the standard algorithm for 2-distinctness with minor modifications.
Then, we can apply the algorithm from Lemma 6 with additional modification that a vertex is declared a dead-end also if has a value in . This finds a 3-collision in time if its value is different from a value in . For the values in , we search for a 2-collision outside but having a value equal to a value in . This can be implemented in time using the standard algorithm for 2-distinctness with minor modifications.
Thus, up to polylogarithmic factors, the time complexity of the algorithm is This attains optimal value of for and . This finishes the proof of Theorem 5.
I would like to thank Andris Ambainis, Andrew Childs, Stacey Jeffery, Robin Kothari, Troy Lee, Frédéric Magniez and Miklos Santha for useful discussions and remarks about the presentation of the paper.
This work has been supported by the European Social Fund within the project “Support for Doctoral Studies at University of Latvia” and by FET-Open project QCS.
-  S. Aaronson and Y. Shi. Quantum lower bounds for the collision and the element distinctness problems. Journal of the ACM, 51(4):595–605, 2004.
-  R. Aleliunas, R. M. Karp, R. J. Lipton, L. Lovasz, and C. Rackoff. Random walks, universal traversal sequences, and the complexity of maze problems. In Proc. of 20th IEEE FOCS, pages 218–223, 1979.
-  A. Ambainis. Quantum walks and their algorithmic applications. International Journal of Quantum Information, 1(4):507–518, 2003, arXiv:quant-ph/0403120.
-  A. Ambainis. Quantum walk algorithm for element distinctness. SIAM Journal on Computing, 37(1):210–239, 2007, arXiv:quant-ph/0311001.
-  A. Ambainis, A. M. Childs, B. W. Reichardt, R. Špalek, and S. Zhang. Any AND-OR formula of size can be evaluated in time on a quantum computer. SIAM Journal on Computing, 39(6):2513–2530, 2010.
-  A. Belovs. Learning-graph-based quantum algorithm for -distinctness. In Proc. of 53rd IEEE FOCS, pages 207–216, 2012, arXiv:1205.1534.
-  A. Belovs. Span programs for functions with constant-sized 1-certificates. In Proc. of 44th ACM STOC, pages 77–84, 2012, arXiv:1105.4024.
-  A. Belovs and T. Lee. Quantum algorithm for -distinctness with prior knowledge on the input. 2011, arXiv:1108.3022.
-  A. Belovs and B. W. Reichardt. Span programs and quantum algorithms for -connectivity and claw detection. In Proc. of 20th ESA, volume 7501 of LNCS, pages 193–204, 2012, arXiv:1203.2603.
-  B. Bollobás. Modern graph theory, volume 184 of Graduate Texts in Mathematics. Springer, 1998.
-  H. Buhrman and R. de Wolf. Complexity measures and decision tree complexity: a survey. Theoretical Computer Science, 288:21–43, 2002.
-  H. Buhrman and R. Špalek. Quantum verification of matrix products. In Proc. of 17th ACM-SIAM SODA, pages 880–889, 2006, arXiv:quant-ph/0409035.
-  A. K. Chandra, P. Raghavan, W. L. Ruzzo, R. Smolensky, and P. Tiwari. The electrical resistance of a graph captures its commute and cover times. Computational Complexity, 6(4):312–340, 1996.
-  A. M. Childs and J. M. Eisenberg. Quantum algorithms for subset finding. Quantum Information & Computation, 5(7):593–604, 2005, arXiv:quant-ph/0311038.
-  R. Cleve, A. Ekert, C. Macchiavello, and M. Mosca. Quantum algorithms revisited. Proceedings of the Royal Society of London A: Mathematical, Physical and Engineering Sciences, 454(1969):339–354, 1998, arXiv:quant-ph/9708016.
-  S. Dörn and T. Thierauf. The quantum query complexity of algebraic properties. In Proc. of 16th FCT, volume 4639 of LNCS, pages 250–260. Springer, 2007, arXiv:0705.1446.
-  P. G. Doyle and J. L. Snell. Random Walks and Electric Networks, volume 22 of Carus Mathematical Monographs. MAA, 1984, arXiv:math.PR/0001057.
-  L. K. Grover. A fast quantum mechanical algorithm for database search. In Proc. of 28th ACM STOC, pages 212–219, 1996.
-  S. Jeffery, R. Kothari, and F. Magniez. Nested quantum walks with quantum data structures. 2012, arXiv:1210.1199.
-  J. Kempe. Quantum random walks: an introductory overview. Contemporary Physics, 44(4):307–327, 2003, arXiv:quant-ph/0303081.
-  A. Kitaev. Quantum measurements and the abelian stabilizer problem. 1995, arXiv:quant-ph/9511026.
-  G. Kuperberg. Another subexponential-time quantum algorithm for the dihedral hidden subgroup problem. 2011, arXiv:1112.3333.
-  T. Lee, R. Mittal, B. W. Reichardt, R. Špalek, and M. Szegedy. Quantum query complexity of the state conversion problem. In Proc. of 52nd IEEE FOCS, pages 344–353, 2011, arXiv:1011.3020.
-  F. Magniez, A. Nayak, J. Roland, and M. Santha. Search via quantum walk. SIAM Journal on Computing, 40(1):142–164, 2011, arXiv:quant-ph/0608026.
-  F. Magniez, M. Santha, and M. Szegedy. Quantum algorithms for the triangle problem. SIAM Journal on Computing, 37(2):413–424, 2007, arXiv:quant-ph/0310134.
-  M. A. Nielsen and I. L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, 2000.
-  B. W. Reichardt. Reflections for quantum query algorithms. In Proc. of 22nd ACM-SIAM SODA, pages 560–569, 2011, arXiv:1005.1601.
-  M. Santha. Quantum walk based search algorithms. In Proc. of 5th TAMC, volume 4978 of LNCS, pages 31–46. Springer, 2008, arXiv:0808.0059.
-  U. Schöning. A probabilistic algorithm for -SAT and constraint satisfaction problems. In Proc. of 40th IEEE FOCS, pages 410–414, 1999.
-  M. Szegedy. Quantum speed-up of Markov chain based algorithms. In Proc. of 45th IEEE FOCS, pages 32–41, 2004.