Quantum walk based search algorithms
Miklos Santha
Introduction
Searching is without any doubt one of the major problems in computer science. The corresponding literature is tremendous, most manuals on algorithms include several chapters that deal with searching procedures . The relevance of finite Markov chains (random walks in graphs) to searching was recognized from early on, and it is still a flourishing field. The algorithm of Aleliunas et al. that solves – connectivity in undirected graphs in time and in space , and Schöning’s algorithm that provides the basis of the currently fastest solutions for 3-SAT are among the most prominent examples for that.
Searching is also a central piece in the emerging field of quantum algorithms. Grover search , and in general amplitude amplification are well known quantum procedures which are provably faster than their classical counterpart. Grover’s algorithm was used recursively by Aaronson and Ambainis for searching in grids.
Discrete time quantum walks were introduced gradually by Meyer in connection with cellular automata, and by Watrous in his works related to space bounded computations . Different parameters related to quantum walks and possible speedups of classical algorithms were investigated by several researchers .
The potential of discrete time quantum walks with respect to searching problems was first pointed out by Shenvi, Kempe, and Whaley who designed a quantum walk based simulation of Grover search. Ambainis, in his seminal paper , used quantum walks on the Johnson graphs to settle the query complexity of the Element Distinctness problems. Inspired by the work of Ambainis, Szegedy designed a general method to quantize classical Markov chains, and developed a theory of quantum walk based search algorithms. A similar approach for the specific case of searching in grids was taken by Ambainis, Kempe and Rivosh . The frameworks of Ambainis and Szegedy were used in various contexts to find algorithms with substantial complexity gains over simple Grover search . In a recent work, Magniez, Nayak, Roland and Santha proposed a new quantum walk based search method that expanded the scope of the previous approaches. The MNRS search algorithm is also conceptually simple, and improves various aspects of many walk based algorithms.
In this survey paper we give an intuitive (though formal) treatment of the quantization of classical Markov chains. We will be concerned with discrete time quantum walks, the continuous case will not be covered here. Grover search and the quantum walk based search algorithms of Ambainis, Szegedy and Magniez et al. will be stated as quantum analogues of classical search procedures. We present a rather detailed description of a somewhat simplified version of the MNRS algorithm. Finally, in the query complexity model, we show how quantum walks can be applied to the following search problems: Element Distinctness, Matrix Product Verification, Restricted Range Associativity, Triangle, and Group Commutativity. For a detailed introduction to quantum walks the reader is referred to the excellent surveys of Kempe and Ambainis . Another survey on quantum search algorithms is also due to Ambainis .
Classical search algorithms
At an abstract level, any search problem may be cast as the problem of finding a marked element from a set . Let be the set of marked elements, and let be a known lower bound on , the fraction of marked elements, whenever is non-empty. If no further information is available on , we can choose as . The simplest approach, stated in Search Algorithm 1, to solve this problem is to repeatedly sample from uniformly until a marked element is picked, if there is any.
Search Algorithm 1 Repeat for steps 1. Sample according to the uniform distribution. 2. If is in then output it and stop.
More sophisticated approaches might use a Markov chain on the state space for generating the samples. In that case, to generate the next sample, the resources expended for previous generations are often reused.
Markov chains can be viewed as random walks on directed graphs with weighted edges. We will identify a Markov chain with its transition matrix A chain is irreducible if every state is accessible from every other state. An irreducible chain is ergodic if it is also aperiodic. The eigenvalues of a Markov chain are at most 1 in magnitude. By the Perron-Frobenius theorem, an irreducible chain has a unique stationary distribution , that is a unique left eigenvector with eigenvalue and positive coordinates summing up to . If the chain is ergodic, the eigenvalue is the only eigenvalue of with magnitude . We will denote by the eigenvalue gap of , that is , where is an eigenvalue with the second largest magnitude. It follows that when is ergodic then .
The time-reversed Markov chain of is defined by the equations . The Markov chain is said to be reversible if . Reversible chains can be viewed as random walks on undirected graphs with weighted edges, and in these chains the probability of a transition from a state to another state in the stationary distribution is the same as the probability of the transition in the reverse direction. The Markov chain is symmetric if where denotes the transposed matrix of . The stationary distribution of symmetric chains is the uniform distribution. They can be viewed as random walks on regular graphs, and they are time-reversible.
We consider two search algorithms based on some ergodic and symmetric chain . Search Algorithm 2 repeatedly samples from approximately stationary distributions, and checks if the element is marked. To get a sample the Markov chain is simulated long enough to mix well. Search Algorithm 3 is a greedy variant: a check is performed after every step of the chain.
Search Algorithm 2 1. Initialize to a state sampled from the uniform distribution over . 2. Repeat for steps (a) If the element reached in the previous step is marked then output it and stop. (b) Simulate steps of starting with .
Search Algorithm 3 1. Initialize to a state sampled from the uniform distribution over . 2. Repeat for steps (a) If the element reached in the previous step is marked then output it and stop. (b) Simulate one step of starting with .
We state formally the complexity of the three algorithms to clarify their differences. They will maintain a data structure that associates some data with every state . Creating and maintaining the data structure incurs a certain cost, but the data can be helpful to determine if . We distinguish three types of cost.
Setup cost : The cost to sample according to the uniform distribution, and to construct .
Update cost : The cost to simulate a transition from to according to , and to update to .
Checking cost : The cost of checking if using .
The cost may be thought of as a vector listing all the measures of complexity of interest, such as query and time complexity. The generic bounds on the efficiency of the three search algorithms can be stated in terms of the cost parameters.
Let be an ergodic and symmetric Markov chain on . Then all three algorithms find a marked element with high probability if there is any. The respective costs incurred by the algorithms are of the following order:
Search Algorithm 1:
Search Algorithm 2:
Search Algorithm 3:
The generic bound of in Search Algorithm 3 on the hitting time is not always optimal, which in some cases, for example in the 2-dimensional grid, can be significantly smaller.
Quantum analogue of a classical Markov chain
We define a quantum analogue of an arbitrary irreducible Markov chain as it is given by Magniez et al. . This definition is based on and slightly extends the concept of quantum Markov chain due to Szegedy . The latter was inspired by an earlier notion of quantum walk due to Ambainis . We also point out that a similar process on regular graphs was studied by Watrous .
Let us give some motivations for this definition. Classical random walks do not quantize in the space of the vertices. The standard way advocated by several papers (see the survey ) is to extend the vertex space by a coin space , and define the state space of the walk as . Then a step of the walk is defined as the product of two unitary operations. The first one is the flip operation controlled by the vertex state, which means that for every , it performs a unitary coin flip on the states . For -regular undirected graphs, can be taken as the set , and in that case the coin flip is independent from . The second one is the shift operation which is controlled by the coin state, and takes a vertex to one if its neighboring vertices. For -regular graphs the simplest way to define it is via a labeling of the directed edges by the numbers between 1 and such that for every , the directed edges labeled by form a permutation. Then, if the coin state is , the new vertex is the neighbor according to the labeling. For general walks it is practical to take the coin space also to be , then the state space of the walk corresponds naturally to the directed edges of the graph. In this case there is a symmetry between the two spaces, and the shift operation simply exchanges the vertices, that is , for every .
Let us pause here for a second and consider how a classical walk defined by some Markov chain can be thought of as a walk on the directed edges of the graph (instead of the vertices). Let’s think about an edge as the state of the walk being at , where the previous state was . According to this interpretation, in one step the walk on edges should move from state to state with probability . This move can be accomplished by the stochastic flip operation controlled by the left end-point of the edge, where for all , followed by the shift defined previously. If we define the flip as but controlled by the right end-point of the edge, then it is not hard to see that . Therefore one can get rid of the shift operations, and two steps of the walk can be accomplished by two successive flips where the control and the target registers alternate.
The eigen-spectrum of the transition matrix plays an important role in the analysis of a classical Markov chain. Similarly, the behaviour of the quantum process may be inferred from its spectral decomposition. The reflections through subspaces and are (real) orthogonal transformations, and so is their product An orthogonal matrix may be decomposed into a direct sum of the identity, reflection through the origin, and two-dimensional rotations over orthogonal vector subspaces [17, Section 81]. These subspaces and the corresponding eigenvalues are revealed by the singular value decomposition of the product of the orthogonal projection operators onto the subspaces and . Equivalently, as done by Szegedy, one can consider the singular values of the discriminant matrix . Since , we have
Since the singular values of all lie in the range $\cos\theta\theta\in[0,\tfrac{\pi}{2}]D(P)W(P)$.
Let be an irreducible Markov chain, and let be an enumeration of those singular values (possibly repeated) of that lie in the open interval . Then the exact description of the spectrum of on is:
Let us now suppose in addition that is ergodic and reversible. As we just said, reversibility implies that the singular values of are equal to the absolute values of the eigenvalues of . From the ergodicity it also follows that has a unique singular vector with singular value 1. We have therefore the following corollary.
Let be an ergodic and reversible Markov chain. Then, on the spectrum of can be characterized as:
Quantum search algorithms
As in the classical case, the quantum search algorithms look for a marked element in a finite set . We suppose that the elements of are coded by binary strings and that , the everywhere 0 string is in . A data structure attached to both vertex registers is maintained during the algorithm. Again, three types of cost will be distinguished, generalizing those of the classical search. In all quantum search algorithms the overall complexity is of the order of these specific costs, which justifies their choices. The operations not involving manipulations of the data will be charged at unit cost. For the sake of simplicity, we do not formally include the data into the description of the unitary operations defining the costs. The initial state of the algorithm is explicitly related to the stationary distribution of .
(Quantum) Setup cost : The cost for constructing the state with data.
(Quantum) Update cost : The cost to realize any of the unitary transformations and inverses with data
(Quantum) Checking cost : The cost to realize the unitary transformation with data, that maps to if , and leaves it unchanged otherwise.
Let us now describe how the respective algorithms of Grover, Ambainis and Szegedy are related to the classical search algorithms of Section 2. We suppose that , a lower bound on the proportion of marked elements is known in advance, though the results remain true even if it is not the case. Grover search (which we discuss soon in detail) is the quantum analogue of Search Algorithm 1.
There exists a quantum algorithm which with high probability finds a marked element, if there is any, at cost of order .
In the original application of Grover’s result to unordered search there is no data structure involved, therefore , and the cost is of order .
The algorithm of Ambainis is the quantum analogue of Search Algorithm 2 in the special case of the walk on the Johnson graph and for some specific marked sets. Let us recall that for , the vertices of the Johnson graph are the subsets of of size , and there is an edge between two vertices if the size of their symmetric difference is 2. In other words, two vertices are adjacent if by deleting an element from the first one and adding a new element to it we get the second vertex. The eigenvalue gap of the symmetric walk on is . If the set of marked vertices in is either empty, or it consists of vertices that contain a fixed subset of constant size then .
Szegedy’s algorithm is the quantum analogue of Search Algorithm 3 for the class of ergodic and symmetric Markov chains. His algorithm is therefore more general than the one of Ambainis with respect to the class of Markov chains and marked sets it can deal with. Nonetheless, the approach of Ambainis has its own advantages: it is of smaller cost when is substantially greater than , and it also finds a marked element.
Let be an ergodic and symmetric Markov chain. There exists a quantum algorithm that determines, with high probability, if is non-empty at cost of order
The MNRS algorithm is a quantum analogue of Search Algorithm 2 for ergodic and reversible Markov chains. It generalizes the algorithms of Ambainis an Szegedy, and it combines their benefits in terms of being able to find marked elements, incurring the smaller cost of the two, and being applicable to a larger class of Markov chain.
Let be an ergodic and reversible Markov chain, and let be a lower bound on the probability that an element chosen from the stationary distribution of is marked whenever is non-empty. Then, there exists a quantum algorithm which finds, with high probability, an element of if there is any at cost of order
There is an additional feature of Szegedy’s algorithm which doesn’t fit into the MNRS algorithmic paradigm. In fact, the quantity in Theorem 4.3 can be replaced by the square root of the classical hitting time . The search algorithm for the 2-dimensional grid obtained this way, and the one given in have smaller complexity than what follows from Theorem 4.4.
The MNRS search algorithm
There exists a uniform family of quantum circuits that uses additional qubits and satisfies the following properties:
The essence of the MNRS search algorithm is the following simple procedure that satisfies the conditions of Theorem 4.4, but with a slightly higher complexity, of the order of Again, we suppose that is known.
Applications
We give here a few examples where the quantum search algorithms, in particular the MNRS algorithm can be applied successfully. All examples will be described in the query model of computation. Here the input is given by an oracle, a query can be performed at unit cost, and all other computational steps are free. A formal description of the model can be found for example in or . In fact, in almost all cases, the circuit complexity of the algorithms given will be of the order of the query complexity, with additional logarithmic factors.
As a first (and trivial) application, we observe that Grover’s algorithm for the unordered search problem is a special case of Theorem 4.4.
Unordered Search Oracle Input: A boolean function defined on . Output: An element such that .
Unordered Search can be solved with high probability in quantum query complexity , where .
Consider the symmetric random walk in the complete graph on vertices, where an element is marked if . The eigenvalue gap of the walk is , and the probability that an element is marked is . There is no data structure involved in the algorithm, the setup, update and checking costs are 1.
2 Johnson graph based algorithms
All these examples are based on the symmetric walk in the Johnson graph , with eigenvalue gap .
This is the original problem for which Ambainis introduced the quantum walk based search method .
Element Distinctness Oracle Input: A function defined on . Output: A pair of distinct elements such that if there is any, otherwise reject.
Element Distinctness can be solved with high probability in quantum query complexity .
A vertex of size is marked if there exist such . The probability that an element is marked, if there is any, is in . For every , the data is defined as . Then the setup cost is in , the update cost is , and the checking cost is 0. Therefore the overall cost is which is when . This upper bound is tight, the lower bound is due to Aaronson and Shi .
2.2 Matrix Product Verification
This problem was studied by Buhrman and Spalek , and the algorithm in the query model is almost identical to the previous one.
Matrix Product Verification Oracle Input: Three matrices and . Output: Decide if and in the negative case find indices such that .
Matrix Product Verification can be solved with high probability in quantum query complexity .
For an matrix and a subset of indices , let denote the submatrix of corresponding to the rows restricted to . The submatrices and are defined similarly, when the restriction concerns the columns and both the rows and columns. A vertex is marked if there exist such that . The probability of being marked, if there is such an element, is in . For every , the data is defined as the set of entries in and . Then the setup cost is in , the update cost is , and the checking cost is 0. Therefore the overall cost is when The best known lower bound is , and in an upper bound was also proven for the time complexity with a somewhat more complicated argument.
2.3 Restricted Range Associativity
The problem here is to decide if a binary operation is associative. The only algorithm known for the general case is Grover search, but Dörn and Thierauf have proved that when the range of the operation is restricted, Theorem 4.4 (or Theorem 4.2) give a non-trivial bound. A triple is called non associative if .
Restricted Range Associativity Oracle Input: A binary operation where . Output: A non associative triple if there is any, otherwise reject.
Restricted Range Associativity can be solved with high probability in quantum query complexity .
We say that is marked if there exist and such that is non associative. Therefore is in , if there is a marked element. For every , the data structure is defined as . Then the setup cost is and the update cost is . Observe that if and are fixed, then computing and for all requires at most queries with the help of the data structure. Thus using Grover search to find and , the checking cost is . The overall complexity is then which is when . The best lower bound known both in the restricted range and the general case is .
2.4 Triangle
In an undirected graph , a complete subgraph on three vertices is called a triangle. The algorithm of Magniez et al. for finding a triangle uses the algorithm for Element Distinctness in the checking procedure.
Triangle Oracle Input: The adjacency matrix of a graph on vertex set . Output: A triangle if there is any, otherwise reject.
Triangle can be solved with high probability in quantum query complexity .
We show how to find the edge of a triangle, if there is any, in query complexity . This implies the theorem since given such an edge, Grover search finds the third vertex of the triangle with additional queries.
An element is marked if it contains a triangle edge. The probability that an element is marked is in , if there is a triangle. For every , the data structure is the adjacency matrix of the subgraph induced by . defined as . Then the setup cost is , and the update cost is . The interesting part of the algorithm is the checking procedure, which is a quantum walk based search itself, and the claim is that it can be done at cost .
To see this, let be a set of vertices such that the graph restricted to is explicitly known, and for which we would like to decide if it is marked. Observe that is marked exactly when there exists a vertex such that and an edge in form a triangle. Therefore for every vertex , one can define a secondary search problem on via the boolean oracle , where for every , by definition if is an edge. The output of the problem is by definition positive if there is an edge such that . To solve the problem we consider the Johnson graph , and look for a subset which contains such an edge. In that search problem both the probability of being marked and the eigenvalue gap of the underlying Markov chain are in . The data associated with a subset of is just the values of at its elements. Then the setup cost is , the update cost is , and the checking cost is 0. Therefore by Theorem 4.4 the cost of solving a secondary search problem is in . Finally the checking procedure of the original search problem consists of a Grover search for a vertex such that the secondary search problem defined by has a positive outcome. Putting things together, the problem can be solved in quantum query complexity which is when . The best known lower bound for the problem is .
3 Group commutativity
The problem here is to decide if a group multiplication is commutative in the (sub)group generated by some set of group elements. It was defined and studied in the probabilistic case by Pak , the quantum algorithm is due to Magniez and Nayak .
Group Commutativity Oracle Input: The multiplication operation for a finite group whose base set contains . Output: A non commutative couple if , the (sub)group generated by , is non-commutative, otherwise reject.
Group Commutativity can be solved with high probability in quantum query complexity .
For let be the set of all -tuples of distinct elements from . For in , we set . We define a random walk over . Let be the current vertex. Then with probability 1/2 stay at , and with probability 1/2 pick uniformly random and . If for some then exchange and , otherwise set . The random walk at the basis of the quantum algorithm is over , and it consists of two independent simultaneous copies of the above walk. The stationary distribution of is the uniform distribution, and it is proven in that its eigenvalue gap is .
A vertex is marked if . It is proven again in that when is non-commutative and , then the probability that an element is marked is . For let be the balanced binary tree with leaves that are labeled from left to right by , and where each internal node is labeled by the product of the labels of its two sons. For every vertex the data consists of . Then the setup cost is , and the update cost is for recomputing the leaf–root paths. The checking cost is simply for querying and . Therefore the query complexity to find a marked element is which is when . Once a marked element is found, Grover search yields a non-commutative couple at cost . In an lower bound is also proven. And, it turns out that a Johnson graph based walk can be applied to this problem too , yielding an algorithm of complexity .
Acknowledgment
I would like to thank Frédéric Magniez, Ashwin Nayak and Jérémie Roland, my coauthors in , for letting me to include here several ideas which were developed during that work, and for numerous helpful suggestions.