Log In Sign Up

Quantum Walk Sampling by Growing Seed Sets

by   Simon Apers, et al.

This work describes a new algorithm for creating a superposition over the edge set of a graph, encoding a quantum sample of the random walk stationary distribution. The algorithm requires a number of quantum walk steps scaling as O(m^1/3δ^-1/3), with m the number of edges and δ the random walk spectral gap. This improves on existing strategies by initially growing a classical seed set in the graph, from which a quantum walk is then run. The algorithm leads to a number of improvements: (i) it provides a new bound on the setup cost of quantum walk search algorithms, (ii) it yields a new algorithm for st-connectivity, and (iii) it allows to create a superposition over the isomorphisms of an n-node graph in time O(2^n/3), surpassing the Ω(2^n/2) barrier set by index erasure.


page 1

page 2

page 3

page 4


Quadratic speedup for finding marked vertices by quantum walks

A quantum walk algorithm can detect the presence of a marked vertex on a...

Expansion Testing using Quantum Fast-Forwarding and Seed Sets

Expansion testing aims to decide whether an n-node graph has expansion a...

Szegedy Walk Unitaries for Quantum Maps

Szegedy developed a generic method for quantizing classical algorithms b...

Quantum walk inspired algorithm for graph similarity and isomorphism

Large scale complex systems, such as social networks, electrical power g...

Elfs, trees and quantum walks

We study an elementary Markov process on graphs based on electric flow s...

A Unified Framework of Quantum Walk Search

The main results on quantum walk search are scattered over different, in...

Playing a true Parrondo's game with a three state coin on a quantum walk

A coin with three states is not necessarily an anomaly. A coin falls on ...

1 Introduction and Summary

Sampling from the stationary distribution of a random walk is a common and valuable tool in the design of algorithms [Sin12]

. It underlies the Markov chain Monte Carlo paradigm, and plays a central role in a wide range of approximation algorithms for graph problems. In this work we investigate the quantum counterpart of this task - generating quantum samples from the random walk stationary distribution. Given query access to some graph

with edges, we wish to create the quantum state


which is a superposition over the edges of the graph. Measuring the first register of this state, and discarding the second register, indeed returns the random walk stationary distribution. Creating such a quantum sample of a classical stationary distribution forms a crucial primitive for a range of algorithms: the so-called ‘‘setup cost’’ in quantum walk search algorithms [MNRS11, KMOR16] refers to the cost of generating a state such as , quantum algorithms for speeding up MCMC [ATS03, SBBK08, WA08, PW09] build on the possibility of efficiently creating quantum samples, and a number of quantum algorithms for solving graph problems [Wat01, JJKP18] require the generation of a superposition over the edges of a graph.

We develop a new quantum algorithm for creating the quantum sample (1), given only local query access to the graph. Our algorithm improves the query and time complexity of the folklore approach to quantum sampling from to . We do so by growing a classical seed set from the initial node. This incurs a payoff in the space complexity, increasing it from to . As a demonstration of our algorithm, we discuss a new approach to solving -connectivity: generate a superposition over the connected components of and , and compare these states. This approach generalizes the notorious quantum state generation strategy for solving graph isomorphism. Concerning the latter, we show that our algorithm allows to create a superposition over the isomorphisms of a given -vertex input graph in steps. This surpasses the index erasure barrier by Ambainis et al [AMRR11]. In a similar way we can create a superposition over the elements of a black box group in steps, where is the number of group elements.

Query Model.      We assume throughout this work that we only have ‘‘local’’ query access to some graph : we are give an initial node , and we can query for its degree and neighbors. Such queries fall under the so-called adjacency array model [DHHM06] or bounded degree model [GR02] (although we do not assume the degree is bounded), which is very natural when studying random walk algorithms. However, departing from these models, and justifying the term ‘‘local’’, we will not assume direct access to or prior knowledge about , apart from the initial node. For comparison, in [DHHM06] the node set is given as a list, and in [GR02] access to uniformly random nodes is assumed. In this sense our work is in line with graph exploring algorithms as considered e.g. in [ST13], or more recently in [CDK16].

Since our algorithm strongly builds on the use of quantum walks, we will alternatively express the complexity of our results as a function of the number of quantum walk steps. Also in such case the denominator ‘‘local’’ query access is justified, since a single quantum walk step from a certain node only accesses the neighbors of that node.

Quantum Walk Sampling Algorithm.      Our algorithm builds on the folklore approach to creating , discussed in e.g. [Ric07, WA08, PW09, OBD18]. Starting from some initial state localized on a node

, this approach combines quantum phase estimation and amplitude amplification on the quantum walk operator associated to the graph. We detail this scheme in Section

2.2. The scheme requires QW steps on the graph, where is the random walk spectral gap, and the factor stems from the small projection of the initial state onto .

In the present work we improve on this scheme by initially doing some ‘‘classical work’’: we first use classical means to grow a seed set around the initial vertex. Briefly ignoring the -dependency, we grow the set to have size . We can then use a QRAM data structure to generate and reflect around a quantum superposition over this set, which now has a overlap with the target state. Reinvoking the folklore scheme from this state then allows to retrieve , now only requiring queries. This approach leads to the following result.

Theorem 1.

Given a lower bound on the spectral gap, it is possible to create the quantum state using time, space and QW steps.

Apart from the log-factors, the combined dependency on and is optimal. Indeed it is tight on e.g. the cycle graph, which has and , giving an steps algorithm. Since the diameter of the cycle is , this is optimal when assuming local query access. We also note that, if in addition we are given a bound on the maximum degree (in e.g. the array model this is always given), then we can implement our algorithm using degree and neighbor queries.

The algorithm gives a direct bound on the so-called setup cost of quantum walk search algorithms in the MNRS framework [MNRS11] as a function of the update cost (i.e., the cost of implementing a quantum walk step). The increased space complexity of our algorithm, as compared to for the folklore approach, is very similar to the payoff in space versus time or query complexity in the collision finding algorithm of Brassard et al [BHT97] and the element distinctness algorithm of Ambainis [Amb07].

Application to -connectivity.      Our QW sampling algorithm yields a new approach for solving -connectivity, somewhat similar to the approach taken by Watrous in [Wat01]: generate a superposition over the edges in the connected components of resp. , and compare the resulting states. As we prove in Proposition 2, this requires QW steps, where is a lower bound on the spectral gaps of the connected components of and . Our algorithm outperforms the existing quantum algorithms for -connectivity [DHHM06, BR12, Bel13, JJKP18] on for instance sparse graphs with a good spectral gap.

The approach generalizes a well-known strategy to solving graph isomorphism on a quantum computer [ATS03] (called ‘‘component mixing’’ in [Lut11]): generate superpositions over the isomorphisms of each graph, and compare the resulting states. In [AMRR11], Ambainis et al aimed to prove a lower bound on this approach by abstracting it to the so-called index erasure problem. For this generalized problem, they prove a lower bound of . They argue that the same bound holds for creating a superposition over graph isomorphisms, be it under the condition that the algorithm makes no use of the structure of the problem. We show that, by exploiting the structure of the problem, we can indeed use our quantum walk sampling algorithm to surpass this bound. Thereto we consider the graph whose node set consists of isomorphisms of the input graph, and whose edge set arises from performing pairwise transpositions on the nodes (i.e., on the adjacency matrices of the isomorphisms). Using our quantum walk sampling algorithm on this graph yields the following corollary.

Corollary 1.

Given an -node input graph , it is possible to create a superposition over the isomorphisms of in steps.

Completing the associated -connectivity algorithm, we find an quantum algorithm for graph isomorphism. Using the existing quantum algorithms for -connectivity, this approach would require steps. Clearly the improved performance still falls terribly short of current (classical) algorithms for graph isomorphism, most notably the quasi-polynomial algorithm by Babai [Bab16], yet it provides a clear demonstration of how the readily accessible structure of the problem allows to surpass the index erasure bound.

A similar strategy exists for solving the group non-membership problem on a quantum computer, as proposed by Watrous [Wat00], requiring to generate a superposition over the elements of a finite black box group. Using the random walk algorithm by Babai [Bab91] for generating uniformly random group elements, we can similarly generate this superposition in steps, when is the number of group elements.

Open Questions.      This work leaves open a number of questions and possible applications, some of which we summarize below:

  • Quantum sampling for general Markov chains or stoquastic Hamiltonians. In this work we only consider the quantum sampling problem for random walks. Generalizing our approach to more general Markov chains could lead to improvements on quantum MCMC algorithms [ATS03, SBBK08], or the preparation of many body ground states [PW09] and Gibbs states [VAGGdW17]. The main bottleneck to such generalization seems to be the classical construction of seed sets which have an appropriate overlap with the goal quantum state. Even more generally, one could consider the preparation of ground states of arbitrary Hamiltonians. For e.g. the special case of stoquastic Hamiltonians, which are known to have a nonnegative ground state, it should be possible to construct a seed set with improved overlap with the ground state.

  • Faster quantum fast-forwarding. In [AS19] a quantum algorithm was proposed for quantum sampling a -step Markov chain. If the Markov chain has transition matrix , and is started from a node , the algorithm has complexity . Using ideas from the present work, it seems very feasible that we can improve this complexity to . Rather than using a breadth-first search to grow the seed set, as in the present work, it seems more suitable to use random walk techniques as in [ST13, AP09]. As a byproduct, this would yield an improved quantum expansion tester, combining the speedups of [ACL11] and [AS19].

  • Quantum search in . Our algorithm does not suffer from the so-called ‘‘symmetry barrier’’ in quantum algorithms: we can go from to more easily then from to . Indeed, if for instance the underlying graph is an expander, then the former takes queries, whereas the latter takes queries by the search lower bound.

    An open problem related to this is the following: given an initial node in a graph, can we find a node in QW steps, with the hitting time from to ? Currently the best algorithm for this problem is by Belovs [Bel13], which solves it in , with the commute time between and . Since the commute time is symmetric between and , this obeys the aforementioned symmetry barrier. However, the commute time can be much larger than the hitting time from to , hence the open question of whether we can improve this performance to . thereby necessarily breaking this symmetry e.g. by using our techniques.

Outline.      In Section 2 we discuss the graph and query model (Section 2.1), and provide the necessarily preliminaries on random walks and quantum walks (Section 2.2). In Section 3 we propose an algorithm for growing a classical seed set (Section 3.1), we discuss the QRAM data structure (Section 3.2), and we propose our QW sampling algorithm (Section 3.3). Finally in Section 4 we discuss the application of our QW sampling algorithm for solving -connectivity (Section 4.1), and we demonstrate it for the special case of graph isomorphism testing (Section 4.2).

2 Preliminaries: Queries and Walks

2.1 Graph and Query Model

Throughout the paper we assume local query access to an undirected graph , with

a subset of the ordered pairs

, such that . We denote and . For any , we let denote the set of edges starting in , i.e.,

For any , we let denote the degree of , the maximum degree , and denotes the total degree of a set . A single query consists of either of the following:

  • degree query: given , return degree

  • neighbor query: given , , return -th neighbor of

As an alternative query model we will also consider the quantum walk model, or so-called MNRS framework, as proposed in [MNRS11] in the context of quantum walk search. The model associates abstract costs to different operations111They actually consider a more general model, associated to a reversible Markov chain over . We consider the special case where the Markov chain is a random walk.:

  • setup cost: the cost of preparing the quantum sample

  • update cost: the cost of implementing a quantum walk step. See Section 2.2 for details.

For search problems an additional checking cost is considered, yet this will not be relevant here. In [CMB16] it is proven that the update cost or quantum walk step for a node can be simulated using degree and neighbor queries. From our work it follows that the setup cost can be simulated using QW steps, or degree and neighbor queries.

2.2 Random Walks and Quantum Walks

From some initial seed vertex , we can use degree and neighbor queries to implement a random walk over . The transition matrix describing such a walk is defined by if , and elsewhere. If the graph is connected and nonbipartite, then the random walk converges to its stationary distribution , defined by for any

. If we order the eigenvalues of

(with multiplicities) as , then the rate at which the walk converges to is bounded by the spectral gap [LPW17].

Quantum walks (QWs) form an elegant and nontrivial quantum counterpart to random walks on graphs. Following the exposition in [MNRS11]

, they are naturally defined over a vector space associated to the edge set

A quantum walk over is now defined as the unitary operator , where is a reflection around the subspace , with

and represents the swap operator defined by . The cost of implementing the QW operator is called the update cost, but can alternatively be implemented using degree and neighbor queries, and elementary operations.

The spectrum of is carefully tied to the spectrum of the original random walk matrix , as was seminally proven by Szegedy in [Sze04] and Magniez et al in [MNRS11]. For the purpose of this work, we abstract the following lemma. We say that has a phase gap if for every eigenvalue of it holds that . We also recall the state .

Lemma 1 ([Sze04, Mnrs11]).

Let be the random walk transition matrix having spectral gap . Then the quantum walk operator has a phase gap , and

is the unique eigenvalue-1 eigenvector in the subspace


From this lemma, combined with the quantum algorithms for phase estimation and amplitude amplification, we can derive the folklore approach to quantum walk sampling, discussed in for instance [Ric07, WA08, PW09, OBD18]. Since we will use it as a subroutine, we summarize it below. For a general subset , we denote the state .

Proposition 1.

Given an initial set and a lower bound , we can generate a state -close to using an expected number of calls to , reflections around , and an additional time and space complexity.


Let the operator be defined by the amplified quantum phase estimation algorithm, as used in [MNRS11, Theorem 6]. For some integer , this operator maps an initial state to the state

where is such that . The operator can be implemented using calls to and , and additional space and elementary gates.

On this state we can invoke the amplitude amplification scheme from [BHMT02, Theorem 3] to retrieve the projection of on the image of , which is -close to . This requires an expected number of calls to , and the reflection operator . We prove the proposition by choosing and noting that . ∎

On a general graph, and starting from some initial node , this scheme requires QW steps, or degree and neighbor queries.

3 Quantum Walk Sampling

In this section we elaborate our scheme for quantum walk sampling. We separately address the process for growing a seed set, the QRAM data structure that we require, and their combination with the folklore QW sampling routine.

3.1 Growing a Seed Set

We propose the following algorithm to grow a seed set in the graph. It is a variation on the breadth-first search algorithm, returning an edge set of given size.

Input: initial node and query access to a connected graph , integer


1:create lists and , and queue
2:while  do
3:     ,
4:     for all  s.t.  do
5:         if  then
7:              if  then terminate and output          
8:         if  then       
Algorithm 1 Breadth-First Edge Search
Lemma 2.

If , then Algorithm 1 outputs a subset with . Its time and space complexity, and degree and neighbor query complexity, are .


Assuming the lists are ordered, any of the list and queue operations (enqueueing, dequeueing, adding an element, outputting the size of a list, searching an element in a list) takes polylogarithmic time. As a consequence, the time complexity will be determined up to log-factors by the number of for-loops before the algorithm terminates.

In every for-loop an edge is considered. Every edge is encountered at most twice, the first time of which it is added to . Since the algorithm terminates when , this implies that the algorithm terminates after less than for-loops. ∎

Alternatively we can output the node set . Since , we have that .

3.2 Kerenidis-Prakash QRAM

After growing the seed set , we wish to use it as a resource for our QW sampling algorithm. Specifically we will require the generation of and reflection around the superposition over edges starting in . By naive query access to the database containing , this requires a time complexity per generation or reflection, which follows from the bound on index erasure [AMRR11]. Since our QW sampling algorithm will require such operations, the total time complexity for would become , thus providing no speedup on the time complexity as compared to the folklore approach. To remedy this, we use a more efficient QRAM data structure proposed by Kerenidis and Prakash [KP16] in their quantum recommendation algorithm. We extract the following result, abstracted from their Theorem 15 (by setting , and inputting entries for all ).

Theorem 2 (Kerenidis-Prakash [Kp16]).

Assume we have query access to a set . There exists a classical data structure to store the set with the following properties:

  • the size of the structure is ,

  • the time and query complexity to fill the structure is ,

  • having quantum access to the data structure we can perform the mapping and its inverse in time .

This easily implies the ability to reflect around in time : we can rewrite the reflection , so that it comes down to implementing , and a reflection around the basis state .

3.3 QW Sampling Algorithm

Building on the seed set and QRAM, we can now propose our quantum sampling algorithm for creating the state in time, space and quantum walk steps.

Input: parameters and ; initial node and query access to a graph


1:for  do
2:     use BFS to grow a seed set with
3:     load in QRAM
4:     apply the routine from Proposition 1 on for steps
5:     if the routine finished, terminate and return its output
Algorithm 2 Quantum Walk Sampling
Theorem 3 (Quantum Walk Sampling).

If we choose then Algorithm 2 returns a state -close to . The algorithm requires expected space, time and quantum walk steps in


The correctness of the algorithm follows from Proposition 1. By this proposition we know that if and the algorithm terminates, and hence the routine from Proposition 1 finished, then it effectively outputs a state -close to . The complexity of the algorithm for a fixed is also easily bounded: the complexity of steps 2 and 3 is both , which follows from Lemma 2 resp. Theorem 2. Step 4 is automatically terminated after steps, which by Proposition 1 directly bounds the number of calls to and reflections around . By Theorem 2 the complexity of implementing a single reflection around is . The total complexity for a fixed is therefore .

What remains to bound is the -value at which the algorithm terminates. From Proposition 1 we know that if the number of steps is sufficiently large, i.e.,


then the routine finishes with probability

. From the fact that and it holds that . As a consequence, if then and hence (2) will hold, such that the routine will finish with probability . The expected number of for-loops is therefore , with the total complexity scaling as

Alternatively we are interested in bounding the algorithm in terms of classical queries. We can naively substitute every quantum walk step for degree and neighbor queries, yielding a complexity . However, if we are given an upper bound , we can improve this complexity by slightly increasing the size of the seed set. We note that in the array model [DHHM06] the degrees are assumed to be known beforehand, so we exactly know .

Corollary 2.

Given an initial node , a lower bound and an upper bound , we can generate a state -close to in expected space, time, and degree and neighbor queries in


We adapt Algorithm 2 by slightly increasing the size of the seed set in step 2 to and decreasing the number of steps in step 4 to . Following the proof of Theorem 3, the algorithm then terminates after classical steps and queries, and QW steps. Now we can substitute each QW step with degree and neighbor queries, yielding the claimed complexity. ∎

4 Application: st-Connectivity

4.1 General Algorithm

Let and denote the spectral gaps of the connected components of resp. .

Proposition 2.

Given and a lower bound , we can decide -connectivity with probability in QW steps. If we are also given an upper bound , then we can do so in degree and neighbor queries.


Given we can create an -approximation (resp. ) of the superposition (resp. ) over the edges of the connected component of (resp. ) in QW steps. If we also have , then we can do so in degree and neighbor queries.

If and are connected, then , whereas if they are not, then . We can distinguish these cases by performing the SWAP-test [ATS03] between these states, using a single copy of both states, and additional gates. If and are connected, then the test returns 1 with probability , if and are not connected, the test returns 1 with probability . Repeating this scheme times then allows to decide -connectivity with probability . ∎

This approach best compares to the following classical scheme: use independent random walks of length from and to gather samples from the stationary distributions on the connected components of resp. . If and are connected then with constant probability the sample sets will overlap, which follows from the birthday paradox. This scheme requires random walk steps, or equivalently, neighbor queries. It lies at the basis of the graph expansion tester by Goldreich and Ron [GR11], and the subsequent work on testing closeness of distributions [BFR13] and clusterability of graphs [CPS15].

In Figure 1 we compare the query complexity of our approach to the existing quantum algorithms for -connectivity. If no promise is given on negative instances (such as in [JJKP18] in the form of a capacitance ), then all former algorithms require queries when maximized over all -pairs of the graph. As a consequence, for the graph isomorphism problem treated in the next section, they all have a complexity. Our approach however has a complexity.

query complexity model
Dürr et al [DHHM06] array
Dürr et al [DHHM06] adjacency
Belovs-Reichardt [BR12] adjacency
Belovs [Bel13] QW
Jarret et al [JJKP18] adjacency
folklore QW sampling QW
this work QW
this work array
Figure 1: Query complexity of -connectivity using different quantum algorithms in different models. The array model measures the number of degree and neighbor queries; the adjacency model measures the number of pair queries (e.g., ‘‘are and neighbors?’’); the QW model measures the number of QW steps. The quantities and denote the length of the shortest path and the effective resistance, respectively, between and . The quantity denotes the capacitance between and in negative instances, i.e., if and are disconnected then quantifies ‘‘how’’ disconnected they are.

4.2 Graph Isomorphism

We consider some given -node graph , described by its adjacency matrix. To this graph we can associate a new regular graph with nodes , consisting of permutations of the original graph nodes, and edges , corresponding to all possible transpositions of two elements. We can easily prove the following.

Lemma 3.

The random walk on has a spectral gap .


If (i.e., if ), this graph is isomorphic to the Cayley graph derived from the symmetric group with generators given by transpositions. The mixing time of a random walk on this graph is by a result of Diaconis and Shashahani [DS81], implying a lower bound on its spectral gap .

If , the graph is effectively an edge contraction of the random transposition graph. Following Aldous and Fill [AF02, Proposition 4.44], a random walk on this graph is an induced chain of the random walk on the symmetric group, in particular having a spectral gap lower bounded by the spectral gap of the original walk. ∎

Next we show how to implement a QW step on in steps. By Theorem 3 we can then create a superposition over the edges of (or, equivalently, its nodes) in time , and by Proposition 2 we can solve -connectivity (i.e. graph isomorphism) in the same time.

Lemma 4.

Implementing a quantum walk on takes time .


Since we may have multi-edges, corresponding to permutations that leave the input graph invariant, we will slightly alter the QW to take place on a node+coin space (as in e.g. [AAKV01, Amb07]) rather than on the edge space. The relevant spectral properties from Lemma 1 however remain unchanged, as is easily seen by following for instance the proof of [KMOR16]. We define the QW node+coin space, associated to the input graph , as , with the symmetric group of permutations. Similarly to Section 2.2, the QW operator consists of a reflection around a subspace , now defined as

and the shift operator defined by . Each of these operators can be implemented in steps. ∎

5 Acknowledgements

This work greatly benefited from discussions with Alain Sarlette, Stacey Jeffery, Anthony Leverrier, Ronald de Wolf, André Chailloux and Frédéric Magniez. Part of this work was supported by the CWI-Inria International Lab.