Vous êtes sur la page 1sur 13

PHYSICAL REVIEW A 97, 022337 (2018)

Improved quantum backtracking algorithms using effective resistance estimates


Michael Jarret1,* and Kianna Wan1,2,†
1
Perimeter Institute for Theoretical Physics, Waterloo, Ontario, Canada N2L 2Y5
2
Department of Physics and Astronomy, University of Waterloo, Waterloo, Ontario, Canada N2L 3G1

(Received 1 December 2017; published 27 February 2018)

We investigate quantum backtracking algorithms of the type introduced by Montanaro (Montanaro,


arXiv:1509.02374). These algorithms explore trees of unknown structure and in certain settings exponentially
outperform their classical counterparts. Some of the previous work focused on obtaining a quantum advantage
for trees in which a unique marked vertex is promised to exist. We remove this restriction by recharacterizing
the problem in terms of the effective resistance of the search space. In this paper, we present a generalization
of one of Montanaro’s algorithms to trees containing k marked vertices, where k is not necessarily known
a priori. Our approach involves using amplitude estimation to determine a near-optimal weighting of a diffusion
operator, which can then be applied to prepare a superposition state with support only on marked vertices and
ancestors thereof. By repeatedly sampling this state and updating the input vertex, a marked vertex is reached in

a logarithmic number of steps. The algorithm thereby achieves the conjectured bound of O(  T Rmax ) for finding


a single marked vertex and O(k T Rmax ) for finding all k marked vertices, where T is an upper bound on the tree
size and Rmax is the maximum effective resistance encountered by the algorithm. This constitutes a speedup over
Montanaro’s original procedure in both the case of finding one and the case of finding multiple marked vertices
in an arbitrary tree.

DOI: 10.1103/PhysRevA.97.022337

I. INTRODUCTION algorithms scale with effective resistance and answer in the


affirmative.
In this paper, we construct a quantum algorithm for find-
In particular, for a tree of size at most T , we describe an
ing marked vertices in a rooted tree of unknown structure.
algorithm (Algorithm 1) that estimates its effective resistance
Search trees are a natural data structure for many compu-
η and, in doing so determines whether the tree contains at least
tational problems, notably constraint satisfaction problems
one√marked vertex. Algorithm 1 has an overall complexity of
(CSPs). Consider a CSP defined on a finite domain [d − 1] =  T η), where O  omits logarithmic factors. As one would
O(
{0,1, . . . ,d − 1} by a predicate P : [d − 1]n −→ {true,false}.
expect, and in contrast to Montanaro’s result, the decision
The objective of the decision problem is to determine whether
problem becomes easier as the number of marked vertices
there is at least one assignment x ∈ [d − 1]n such that P (x)
is increased. In the worst case, where there are no marked
evaluates to true. In many cases, we would like an algorithm
vertices,
√ our algorithm converges to Montanaro’s bound of
capable not only of deciding whether a satisfying assignment  T n), where n is an upper bound on the depth of the tree.
O(
exists, but also of returning one or more such assignments.
We then use the effective resistance estimate
 in Algorithm 2
Backtracking is a prevailing technique for solving CSPs,  T ηmax ) steps. Here
to find and output a marked vertex in O(
and in Ref. [1], Montanaro provides algorithms for both
ηmax is the maximum effective resistance over all subtrees that
deciding the existence of and outputting solutions to a CSP via
contain marked vertices. In every case with multiple marked
a discrete-time quantum walk on the underlying backtracking
vertices, this achieves a speedup over Montanaro’s algorithms.
tree. Unlike in most other quantum walk algorithms [2–5], the
If there are polynomially many marked vertices, this improves
input graph is defined implicitly (by the backtracking routine)
Montanaro’s algorithm by at least a factor of n, where n is
and therefore not known in advance. Montanaro’s existence
a bound on the depth of the tree. Furthermore, this allows us
algorithm is a special case of a quantum walk algorithm by
to directly compare the commute time of a classical random
Belovs [6], which is able √ to detect the presence of a marked
walk on the tree to the success rate of the quantum backtracking
element in a graph in O( W η) steps, where W is the total
algorithm.
weight of the graph and η is its effective resistance. Although
Our approach shows that the effective resistance of a
this work inspired Montanaro’s algorithm, the latter achieves
search tree can be efficiently computed, even without a priori
a somewhat weaker asymptotic bound in a more restricted set
knowledge of the tree’s structure. Having determined the
of problems than Belovs’ original result suggests might be
effective resistance, we are able to perform a walk that finds
possible. Hence, we investigate whether quantum backtracking
a marked vertex with an expected O(log(kη)) measurements.
Previously, algorithms for estimating effective resistance have
been tailored to situations where at least the set of vertices
*
mjarret@pitp.ca or edges is known beforehand [7]. Although the method of
† Ref. [7] does not seem immediately applicable to the present
kianna.wan@gmail.com

2469-9926/2018/97(2)/022337(13) 022337-1 ©2018 American Physical Society


MICHAEL JARRET AND KIANNA WAN PHYSICAL REVIEW A 97, 022337 (2018)

problem and we altogether avoid spectral theory, this paper that f (m) =√1, there is a quantum algorithm which returns
can be loosely viewed as a step towards demonstrating the m using O( T n log3 n log(1/δ)) queries to f and h for any
utility of effective resistance estimates in search problems. Our 0 < δ < 1. The algorithm requires O(1) auxiliary operations
estimation procedure is similar to those found in Refs. [8,9], per query and poly(n) space and fails with probability at most δ.
which also employ amplitude estimation to estimate effective In many problems, however, we are not given the promise
resistance; however, our application of amplitude estimation of a unique marked vertex. Unfortunately, as the number of
is arrived at somewhat differently and is not intended to marked vertices is increased, it becomes increasingly unlikely
estimate effective resistance to within low multiplicative error. that measuring the output state of phase estimation in the
(Achieving low multiplicative error is indeed possible with the computational basis returns any state other than the input
algorithms we present, but is not the focus of this paper.) root. Therefore, for trees with potentially more than one
The algorithm of Ambainis and Kokainis in Ref. [10] marked vertex, Montanaro finds marked vertices by applying
also improves upon Montanaro’s complexity bound in certain his existence algorithm in conjunction with a classical descent.
settings, but by estimating the tree size rather than the effec- The search algorithm begins by considering each child c of
tive resistance. The tree-size-estimation strategy sometimes the root vertex r in turn and determining whether at least
confers an advantage over estimating effective resistance, one marked vertex exists in the subtree T (c) rooted at c
particularly if the known upper bound on the tree size is too (using the existence routine). For a child c0 of r for which
large. Additionally, some of the analysis of our algorithm is the subtree T (c0 ) is found to contain at least one marked
quite similar to that for tree-size estimation; however, we apply vertex, the algorithm checks whether c0 is marked. If so, c0 is
amplitude estimation to the output of phase estimation whereas returned, and if not, the procedure is repeated on the children
Ambainis and Kokainis estimate the phase of the eigenvector of c0 . Once the algorithm finds a marked vertex, it returns the
closest to the eigenvalue-1 eigenvector. This suggests that an vertex, unmarks it, and restarts at the root, until all k vertices
algorithm that integrates the approach of Ref. [10] with ours are discovered. Assuming that the degree of every vertex in T
may achieve better scaling than either taken independently. is O(1), the following bounds are thus achieved.
Indeed, the results of Ref. [9] suggest that a tighter bound Theorem 3. For T , f , h, T , and n defined as in Theorem 1
should be possible, even in the case where the structure of the and any 0 < δ < 1, there is a quantum algorithm which returns
graph is unknown. √ that f (v) = 1 or none if no such v exists using
v such
O( T n3/2 log n log(1/δ)) queries to f and h. The algorithm
requires O(1) auxiliary operations per query and poly(n) space
A. Previous work
and fails with probability at most
√ δ. It can be repeated to find
In his approach to the decision problem, Montanaro spe- all k marked vertices using O(k T n3/2 log n log(k/δ)) queries
cializes Belovs’ algorithm for determining the existence of to f and h.
marked vertices in a graph [6,11] to rooted trees [1]. The Ambainis and Kokainis reduce the number of steps needed
algorithm applies phase estimation to the product of two for trees with multiple marked vertices by introducing a tree-
diffusion operators (defined in Sec. II D), using the root of size-estimation algorithm in Ref. [10]. The result is similar
the search tree as the input state. When taken to high enough to Theorem 3 with the upper bound T on the size of the tree
precision, if one or more vertices in the tree are marked, phase replaced by the number of vertices T  actually visited by a
estimation returns the eigenvalue 1 with probability at least classical backtracking algorithm.
1/2. If none of the vertices are marked, the eigenvalue 1 is seen
with probability less than 1/4. A straightforward application
of a Chernoff bound then decides existence. B. Main results
Theorem 1. Let T be a tree with root r and vertex set In Ref. [1], Montanaro leaves open the question of whether
V (T ). Let T denote an upper bound on the number of vertices an algorithm similar to that of Theorem 2 can be used to obtain
|V (T )| and n an upper bound on the depth of T . Define a similar bound for trees with an arbitrary number of marked
the functions f : V (T ) → {0,1}, where for a vertex v ∈ T , vertices. We proceed to such a generalization in the present
f (v) = 1 if v is marked and f (v) = 0 otherwise, and the oracle work.
h such that h(v) returns the set of children of v. Then, for any We first establish the following theorem, which utilizes the
0 < δ < 1, there is a quantum algorithm which takes r as input effective resistance η between the root vertex of the input tree
and√determines whether {v ∈ V (T )|P (v) = true} = ∅ using T and the set of marked vertices in T (which we will refer to
O( T n log(1/δ)) queries to f and h. The algorithm requires as the effective resistance of T ). Note that for trees with many
O(1) auxiliary operations per query and poly(n) space and fails marked vertices, this effective resistance can be substantially
with probability at most δ. smaller than the resistance between r and a particular marked
In the case where one and only one marked vertex is vertex, but never less than 1/dr , where dr is the degree of the
promised to exist, Montanaro measures the output state of the root.
phase estimation procedure described above in the computa- Theorem 4. For T , f , h, T , and n defined as in
tional basis and then uses the measurement outcome as the Theorem 1 and any 0 < δ < 1, there is a quantum algo-
new input root. Within an expected O(log n) repetitions, this √ which determines whether {v ∈ V (T )|f (v) = 1} = ∅ in
rithm
routine returns a marked vertex. Thus, Montanaro proves the O( T η log(1/δ)) queries to f and h, where η is the effective
following theorem. resistance of T (not necessarily known beforehand). The
Theorem 2. Let T , f , h, T , and n be defined as in Theorem 1. algorithm requires O(1) auxiliary operations per query and
Given the promise that there exists exactly one m ∈ V (T ) such poly(n) space and fails with probability at most δ.

022337-2
IMPROVED QUANTUM BACKTRACKING ALGORITHMS … PHYSICAL REVIEW A 97, 022337 (2018)

We use Theorem 4 to bound the number of steps taken to find unmarking a marked vertex once it is found, thereby giving
a marked vertex. Letting T (v) denote the subtree of T rooted access to its next shallowest marked descendants (if any) in the
at v and η(v) the effective resistance between v and the set next run.
of marked vertices in T (v), we define the maximum effective
resistance ηmax as the largest finite η(v) over all subtrees T (v). B. Notation
The polylogarithmic factors in the theorem below depend on
η [=η(r)], which may be smaller than ηmax . We use the following notation to describe the input tree T :
Theorem 5. Let T , f , h, T , n, and η be defined as in Theorem T denotes an upper bound on the number of vertices in T , n
4. Let η(v) denote the effective resistance of the subtree rooted denotes an upper bound on the depth of T , d denotes an upper
at v and define bound on the degree of any vertex in T , v denotes the depth
of a vertex v ∈ V (T ) and dv denotes its degree [accordingly,
ηmax = sup η(v). (1) v  n and dv  d for all v ∈ V (T )], and k is the total number
v ∈ V (T ) of marked vertices in T . For any vertex v ∈ V (T ), we write
η(v) < ∞
T (v) to denote the subtree of T rooted at v. For two vertices v
Then, for any 0 < δ < 1, there is a quantum algorithm which and u where u is a vertex in T (v), we write P(v,u) to denote the
returns a v ∈ V(T ) such that f (v) = 1 or none if no such v (shortest) path in T connecting v to u. Further, c ← v indicates
exists using O( T ηmax log4 (kη) log(1/δ)) queries to f and h. that vertex c is a child of vertex v. A summation indexed by
The algorithm requires O(1) auxiliary operations per query c ← v is hence a sum over all of the children of vertex v.
and poly(n) space and fails with probability at most δ. Additionally, we adopt a few conventions for ease of presen-
If desired, the algorithm of the above theorem can be tation. First, where we expect no confusion, we abusively write
repeated k times to return √ all k marked vertices, resulting in u ∈ T (v) instead of u ∈ V (T (v)) and (u,w) ∈ T (v) instead of
an overall runtime of O(k T n log4 (kn) log(k/δ)). Although (u,w) ∈ E(T (v)). That is, we use a single identifying variable
this is a loose bound, based on the fact (proven in Sec. VI) to represent a vertex and a pair to represent an edge, dropping
that the effective resistance is upper bounded by the depth the explicit specification of the appropriate set. We also follow
of the tree, it already achieves an improvement over Theorem the convention that an empty sum evaluates to zero. Finally,
3. To tighten the bound, one would need to take into account we denote the set of all shallowest marked vertices in the input
the change in effective resistance that results from unmarking tree T by M. This is the subset of marked vertices that do not
marked vertices that have been found. This is an interesting have any marked ancestors. To be precise,
question in its own right, but beyond the scope of this paper.
M ≡ {m ∈ V (T ) : f (m) = 1,
In Sec. V, we explore an example problem in which the bound
can be tightened, Grover’s search, and show that in at least f (v) = 0 ∀v ∈ P(r,m) \ {m}}.
some cases our algorithm achieves optimal scaling.
We then define M(v) ≡ M ∩ V (T (v)) for any v ∈ T as the
set of shallowest marked vertices in the subtree T (v) rooted
II. PRELIMINARIES at v.
A. Setting
We consider a tree T of bounded degree, with vertex set C. Phase and amplitude estimation
V (T ) and edge set E(T ). We assume access to the following: Our algorithm, like that in Ref. [1], applies quantum phase
(i) the root vertex r of T , (ii) upper bounds on the depth and size estimation on a particular unitary operator, with input state |r .
of T , (iii) an upper bound d on the degree of each vertex in T , We recall the statement of phase estimation from Ref. [1].
(iv) an oracle h which, for each v ∈ V (T ), returns a tuple that Theorem 6 (phase estimation [1]). For every integer s 
encodes the children of v, and (v) an oracle which efficiently 1 and every unitary operator U on m qubits, there exists a
evaluates a function f : V (T ) −→ {0,1}. We call a vertex uniformly generated quantum circuit C such that C acts on
v ∈ V (T ) marked if f (v) = 1 and not marked if f (v) = 0. m + s qubits and the following hold.
For simplicity, we will assume that f (r) = 0, i.e., that the root (a) C uses the controlled-U operator O(2s ) times and
vertex is never marked. This could always be ensured by first contains O(s 2 ) other gates.
checking whether the root is marked and if so, returning and (b) If U |ψ = |ψ , then C|ψ |0s = |ψ |0s .
unmarking it. (c) If U |ψ = e2iθ |ψ with θ ∈ (0,π ), then C|ψ |0s =
The purpose of our algorithm is to find the marked vertices |ψ |ω , where
in T . Each run of the algorithm returns one of the shallowest
marked vertices, i.e., a marked vertex that has no marked | ω|0s |2 = sin2 (2s θ )/22s sin2 θ.

ancestors. In a standard CSP, such as the Boolean satisfiability (d) For any |φ = j λj |ψj ∈ (C2 )⊗m , where U |ψj =
problem, where marked vertices can be associated with sat- e2iθj |ψj ,
isfying solutions, it is typically the case that if a particular 
vertex is marked, then so are all of its descendants. In such C|φ |0s = λj |ψj |ωj ,
contexts, therefore, only the set of these shallowest marked j
vertices is of interest. In the abstract, however, one can easily 
imagine a setting where, despite a vertex being marked, a with j : θj  | ωj |0s |2 = O(1/2s ).
subset of its descendants are not. Our method is able to Amplitude estimation, which is also used in our procedure,
find all of the marked vertices in either scenario, simply by is based on phase estimation [12]. We state it a bit differently

022337-3
MICHAEL JARRET AND KIANNA WAN PHYSICAL REVIEW A 97, 022337 (2018)

below since we will not need to analyze the resulting quantum for O(log(n)) different choices of η, these operators can be
state. Rather, we are mostly interested in determining whether implemented efficiently given that RA (n) can be implemented
the squares of probability amplitudes are within a constant of efficiently (as is explicitly demonstrated in Ref. [1]). An
1/2, which is quite similar to distinguishing the state |0s from application of the operator RB RA (η) amounts to a step in the
the rest of the state space of the ancilla qubits. quantum walk.
Theorem 7 (amplitude estimation). For every integer s 
1 and every unitary operator U on m qubits, there exists a
III. ALGORITHMS
uniformly generated quantum circuit C such that C acts on
m + s qubits and the following hold. In Ref. [1], Montanaro proposes an algorithm for trees in
(a) C uses the controlled-U operator O(2s ) times and which a unique marked vertex is promised to exist. Given such a
contains O(s 2 ) other gates. tree and its root vertex as the input state, phase estimation on the
(b) If U |ψbad = |ψbad , then C|ψbad |0s = |ψbad |0s . operator RB RA (η), defined as in Sec. II D except with η set to n,
Similarly, if U |ψgood = −|ψgood , then C|ψgood |0s = is used to approximately produce a superposition state over the
|ψgood |π/2 . vertices on the path from the root to the unique marked vertex.
(c) If |ψ = sin θ |ψgood + cos θ |ψbad for θ ∈ (0,π
 ), then a With probability 1/2, measuring this superposition in the
measurement of the second register of C|ψ |0s = i |ψi |θi computational basis collapses it to some state corresponding
returns a state | θ such that for = k/2s and some to a nonroot vertex. This procedure is then repeated with the
integer 1 < k  2s , (i) Prob(| θ − θ |  ) = 1 − O(1/2s ) resulting state as the input until a marked vertex is reached.

and (ii) Prob(|θ − θ | > 2 ||θ − θ |  ) = O(1/2s ) for Conditioned on measuring away from the root, any nonroot
some constant θ ∈ [0,π ) and where the differences are vertex along the path is sampled with equal probability. As
taken mod π . a result, the number of steps to reach a marked vertex is
logarithmic in the depth n (in contrast to the polynomial
overhead that would be incurred by classical descent).
D. Diffusion operators
Our algorithm is essentially a generalization of this scheme
Our algorithm finds marked vertices in T using a quantum to trees containing an arbitrary number of marked vertices
walk on the Hilbert space spanned by V (T ), with initial (not necessarily known beforehand) and uses the same basic
state |r . This quantum walk is effected by a set of diffusion framework. Algorithm 2 creates a superposition state | with
operators, adapted from Refs. [1,6,10]. support only on vertices that either are marked or have marked
Let η = 2i /d be an input parameter to the algorithm, where descendants. Unlike in the restricted case of a single marked
i ∈ [log dn]. For each vertex v ∈ T , the corresponding vertex, naively running Montanaro’s algorithm with η = n on
diffusion operator Dv is defined as follows: If v ∈ M, then a tree with multiple marked vertices may, depending on the
Dv is the identity operator; if v ∈ M, then distribution of the marked vertices in the tree, result in a state
for which the probability | |r |2 of measuring |r is too large.
Dv (η) ≡ I − 2|ψv (η) ψv (η)|, It turns out that with η set to the effective resistance of the tree,
| can be prepared with fixed precision and | |r |2 can be
where for v ∈ T , kept close to 1/2.
  √   However, since the structure of the input tree and the
√ 1 |v + η c←v |c if v = r distribution of the marked vertices are not known, the effective
|ψv (η) ≡ 
1+dv η
  (2)
√1 |v +
dv c←v |c if v = r. resistance η cannot be determined in advance. Algorithm 1
describes the method by which we obtain an estimate  η such
Each diffusion operator Dv acts only on the subspace that |η − η|  O( η) for a fixed . For a given upper bound
spanned by the vertex v and its children and can therefore d on the degree of the tree, we begin by assuming η ≈ 1/d and
be implemented with only local knowledge. Specifically, it then increment η until it hits  η or its maximum possible value
requires access to only the oracles f and h: f is evaluated at of n. Provided that the algorithm does not exit early, which we
v to check whether v is marked and h gives the children of v. will show is exceptionally unlikely, the interpolation crosses
Our diffusion operators are identical to those in Ref. [1] an η “close enough” to η with certainty if such an η exists.
with the exception of Dr , which is defined with respect to the Since the last iteration of the loop effectively implements
parameter η instead of the maximum depth n. This parameter Montanaro’s existence algorithm from [1], if is taken to
will be tuned in Algorithm 1 and, as will be shown in Sec. VI, be sufficiently small, the last iteration will produce ∞ if there
its “optimal” value is equal to the effective resistance of T . are no marked vertices. If we are interested in a more precise
Now let A be the set of vertices that are at even distances estimate of η, after Algorithm 1 returns some estimate  η such
from the root (including the root itself) and let B be the set of that η/η ≈ 1, we can perform amplitude estimation to higher
vertices at odd distances from the root. We define the unitary precision but with initial guess  η. Alternatively, we can replace
operators 2i in Algorithm 1 with S i , where S ∈ (1,2). Because it is
sufficient for our application to backtracking algorithms, we
RA (η) ≡ Dv (η), RB ≡ |r r| + Dv (·) assume that a multiplicative step size of 2 produces the desired
v∈A v∈B level of precision.
Algorithm 1 is implemented in a loop in Algorithm 2, which
RA (η) is√
as direct sums of diffusion operators. Because just a uses effective resistance estimates to find a marked vertex as
rotation of RA (n) in the subspace span({|r , c←r |c / dr }) follows. Starting at the root vertex r, we obtain an estimate

022337-4
IMPROVED QUANTUM BACKTRACKING ALGORITHMS … PHYSICAL REVIEW A 97, 022337 (2018)

Algorithm 1. Estimate effective resistance Estimate-Res(v).

Require: A vertex v ∈ T ; upper bounds n, T , and d on the depth, number of vertices, and degree of T , respectively; unitaries RA (·) and RB ; a
failure probability δ0 ; universal constants γ1 and γ2 .
1: i ← 0.
2: η ← min{2i /d,n}.
3: Let C(η)|v |0s = sin(βη )|v |0s + cos(βη )|ψbad be the output of phase estimation with unitary RB RA (η), input state |v , and s
ancilla qubits in the phase register.
4: Perform amplitude estimation on the second register γ1 log(1/δ0 ) times with |ψgood = |0s and precision γ2 . Let the output be the
 = {β
multiset  j }j .
5: j ∈ 
If more than half of the elements β  satisfy |β
j − π/4|  π/16, return  η = η cot2 β where β  is the most frequent element in  .
6: If η = n, return ∞.
7: Increment i, go to step 2.


η using Estimate-Res(r). Given that η ∼ η, the output | of A. On the path to marked vertices
phase estimation on unitary RB RA (η) with input state |r is For each marked vertex m ∈ M, the state
expected to satisfy | r| 2 − 1/2|  with high probability. 

By measuring | in the computational basis and setting the |φm = η|r + (−1)v |v
output as the new root, we progress down the tree towards v ∈ P(r,m)
a marked vertex. Appendix B demonstrates that the expected v = r
number of steps in this walk is O(log(kη)).
is an eigenvector of RB RA (η) with eigenvalue 1. This can be
seen from the fact that for a given η, |φm as defined above is
IV. ANALYSIS orthogonal to |ψv (η) for all v ∈ T [cf. Eq. (2)]. In addition,
|φm encodes the entire path P(r,m) from the root r to the
In this section, we analyze Algorithms 1 and 2. Section IV A marked vertex m.
defines a particular eigenstate | of the unitary RB RA (η) We introduce the state
that will be used to find marked vertices and Sec. IV B 
describes how phase estimation can be applied to prepare | ≡ Cm |φm
such an eigenstate. In Sec. IV C, we evaluate the accuracy and m∈M
efficiency of the section in returning a useful value for the √   
= η Cm |r + Cm (−1)v |v (3)
parameter η. We bound the expected runtime of Algorithm 2
m∈M m∈M v ∈ P(r,m)
in Sec. IV D. v = r
As will be made more evident in Sec. IV C, in the case of no
marked vertices, our algorithm reduces to an algorithm similar as a normalized superposition of these path eigenvectors with
to that of Theorem 1. Therefore, we assume in the following real coefficients (Cm )m∈M . Clearly, | has support only on
discussion that there exists at least one marked vertex in the the shallowest marked vertices in T and their ancestors.
search tree T . Accordingly, we define the solution tree T to be the largest
Algorithm 2. Find a marked vertex.

Require: The root vertex r of T ; upper bound on the number of vertices in T ; unitaries RA (·) and RB ; other inputs required for
Estimate-Res(r).
1: v ← r.
2: If f (v) = 1, return v.
3: 
η ← Estimate-Res(v).
4: while 
η = ∞ do

5: η)|v |0s =
Let√| = C( i αi |ψi |ωi be the output of phase estimation with unitary RB RA (
η), input state |r , and precision
O( 1/T η).
6: Measure the second register of | in the computational basis. Let the output be |ω .
7: If ω = 0s , continue.
8: Measure the first register of | . Let the output be |o .
9: v ← o.
10: If f (v) = 1, return v.
11: 
η ← Estimate-Res(v).
12: return “no marked vertex.”

022337-5
MICHAEL JARRET AND KIANNA WAN PHYSICAL REVIEW A 97, 022337 (2018)

subtree of T in which all leaves are the shallowest marked Lemma 4 of Sec. VI demonstrates that κ satisfies Eqs. (7)–
vertices on their respective paths, i.e., (9) if and only if for every m0 ∈ M,


T ≡ P(r,m).   
κm κm = 1. (10)
m∈M
m∈M v ∈ P(r,m0 ) m ∈M(v)
v = r
We use T(v) to indicate the subtree of T rooted at a vertex
v ∈ T. Letting This constitutes a system of |M| equations that determines
√  (κm )m∈M and therefore κ uniquely [cf. Eq. (7)]. An important
sin β ≡ r| = η Cm (4) implication of Eq. (10) is that κ is independent of the input
m∈M parameter η and depends only on the structure of T. In
particular, we will show in Theorem 10 of Sec. VI that κr2
and defining κ : V (T ) −→ R by
is an invariant of finite trees and that its value is bounded in
1  terms of the number of marked vertices, the degree of the root
κv ≡ κ(v) = Cm , (5) vertex, and the (maximum) depth of the tree as
cos β m∈M(v)
  
1 1 1
we rewrite Eq. (3) as ∈ max , ,n . (11)
κr2 k dr

| = sin β|r + cos β (−1)v κv |v . (6) As will be further discussed in Sec. IV C, we exploit this result
v∈T in designing Algorithm 1, which tunes the input parameter η
v = r so as to optimize the superposition state | for our intended
purpose. That is, if we are able to produce a state | such that
By construction, κ satisfies r| is not too large, a state closer to the marked state can be
 revealed by measuring | in the computational basis. Indeed,
κv if v ∈ M
κv =  (7) it follows from Eqs. (4) and (5) that
c←v κv if v ∈ M, √
tan β = ηκr . (12)
with κv = 0 for v ∈ T (using the convention that an empty sum This implies that if there exists at least one marked vertex, then
is equal to zero), as well as normalization: there is a particular value of η, determined by the structure
 of the search tree, for which the the probability | r| |2 of
κv2 = 1. (8) sampling |r is approximately 1/2. Section IV C shows that
v∈T when η is equal to the effective resistance η of the tree, the
v = r
probability of sampling the root vertex is 1/2.2 In the following
We further constrain κ as follows: For every vertex v ∈ T section, we demonstrate that the particular superposition of
and any marked vertices m0 ,m1 ∈ M(v), eigenvectors | defined here can be approximately produced
  via phase estimation.
κu = κu . (9)
u∈P(v,m0 ) u∈P(v,m1 ) B. Complexity of preparing |
This section primarily follows Ref. [1], with relevant ad-
In other words, given any vertex v in the solution tree T, the
justments as they become necessary in the generalization to
weight in | on the path from v to a marked vertex in T(v)
trees with possibly more than one marked vertex.
is independent of the choice of marked vertex. One can easily
For a fixed value of η and given | as defined in the pre-
see that as a consequence of this condition, κm = 0 for at least
ceding section, let | ⊥ denote the particular normalized state
some m ∈ M. If this were not the case, Eq. (7) would imply
orthogonal to | such that |r = r| | + r| ⊥ | ⊥ ,
κv = 0 for all v ∈ T , violating Eq. (8).
that is,
As will become clear, a set of coefficients satisfying 
Eqs. (7)–(9) is guaranteed to exist and are unique (up to a global | ⊥ ≡ cos β|r − sin β (−1)v κv |v . (13)
phase).1 [For consistency with Eq. (5), we choose them to all v∈T
be real.] In particular, the constraint imposed by Eq. (9), which v = r
will justified in the following analyses, allows us to determine
some interesting properties of the solution tree T. We state By direct calculation,
some of the results relevant to this section below, postponing ⊥ |φm = 0 (14)
their proofs until Sec. VI.
for all m ∈ M.

1 2
The reader familiar with the theory of electrical networks and flows In Sec. IV C, the relative amplitude in the root and nonroot states
may already see how Eq. (9) can naturally follow from considering a is characterized by cot2 β. We call η achieving cot2 β = 1 optimal in
voltage between the root and the set of marked leaves. We nonetheless that it assigns equal probability to sampling either a root or nonroot
avoid this theory, as it obfuscates some of the ideas used in our walk. state.

022337-6
IMPROVED QUANTUM BACKTRACKING ALGORITHMS … PHYSICAL REVIEW A 97, 022337 (2018)

We perform phase estimation on unitary RB RA (η) with s , we then have


| 0s | 2 |2 = sin2 β + O(δ 2 ). For any β
ancilla qubits and input state
|
|sin2 β − sin2 β
|r = sin β| + cos β| ⊥ ,
| + || 0s | 2 |2 − sin2 β|
 || 0s | 2 |2 − sin2 β
which yields a state of the form
 | + O(δ 2 ).
= || 0s | 2 |2 − sin2 β
| = sin β| |0s + cos β λj |ψj |ωj . (15)
j
 is an accurate estimate of | 0s | 2 |,
This means that if sin β
By virtue of Eq. (14), we can take the eigenvectors |ψj then it approximates sin β with similar accuracy.
in the expansion of | ⊥ to be orthogonal to the space Now suppose that || 0s | 2 |2 − sin2 β|  1/σ for some
spanned by the path eigenvectors, i.e., such that |ψj = 0 1/σ  O(δ ). This gives
2

for all j . Decomposing each |ωj as |ωj = μj |0s + |ωj ,


 
where the |ωj are subnormalized vectors orthogonal to |0s , 1 1
| 
|sin2 β − sin2 β + O(δ 2 ) = O .
|0 upon
s
the probability of obtaining measuring the second σ σ
register is sin β + cos β j |λj μj |2 , in which case the first
2 2

register collapses to We use this inequality to bound the error in  η returned by


1 Algorithm 1. Let η be the final value queried by Algorithm 1,
 = 
|   the output of amplitude estimation (step 4 of
η = η cot 2 β

sin2 β + cos2 β j |λj μj |2 Algorithm 1), and sin2 β the amplitude that was estimated. By
⎛ ⎞ Eq. (12) and Sec. VI, tan2 β = η/η. Note that for any η queried
 by Algorithm 1, this results in η = η cot 2 β and  :
η = η cot 2 β
× ⎝sin β| + cos β λj μj |ψj ⎠. (16)
j
|η −  |
η| = η|cot 2 β − cot 2 β
It follows immediately from Theorem 6 that  
 1 1 
    = η 2 −
1 sin β sin2 β
|λj μj |2  |μj |2 = O s . (17)
j : θ  j : θ 
2 η
j j
= |
|sin2 β − sin2 β

sin β sin2 β
2
In order to distinguish the state |0s from all other states, we
also need to bound the terms indexed by j such that 0 < θj < . η
We prove the following lemma in Appendix A. = |.
|sin2 β − sin2 β
cos2 
β sin2 β
Lemma 1. Let P denote the projector onto span({|ψ :
RB RA (η)|ψ = e2iθ |ψ ,|θ |  }). Then
 − π/4|  π/16,
Since Algorithm 1 exits when |β

P | ⊥  = O( T η).

This lemma allows us to obtain |η − 
η|  |
|sin2 β − sin2 β
  cos2 β
|λj μj |2  |λj |2 = P | ⊥ 2 = O( 2 T η). |
|sin2 β − sin2 β
j : θj  j : θj   4η

|cos β − |sin β − sin2 β
2 2 ||
(18)
√ |
|sin2 β − sin2 β
√ for a3 fixed precision δ, taking = (δ/ T η) and 2 =  16η
s
Thus,
|1 − 4| sin β − sin2 β
2 ||
( T η/δ ) in the bounds of Eqs. (17) and (18) yields
  
1 + σ O(δ 2 ) η
|λj μj |2 = O(δ 2 ). (19)  16η =O .
j |σ − 4[1 + σ O(δ )]|
2 σ

 |2 −
This bounds the total variation distance as supi || i| Thus, the relative error in our estimate of η can be reduced
2  − |  = O(δ).
| i| | | = O(δ) and guarantees that | arbitrarily, up to the error of phase estimation itself, by taking
amplitude estimation to greater precision.
C. Algorithm 1
1. Accuracy of approximation 2. Failure rate
We begin our analysis by showing that the support on |0s It remains to analyze the failure rate of Algorithm 1.
of the output state | of phase estimation [cf. Eq. (15)] is Consider step 5 of Algorithm 1. Let Xi ∈ {0,1} be a coin that
a reasonable estimate of the amplitude r| = sin β. Letting returns 0 whenever |βi − π/4|  π/16 and 1 otherwise. By
| 2 denote the state of the second register of | , | 0s | 2 | Sec. II C, Prob(Xi = 0 | |βη − π/4|  π/8)  cγ2 for some
is simply the inverse of normalization constant in Eq. (16). constant c. We apply the Chernoff-Hoeffding theorem [13]
Hence, recalling Eq. (19), we fix a precision δ and write with probability p = cγ2 and γ1 log(1/δ0 ) repetitions of the

022337-7
MICHAEL JARRET AND KIANNA WAN PHYSICAL REVIEW A 97, 022337 (2018)

experiment to get log dη


Now, for the full sequence of queries (ηi = 2i /d)i=0
made by Algorithm 1, we can write
1 
Pr Xi  p + ε||βη − π/4|  π/8 
γ1 log(1/δ0 ) i √ 
m
2i 2(m+1)/2 − 1 
ηi = = √ = O( η)
 p+ε  1−p−ε γ1 log(1/δ0 ) d d( 2 − 1)
p 1−p i i=0
 √
p+ε 1−p−ε provided that 2(m+1)/2  2η. If the algorithm exits suc-
cessfully, i.e., when |βη − π/4|  π/8, this is always the
= [4p(1 − p)]γ1 log(1/δ0 )/2  (4p)γ1 log(1/δ0 )/2
case. Because the probability of exiting√ with βη > 3π/8
= (4cγ2 )γ1 log(1/δ0 )/2 . [which requires runtime greater than O( T η)] is bounded
by O(δ0 log(n)/n), we know that these occurrences will not
For an appropriate choice of γ2 < 1/2c, we have p < 1/2 and contribute to the scaling
 of the expected runtime. Thus,
we let ε = 1/2 − p. This also yields Algorithm 1 runs in O( T η/ 3
√ log(1/δ0 )) steps and requires
 at most an additional O(log n) ancilla qubits. If our goal is
1  1  only to determine the existence of a marked vertex, we can
Pr Xi  |β − π/4|  π/8
γ1 log(1/δ0 ) i 2 interpret any output of 
η < ∞ as an indication that a marked
vertex exists and 
η = ∞ as nonexistence.
 (4cγ2 )γ1 log(1/δ0 )/2 .

Therefore, there exists a γ2 < 1/8c n such
√ γthat the failure rate D. Algorithm 2
for each loop of Algorithm
√ 1 is O((1/ n) 1 log(1/δ0 )/2
), where Algorithm 2 implements an extended version of Mon-
we include a factor of n for future convenience. tanaro’s formulation for trees containing a unique marked
By choosing an appropriate constant γ1 > 2 in Algorithm 1, vertex [1]. With the parameter η in RB RA (η) set to η, the
we can weaken this bound to O(δ0 /n), which simplifies some probability that the outcome of measuring |  in the com-
of the computations in this section. Thus, the probability that putational basis is a vertex other than the root is within a
Algorithm 1 does not exit before querying an η corresponding constant of 1/2. Conditioned on each iteration of the loop
to a βη such that |βη − π/4|  π/8 is 1 − O(δ0 /n).3 Similarly, sampling a nonroot vertex, the algorithm returns a marked
the probability that the algorithm exits once it reaches a state vertex with O(log kη) measurements, as proven in Appendix B.
for which |βη − π/4|  π/8 is 1 − O(δ0 /n). Then probability We hence fix a precision δ = O(1/log(kη)). Then,
of success is then √ by the same
argument √ as that in Ref. [1], letting 2s = ( T η/δ 3 ) and
 log dη   = (δ/ T η) guarantees that with probability (1), none of
δ0 δ0 log dη
1−O 1−O the O(log kη) measurements sample away from the support of
n n | .
√Matching δ0 from Algorithm 1 to δ, the expected
 runtime is
and the algorithm returns an estimate such that | η − η| = O( T η log3 (kη)) per step and therefore O( T ηmax log4 (kη))
O( η), where ∈ [γ2 ,1/8) is the error from amplitude for the entire procedure, where ηmax is defined in Eq. (1). The
estimation, with probability greater than 1 − O(δ0 ). If there precision can be increased arbitrarily through repetition. Up to
are no marked vertices, the algorithm runs to completion and logarithmic factors, in all cases where k ∼ poly(n), this results
 improvement over Montanaro’s algorithm
in at least an O(n)
returns η = ∞ with probability given by the above expression
with η = n. of Theorem 3. For problems in which the effective resistance
 3/2 ).
of all subtrees is O(log n), the speedup is O(n
For our purpose of backtracking, it does √ not help to
prepare a state with precision δ less than . Hence, for If an upper bound on k is not provided (or we suspect
any iteration of that the bound is not tight), we can initially take k = 1 and
 Algorithm 1 with parameter

η, we can always
double our guess of k until a marked vertex is returned. This
take 2s = O( T η/ 3 ) and = ( √ /T η). This prepares a
will take at most log k repetitions. If we reach a k such that
 
state | such that | − |  = O( ) using O( T η/ 3 ) log k ∼ n without having found a marked vertex, we can use
applications of RB and RA (η). Since the complexities of Algorithm 1 in the manner of the algorithm of Theorem 3.
preparing the state and of estimating the relevant amplitude Namely, starting at the root r, whenever Algorithm 1 with
are additive,
 the expected runtime for theloop with parameter input vertex r returns η < ∞, we apply Algorithm 1 to each

η is O( T η/ 3 + n log(1/δ0 )) = O( T η/ 3 log(1/δ0 )). child c ← r. If Algorithm 1 returns η < ∞ for some c, then
we repeat the process with c as the new input. Choosing
< 1/8 and δ0 = O(1/n), we expect a success √ rate of (1).
Thus, we return a marked vertex in time O(n T η). Hence, for
3
The bound of π/8 is weakened from the rejection bound of π/16 in low-resistance trees with√ exponentially many marked vertices,
Algorithm 1 in order to account for the possibility that βη ≈ 3π/16.  n) improvement over the algorithm
this still results in an O(
In such an event, the algorithm can exit “successfully” while still of Theorem 3.
returning a β ≈ π/4. This bound can be tightened arbitrarily by As we will see in the following section, the iterative
adjusting the multiplicative step size from multiples of 2 to multiples approach to finding a suitable value for the parameter k can
of S ∈ (1,2). Alternatively, one can simply run amplitude estimation sometimes result in an overall tighter bound. This suggests that
to higher precision after an initial rough estimate has been made. there exists a strategy which can reduce logarithmic factors

022337-8
IMPROVED QUANTUM BACKTRACKING ALGORITHMS … PHYSICAL REVIEW A 97, 022337 (2018)

by using the estimates of η to deduce information about the The remainder of this section will develop the proof of this
structure of the tree. theorem. In Lemma 2, we demonstrate that for κ satisfying
the conditions of Theorem 8, κv0 and κv1 have the same sign
V. OPTIMALITY OF THE ALGORITHM: GROVER’S for all vertices v0 ,v1 ∈ T. Lemmas 3 and 4 are technical
SEARCH REVISITED lemmas which are used to prove Theorem 9, our first statement
about effective resistance. Theorem 10 completes the proof
In the case of unstructured search, the bound achieved in of Theorem 8 by bounding the effective resistance. For the
Sec. IV D converges to Grover’s search and is therefore optimal remainder of this section, we assume that κ satisfies the
in at least some regimes. To see this, we can consider a database hypotheses of Theorem 8, i.e., Eqs. (7)–(9).
where all N database states are connected to a root vertex. If Lemma 2. For all v0 ,v1 ∈ T, κv0 κv1 > 0.
k of the N states are marked, the effective resistance of this Proof. First, we claim that for every vertex v ∈ T and any
tree is simply η = 1/k √ and the expected steps to find a marked leaf m ∈ M(v),
element scales like O(√ T /k log4 k). Noting that T = N + 1,
the naive bound is O( N/k log4 k). 
κm κu > 0.
The factor of log4 k can be removed by considering the
u∈P(v,m)
iterative approach outlined in Sec. IV D. That is, we begin by
setting k = 1 and double the value of k until a marked vertex This is trivially true if v is a leaf. Now assume this holds true
is returned. Since we take only one step (from the root vertex for every child c of a vertex v ∈ M. Then, for any two children
to one of the database states, which are all leaves in the tree) c0 and c1 of v and leaves m0 ∈ T(c0 ) and m1 ∈ T(c1 ),
and the logarithmic factors are merely there to ensure that our
state is sufficiently precise to complete the necessary number ⎛ ⎞⎛ ⎞
 
of steps, we only need the sampling procedure to succeed 0 < ⎝κm0 κu ⎠⎝κm1 κu ⎠
once per
√ marked vertex. Thus, this approach actually scales u∈P(c0 ,m0 ) u∈P(c1 ,m1 )
as O( N/k), with no logarithmic factors. ⎛ ⎞⎛ ⎞
 
VI. EFFECTIVE RESISTANCE OF TREES = κm0 κm1 ⎝ κu − κv ⎠ ⎝ κu − κv ⎠
AND THE PARAMETER η u∈P(v,m0 ) u∈P(v,m1 )
⎛ ⎞2
In this section, we prove a number of helpful lemmas 
concerning the particular function defined by Eqs. (7)–(9) on = κm0 κm1 ⎝ κu − κv ⎠ ,
the solution tree T rooted at r, which we subsequently use to u∈P(v,m0 )
establish a connection to effective resistance in the following
theorem. These results also arise naturally by identifying the where in the last line we have used Eq. (9). Thus, κm0 κm1 > 0
harmonic function in the Rayleigh quotient of the operator for all m0 ,m1 ∈ M(v), from which it directly follows that
RB RA (η) with the minimum energy function of a relevant flow
  
network on T, where the set of leaves M are all identified κm0 κu = κm0 κm > 0,
with a single point. Nevertheless, we construct this section in u∈P(v,m0 ) u∈P(v,m0 ) m∈M(u)
a self-contained fashion.
Consistent with the definition of T in Sec. IV A, we denote since for u ∈ P(v,m0 ) ⊆ T(v), m ∈ M(u) implies that m ∈
the set of leaves in T by M and the set of leaves in the M(v).
subtree T(v) rooted at v ∈ T by M(v). (In the context of Therefore, the claim is true for all v ∈ T, including for r,
the previous sections, the leaves of T comprise the shallowest and so κm0 κm1 > 0 for all m0 ,m1 ∈ M. Then,
marked vertices. The results derived in this section, however,
are applicable to arbitrary trees T with root r and leaf set M.) ⎛ ⎞⎛ ⎞
Theorem 8. Let κ : V (T
) −→ R be such that the following  
 κv0 κv1 = ⎝ κm0 ⎠⎝ κm1 ⎠
hold: v ∈ T κv2 = 1, κv = c←v κc for all v ∈ M, and for any
m0 ∈M(v0 ) m1 ∈M(v1 )
v = r
   
v ∈ T, u∈P(v,m0 ) κu = u∈P(v,m1 ) κu for all leaves m0 ,m1 ∈ = κm0 κm1 > 0,
M(v), where κv ≡ κ(v). Then η : {T(v)}v∈T −→ R0 defined m0 ∈M(v0 ) m1 ∈M(v1 )
by
 2 as desired. 
 w∈T (v) κw
η(v) ≡ η(T (v)) = −1 Without loss of generality, we henceforth assume that
κv2 κv > 0 for all v ∈ T.
Lemma 3. For every v ∈ T and any m ∈ M(v),
is an invariant of the set of subtrees {T(v)}v∈T and 
η(v) equals
the effective resistance between v and M(v) [through T(v)]  
for each v ∈ T. Furthermore, if T(v) is of maximum degree d κv κu = κu2 .
and maximum depth n and has at most k leaves, then u∈P(v,m) u∈T(v)
  
1 1 Proof. This is trivially true if v ∈ M, and assuming
η(v) ∈ max , ,n .
k d that this holds for every child c of v ∈ M, we have for

022337-9
MICHAEL JARRET AND KIANNA WAN PHYSICAL REVIEW A 97, 022337 (2018)

any m ∈ M(v) −1
 κc2
⎛ ⎞ = 
c←v u∈T (c) κu2
 ⎜  ⎟ −1
⎜ ⎟ 
κv κu = κv ⎜ κv + κu ⎟ 1
⎝ ⎠ = ,
u∈P(v,m) u ∈ P(v,m) η(c) + 1
u = v c←v
 
= κv2 + κc κu where the second and fifth lines follow from Lemma 3 and
c←v u∈P(c,m)
the third and fourth lines use the direct consequence
 of Eq. (9)
   that for children c of v and leaves m ∈ M(c), u∈P(c,m) κu is
= κv2 + κu2 = κu2 , independent of c.
c←v u∈T(c) u∈T(v) Therefore, for every v ∈ T, η(v) is unique and well defined.
Furthermore, since we have
where the second line follows from Eq. (7), the third from
1  1
Eq. (9), and the fourth from the induction hypothesis.  = ,
Lemma 4. For any m ∈ M, η(v) c←v η(c) + 1

κr κu = 1. η(v) satisfies the recurrence relation for the effective resistance
u ∈ P(r,m) of a circuit with source v and sinks M(v), where each edge
u = r has resistance 1. 
Corollary 1. For any child c of v,
Proof. This follows directly from Lemma 3 and
Eq. (8).  η(c) + 1 κv
Belovs’ original result relates the commute time of a classi- = .
η(v) κc
cal random walk with the problem of determining connectivity
via a quantum walk. In particular, the commute time can Proof. This follows from the definition of η(v) in Sec. VI
be characterized in terms of the effective resistance of the [cf. Eq. (20)] and the proof is omitted. 
corresponding graph, provided that the graph’s structure is Since {η(v)}v∈T is uniquely determined, Corollary 1 guaran-
known a priori [6]. In light of this, the following theorem, tees that, up to a global factor, κ is unique and well defined. The
which is essentially a statement about the effective resistance global factor is fixed by the normalization condition [Eq. (8)].
of trees, should not be too surprising. The fact that η = η(r) is the effective resistance of the tree
Theorem 9. For every vertex v ∈ T, T makes the following theorem fairly intuitive.
 Theorem 10. Let n denote the depth of the tree T, k ≡ |M|
2
u∈T(v) κu the number of leaves, and dr the degree of the root vertex r.
η(v) ≡ −1 (20) Then
κv2
  
1 1
is a unique map for all {T(v)}v∈T . η ∈ max , ,n .
Proof. We begin by noting that for a leaf m ∈ M, k dr
 2 First, we note that
u∈T(m) κu
η(m) = −1=0 1  2 1  2 1
κm2 η= κu − 1 = 2 κu = 2 ,
2
κr  κr κr
u∈T  u∈T
is clearly unique for the trivial graph T (m). Now assume u = r
that for every child c of v ∈ M, η(c) = u∈T(c) κu2 /κc2 − 1
is uniquely defined for T(c). Then by definition. We use the Cauchy-Schwarz inequality to obtain
 the upper and lower bounds. By Lemma 4, for any m ∈ M,
2
u∈T(v) κu ⎛ ⎞2
η(v) = −1
κv2
  ⎜  ⎟
1 ⎜ ⎟
κ2 u∈T(c) κu
2
=⎜ κu ⎟
= v2 +
c←v
 2 −1 2
κr ⎝ ⎠
κv u ∈ P(r,m)
c←v κ c u = r
  ⎛ ⎞⎛ ⎞
c←v κ c u∈P(c,m) κu
=  2 ⎜  ⎟⎜  ⎟
c←v κc ⎜ ⎟⎜ ⎟
 ⎜ 1⎟⎜ κu2 ⎟
⎝ ⎠⎝ ⎠
u∈P(c ,m ) κu u ∈ P(r,m) u ∈ P(r,m)
=  0 0 u = r u = r
c←v κc
−1 
 n κu2 = n.
κc2
=  u ∈ T
c←v c
κ u∈P(c,m) κu u = r

022337-10
IMPROVED QUANTUM BACKTRACKING ALGORITHMS … PHYSICAL REVIEW A 97, 022337 (2018)

In the other direction, for Theoretical Physics. Research at Perimeter Institute is


 −2  −1 supported by the Government of Canada through Industry
1    Canada and by the Province of Ontario through the Ministry
= κm  1 2
κm
κr2 m∈M m∈M m∈M
of Economic Development and Innovation.
⎛ ⎞−1
APPENDIX A: PROOF OF LEMMA 1
⎜  ⎟
⎜ ⎟ 1
 ⎜k κu2 ⎟ = . In this Appendix, we use the effective spectral gap lemma
⎝ 
⎠ k to prove that
u∈T
u = r
P | ⊥ 2 = O( 2 T η), (A1)
In addition, as a consequence of Theorem 9 (or simply the
definition of effective resistance), where P is the projector onto the span of eigenvectors of
RB RA (η) with eigenvalues e2iθ such that |θ |  and | ⊥
1  1 
is defined as in Eq. (13). To this end, we generalize Lemma 7
=  1 = dr .
η c←r η(c) + 1 c←r in Ref. [1] as follows.
Lemma 5 (effective spectral gap lemma [15]). Let A and
Thus, we have that η  max(1/k,1/dr ), as claimed.  B be projectors and let RA = 2A − I and RB = 2B − I
be the reflections about their respective ranges. Let P denote
VII. FUTURE DIRECTIONS the projector onto span({|ψ : RB RA |ψ = e2iθ |ψ ,|θ |  }).
This paper provides some natural directions for future work. Then, if A |ξ = 0, P B |ξ   |ξ .
Given If we are able to find a vector |ξ such that A |ξ = 0 and
 that we are able to achieve a bound that scales like B |ξ = | ⊥ , where A and B correspond to the diffusion
O( T ηmax ) in the case of trees of unknown structure (and that
our argument is compatible with the generalization to directed operators RA and RB defined in Sec. II D (we will suppress
acyclic graphs in Ref. [10]), it would be interesting to see the dependence on the input parameter η in the following),
to what extent these algorithms can be generalized to graphs Lemma 5 can be applied to prove our claim.
of unknown structure. The results of Sec. VI are derived in Proposition 1. Let A and B be the projectors onto
terms of local neighbors on the appropriate state space and span({|ψ : RA |ψ = |ψ }) and span({|ψ : RB |ψ = |ψ }),
it seems plausible that similar arguments from graph theory respectively. For v ∈ T (v) \ {r}, let p(v) denote the parent of
might offer insight beyond trees. We expect that as long as v in T . A vector v∈T αv |v satisfies
appropriate diffusion operators can be implemented, many A |ξ = 0, B |ξ = | ⊥ (A2)
of the statements above should hold for arbitrary graphs of
bounded degree. The challenge, then, lies in determining these if and only if (a) for all v ∈ B,
diffusion operators and deriving a theorem like the one in √
ηαr if p(v) = r
Appendix B. αv =
Aside from Montanaro’s analog of backtracking itself, we αp(v) otherwise,
do not make use of any of the methods utilized by modern (clas- (b) for all v = r ∈ A,
sical) backtracking algorithms, such as those considered in
Ref. [10]. The effective resistance η reveals some information αv = αp(v) − (κp(v) + κv ) sin β,
about the structure of the graph, thereby giving an indication
(c) αr = cos β, and (d) for every marked vertex m ∈ M,
of how “easy” it is to find a solution. One might imagine, 
for instance, systematically marking subsets of vertices in a 0 if m ∈ A
tree in an attempt to elucidate its structure, without incurring αm =
κm sin β if m ∈ B.
much additional overhead. Although it seems clear that the
information contained in estimates of η for trees or subtrees Proof. The eigenvalue-1 eigenspace of RA is spanned by the
can be exploited, explicit methods for doing so remain to be set of vectors
developed and the potential advantages are not yet obvious.
Finally, it may be worthwhile to determine the exact relation SA ≡ {|ψv⊥ : ψv⊥ |ψv = 0,v ∈ A} ∪ {|ψm : m ∈ A ∩ M}
between the distribution of marked vertices and the effective [cf. Eq. (2)]. Its orthogonal complement is then spanned by
resistance. This could perhaps be used to derive a tighter bound {|ψv : v ∈ A \ M}, so A |ξ = 0 if and only if |ξ is a linear
than that of Appendix B and reduce the dependence upon k of combination of |ψv corresponding to vertices v ∈ A that are
the logarithmic factors in Theorem 5. not marked. This implies that αm = 0 for all marked vertices
m ∈ A ∩ M [first case of item (d)] and item (a) follows from
ACKNOWLEDGMENTS the definition of |ψv in Eq. (2).
Similarly, the eigenvalue-1 eigenspace of RB is spanned by
The authors would like to thank Courtney Brell, Daniel
Gottesman, and Ted Yoder for useful discussions. The bound SB ≡ {|r } ∪ {|ψv⊥ : ψv⊥ |ψv
on the expected number of steps in the walk is primarily due to
= 0,v ∈ B} ∪ {|ψm : m ∈ B ∩ M}.
the MathOverflow user fedja [14]. K.W. is grateful for support
from the Mike Lazaridis Scholarship in Theoretical Physics. Then B |ξ = | ⊥ is satisfied if and only if, for all |ζ ∈ SB ,
This research was supported in part by Perimeter Institute ζ |ξ = ζ | ⊥ . Item (c) and the second case in item (d)

022337-11
MICHAEL JARRET AND KIANNA WAN PHYSICAL REVIEW A 97, 022337 (2018)

respectively impose r|ξ = r| ⊥ and m|ξ = m| ⊥ for where in the third line, we apply item (a) of Proposition 1 in
m ∈ B ∩ M. Moreover, for each vertex v ∈ B, the set of the first sum and item (b) in the second. In particular, if v0 is
√ √
vectors the ancestor of v of depth 1, we have αv0 = ηαr = η cos β
⎧ ⎫ by items (a) and (c) and the above relation can be rearranged
⎨   ⎬
ψ ⊥ ≡ −|v + dv |ci − to obtain
|cj ⎧1 
⎩ v,ci

c ←v j
ci ←v ⎨ κr − u ∈ P(r,v) κu
⎪ if v ∈ A
u = r
αv = sin β 1  (A4)
forms a basis for the space span({|ψv⊥ : ψv⊥ |ψv = 0}). Di- ⎩ κr − u ∈ P(r,v) κu + κv if v ∈ B

u = r
rect calculation yields, for each child ci ,
#    for all v ∈ T \ {r}.
⊥ 
ψv,ci
ξ = −αv + dv αci − αcj Taking v to be a marked vertex m ∈ M, this gives us
cj ←v ⎧1 
and [cf. Eq. (13)] ⎨ κr − u ∈ P(r,m) κu
⎪ if v ∈ A
#   αm = sin β 1  u = r
⊥  ⊥
ψv,ci
= −dv κci sin β. ⎩ κr − u ∈ P(r,m) κu + κm if v ∈ B

u = r
For each v ∈ B, we thus obtain a system of dv − 1 linear 
equations of the form 0 if v ∈ A
=
 κm sin β if v ∈ B,
−αv + dv αci − αcj = −dv κci sin β,
cj ← v as required by Eq. (A2). This uses Lemma 4, which we note is
a consequence  of the constraints on κ imposed by Eq. (9).
which has the unique solution [cf. Eq. (7)] Thus, |ξ = v∈T αv |v satisfies Eq. (A2) and is uniquely
αci = αv − (κv + κci ) sin β. determined.
It follows from Lemmas 2 and 4 that for all v ∈ T \ {r},
This is item (b).     
   
One might observe that items (a)–(d) of Proposition 1 may      
      1
overconstrain the set of coefficients {αv }v∈T . Consider, for    
 κu − κv    κu    ,
instance, the path P(r,m) from the root r to some marked     κr
u ∈ P(r,m)  u ∈ P(r,m) 
vertex m ∈ M. Items (c) and (d) fix boundary conditions at  u = r   u = r 
r and at the marked vertex m, respectively, while items (a) √
and (b) constitute a recurrence relation that determines αv for so |αv |  | sin β/κr | = η| cos β| by Eq. (A4) and Lemma 2.
each vertex v along P(r,m) as a function of αp(v) for its parent Therefore,
p(v) and the values assigned by κ. If we start with αr , given  
|ξ 2 = αr2 + αv2  cos2 β + η cos2 β
by item (c), and recurse down the path using (a) and (b) to
v∈T v∈T
obtain αm , the result may be inconsistent with the constraint v = r v = r
on αm imposed by (d). However, for κ given by Eqs. (7)–(9),
there indeed exists a set of coefficients {αv }v∈T that satisfies = [1 + (T − 1)η] cos2 β  2(T − 1)η cos2 β,
the recurrence relation as well as both boundary conditions. We
where the last inequality follows from the fact that η 
determine these coefficients explicitly in the following lemma.
1/kmax  1/(T − 1) for any nontrivial tree whose root vertex
Lemma 6. For any nontrivial input tree T and any parameter
is not marked. 
η, if κ 
satisfies Eqs. (7)–(9), then there exists a unique vector
Finally, the lemmas above imply the result of Lemma 1,
|ξ = v∈T αv |v for which Eq. (A2) holds. Moreover,
which is used in Sec. IV B to bound the complexity of the

|ξ  = O( T η). (A3) phase estimation procedure used to prepare the state | .
Proof of Lemma 1. Let |ξ be the vector satisfying Eq. (A2).
Proof. First, consider any two vertices v0 ∈ B and v ∈ Then
T (v0 ). Summing over all edges (u,w) ∈ P(v0 ,v), 
 P | ⊥  = P B |ξ   |ξ  = O( T η),
αv0 − αv = (αu − αw )
where the inequality follows from Sec. VII and the last equality
(u,w)∈P(v0 ,v)
  is Eq. (A3). 
= (αu − αw ) + (αu − αw )
(u,w) ∈ P(v0 ,v) (u,w) ∈ P(u,w) APPENDIX B: EXPECTED NUMBER OF STEPS
u∈A u∈B
TO REACH A MARKED VERTEX
 
= 0+ (κu + κw ) sin β We reproduce a theorem originally derived in Ref. [14],
(u,w) ∈ P(v0 ,v) (u,w) ∈ P(v0 ,v) altered slightly so as to make use of our existing theorems and
u∈A u∈B
notation.

κu if v ∈ A Theorem 11. Let (Xi ∈ T)ni=0 be a discrete-time Markov
chain on the state space V (T), the vertex set of the tree T rooted
u∈P(v0 ,v)
= sin β 
u∈P(v0 ,v) κu − κv if v ∈ B,
at r with effective resistance η, and leaves M. Let X0 = r and

022337-12
IMPROVED QUANTUM BACKTRACKING ALGORITHMS … PHYSICAL REVIEW A 97, 022337 (2018)

suppose that for u,v ∈ T,  κc κc η(c) κc [1 + η(c)]



= 1− + E(c)
 κ
c←v v
κv η(v) κv η(v)
if u ∈ T(v) \ {v}  κc 
 κu2
Prob(Xi+1 = u|Xi = v) = w∈T(v)\{v} κw2
=
1
+ E(c) ,
0 otherwise, κ η(c) + 1
c←v v

where the last line follows from Corollary 1.


where T(v) denotes the subtree rooted at v and κ satisfies the
Now we claim that for all v,
hypotheses of Theorem 8. Then the expected amount of time  
E(r) until Xi ∈ M is bounded as  κm η(v) + 1
E(v)  log2 κv .
m∈M(v) v
κ κm
E(r)  log2 [|M|(η + 1)].
This is trivially true if v ∈ M. Assume that it holds for all
Proof. For v ∈ T, we denote the effective resistance of the children of v ∈ M. Then
⎡ ⎤
subtree T(v) by η(v) and the set of leaves in T(v) by M(v).  κc   
⎣ 1 κm η(c) + 1 ⎦
By Theorem 10, we can write E(v)  + log2 κc
c←v
κ v η(c) + 1 m∈M(c)
κ c κm

Prob(Xi+1 = u|Xi = v) =
κu2
.  κc  κm κc

η(c) + 1

κv2 η(v) = +log2 κc
κ
c←v v m∈M(c) c
κ κc [η(c) + 1] κm
Let E(v) denote the expected time to reach a leaf starting from   κm  
η(c) + 2
v ∈ M. Then   log2 κc
κ κm
E(v) = 1 + Prob(Xi+1 = u|Xi = v)E(u) c←v m∈M(c) v

u ∈ T(v)   κm  
κv η(v) + κc
u = v = log2
c←v m∈M(c) v
κ κm
  κu2
=1+ E(u)  κm 
η(v) + 1

c←v u∈T(c)
κv2 η(v)  log2 κv ,
⎡ ⎤ m∈M(v) v
κ κm

 1 ⎢ ⎢ 2  ⎥

where the fourth line follows from Corollary 1 and the final
=1+ ⎢ κ E(c) + κ 2
E(u) ⎥ line from Lemma 2 and Eq. (7). Restricting ourselves to the
c←v
κv2 η(v) ⎣ c 
u
⎦ case of v = r and applying Jensen’s inequality, we find that
u ∈ T (c)
u = c
E(r)  log2 (|M|) + log2 (η + 1),
 κc2
=1+ {E(c) + η(c)[E(c) − 1]} as desired. 
c←v
κv2 η(v)

[1] A. Montanaro, Quantum walk speedup of backtracking algo- [9] S. Jeffery and S. Kimmel, Quantum algorithms for graph
rithms, arXiv:1509.02374. connectivity and formula evaluation, arXiv:1704.00765.
[2] H. Krovi F. Magniez, M. Ozols, and J. Roland, Quantum walks [10] A. Ambainis and M. Kokainis, Quantum algorithm for tree
can find a marked element on any graph, Algorithmica 74, 851 size estimation, with applications to backtracking and 2-player
(2016). games, arXiv:1704.06774.
[3] F. Magniez, A. Nayak, J. Roland, and M. Santha, Search via [11] A. Belovs, A. M. Childs, S. Jeffery, R. Kothari, and F. Mag-
quantum walk, SIAM J. Comput. 40, 142 (2011). niez, Proceedings of the International Colloquium on Au-
[4] N. Shenvi, J. Kempe, and K. B. Whaley, Quantum random-walk tomata, Languages, and Programming (Springer, Berlin, 2013),
search algorithm, Phys. Rev. A 67, 052307 (2003). pp. 105–122.
[5] M. Szegedy, Proceedings of the 45th Annual IEEE Symposium [12] G. Brassard, P. Hoyer, M. Mosca, and A. Tapp, Quantum
on Foundations of Computer Science (IEEE, Piscataway, 2004), amplitude amplification and estimation, Contemp. Math. 305,
pp. 32–41. 53 (2002).
[6] A. Belovs, Quantum walks and electric networks, [13] W. Hoeffding, Probability inequalities for sums of bounded
arXiv:1302.3143. random variables, J. Am. Stat. Assoc. 58, 13 (1963).
[7] G. Wang, Efficient quantum algorithms for analyzing large [14] M. Jarret, Bound on queries to a tree with unusual probabilities—
sparse electrical networks, Quantum Inf. Comput. 17, 987 follow-up, MathOverflow, https://mathoverflow.net/q/280505.
(2017). [15] T. Lee, R. Mittal, B. W. Reichardt, R. Špalek, and M. Szegedy,
[8] T. Ito and S. Jeffery, in Proceedings of the 43rd International Col- Proceedings of the 2011 IEEE 52nd Symposium on Founda-
loquium on Automata, Languages, and Programming (ICALP, tions of Computer Science (FOCS) (IEEE, Piscataway, 2011),
2016), pp. 12:1-12:14, arXiv:1507.00432. pp. 344–353.

022337-13

Vous aimerez peut-être aussi