This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Derandomization of quantum algorithm for triangle finding

Guanzhong Li, Lvzhou Li
Institute of Quantum Computing and Software,
School of Computer Science and Engineering,
Sun Yat-sen University, Guangzhou 510006, China
Email: [email protected]: [email protected] (corresponding author)
Abstract

Derandomization is the process of taking a randomized algorithm and turning it into a deterministic algorithm, which has attracted great attention in classical computing. In quantum computing, it is challenging and intriguing to derandomize quantum algorithms, due to the inherent randomness of quantum mechanics. The significance of derandomizing quantum algorithms lies not only in theoretically proving that the success probability can essentially be 1 without sacrificing quantum speedups, but also in experimentally improving the success rate when the algorithm is implemented on a real quantum computer.

In this paper, we focus on derandomizing quanmtum algorithms for the triangle sum problem (including the famous triangle finding problem as a special case), which asks to find a triangle in an edge-weighted graph with nn vertices, such that its edges sum up to a given weight. We show that when the graph is promised to contain at most one target triangle, there exists a deterministic quantum algorithm that either finds the triangle if it exists or outputs “no triangle” if none exists. It makes O(n9/7)O(n^{9/7}) queries to the edge weight matrix oracle, and thus has the same complexity with the state-of-art bounded-error quantum algorithm. To achieve this derandomization, we make full use several techniques: nested quantum walks with quantum data structure, deterministic quantum search with adjustable parameters, and dimensional reduction of quantum walk search on Johnson graph.

1 Introduction

Randomized algorithms play an important role in computer science, as they can be significantly efficient in some choice of computational resource for a lot of basic computational problems, such as time for primality testing [1, 2, 3], space for undirected s-t connectivity [4] and circuit depth for perfect matching [5]. Since the polynomial-time deterministic algorithm for primality testing [6] was proposed in 2004, the study of derandomization, i.e. the question of whether it’s possible to come up with efficient deterministic versions of randomized algorithms, has been attracting attention from the academic community, see for instance, Refs. [7, 8, 9, 10, 11]. Indeed, a lot of exciting works have been dedicated to derandomizing concrete randomized algorithms, including the aforementioned primality testing [6], undirected s-t connectivity [12] and perfect matching [13]. There are also entire books on derandomization, see for instance, Refs. [14, 15, 16].

Because of the inherent randomness of quantum mechanics, most of the existing quantum algorithms are randomized, i.e., have a probability of failure [17, 18, 19]. Derandomizing quantum algorithms seems difficult, with only few quantum algorithms having been successfully derandomized (succeed with certainty), such as deterministic quantum search [20, 21, 22, 23, 24] and deterministic quantum algorithms for Simon’s problem [25] (and its generalization [26]), element distinctness problem [27] and the welded tree problem [28]. The significance of derandomizing quantum algorithms lies not only in theoretically proving that the success probability can essentially be 1 without sacrificing quantum speedups, but also in experimentally improving the success rate when the algorithm is implemented on a real quantum computer. Thus, it is intriguing to find more quantum algorithms that allows derandomization. In this paper we will focus on derandomizing quantum algorithms for triangle finding and its generalization, an important and extensively studied problem in quantum computing.

1.1 Triangle finding and its generalization

The triangle finding problem has been extensively studied in quantum computing. It aims to find a triangle in an unknown graph with nn vertices, making as few queries as possible to its adjacency matrix given as a black box. Compared to the classical query complexity of Θ(n2)\Theta(n^{2}), the quantum query complexity of the problem has gradually improved from the trivial O(n3/2)O(n^{3/2}) using Grover search on triples of the graph’s vertices, to the state-of-the-art O(n5/4)O(n^{5/4}) using extended learning graph [29].

The first improvement over O(n3/2)O(n^{3/2}) was given by Buhrman et al. [30] for sparse graph with m=o(n2)m=o(n^{2}) edges, as they presented a quantum algorithm for the triangle finding problem with query complexity O(n+nm)O(n+\sqrt{nm}) using amplitude amplification. Using combinatorial ideas and amplitude amplification, Szegedy [31] (see also [32]) showed how to solve the problem with query complexity O~(n10/7)\widetilde{O}(n^{10/7}), where O~()\widetilde{O}(\cdot) hides logarithmic factors. Magniez et al. [32] then utilized quantum walk search on Johnson graphs, which was originally used to construct an optimal quantum algorithm for the element distinctness problem [33], to obtain a more efficient algorithm with O~(n13/10)\widetilde{O}(n^{13/10}) queries. Belovs [34] introduced the learning graph framework and, as the first application of this framework, used it to improve the quantum query complexity of triangle finding to O(n35/27)O(n^{35/27}). Lee et al. [35] then further improved the query complexity to O(n9/7)O(n^{9/7}), again using learning graph. Finally, Le Gall [36] gave a O~(n5/4)\widetilde{O}(n^{5/4}) quantum algorithm, which utilizes combinatorial structure of the problem, quantum walk search on Johnson graph, and variable time quantum search. The logarithmic factors in O~(n5/4)\widetilde{O}(n^{5/4}) was later removed using extended learning graphs by Carette et al. [29].

As can be seen from the above progress, each improvement in the query complexity of triangle finding problem has brought deeper insight into the problem or stimulating new algorithmic technique (See [37] for a more detailed review). However, the gap between O(n5/4)O(n^{5/4}) and Ω(n)\Omega(n) is still open. At the same time, all the above quantum algorithms are bounded-error, that is, have a probability of failure.

In the above process, Belovs and Rosmanis [38] found that the O(n9/7)O(n^{9/7}) algorithm by Lee et al. [35] based on non-adaptive learning graph can in fact solve a more general problem — the triangle sum problem, in which the underlying graph is now edge-weighted and the goal is to find a target triangle whose edges sum to a given value. They also showed that the algorithm is almost optimal by giving a matching lower bound of Ω(n9/7/logn)\Omega(n^{9/7}/\sqrt{\log n}). Jeffery et al. [39] then proposed a new nested quantum walk with quantum data structures, which is based on the MNRS framework [40], and as an application they adapted Lee et al.’s algorithm [35] to a quantum-walk-based algorithm. However, in order to reduce errors when nesting the bounded-error subroutines, the algorithm makes O~(n9/7)\widetilde{O}(n^{9/7}) queries with additional log factors.

1.2 Our contribution

In this paper, we propose a deterministic quantum algorithm for the triangle sum problem (and thus also for the famous triangle finding problem), based on derandomization of the quantum-walk-based algorithm by Jeffery et al. [39]. Our algorithm has the same O(n9/7)O(n^{9/7}) query complexity with the state-of-the-art bounded-error quantum algorithm by Lee et al. [35], but we require an additional promise that the graph has at most one target triangle. Apart from nested quantum walks with quantum data structures [39], our algorithm also utilizes deterministic quantum search with adjustable parameters [24] (see Section 2.3 and especially Lemma 3), and a technique to reduce the dimension of invariant subspaces of quantum walk search on Johnson graph (see Section 2.2 and especially Lemma 1), which has also found application in designing a deterministic quantum algorithm for the element distinctness problem [27]. We think our algorithm has the following significance:

  1. 1.

    It’s the first deterministic quantum algorithm for the triangle sum (and also triangle finding) problem making O(n9/7)O(n^{9/7}) queries, and provides a new example of deranomization of quantum algorithms.

  2. 2.

    It shows the usefulness of the techniques being utilized, and it’s likely that more applications will be found.

Formal statement of the triangle sum problem. Consider an undirected and weighted simple graph GG with nn vertices, specified by its edge weight matrix A[M]n×nA\in[M]^{n\times n}, where MM is a positive integer and [M]:={0,1,,M1}[M]:=\{0,1,\cdots,M-1\}. The edge weight matrix AA can be accessed through a quantum black box (oracle) OO whose effect on the computational basis is as follows:

O|i,j|b|i,j|bAi,j,O\ket{i,j}\ket{b}\mapsto\ket{i,j}\ket{b\oplus A_{i,j}}, (1)

where (i,j)[n]×[n](i,j)\in[n]\times[n] encodes an edge of GG to be queried, and Ai,j[M]A_{i,j}\in[M] is the corresponding weight. Suppose the value Ai,jA_{i,j} is stored in mm qubits, then \oplus denotes bit-wise XOR and O2=IO^{2}=I.

Definition 1 (the triangle sum problem).

Given d[M]d\in[M], find three vertices a,b,c[n]a,b,c\in[n] in the graph GG such that

Aa,b+Ab,c+Ac,a=dmodM,A_{a,b}+A_{b,c}+A_{c,a}=d\mod{M}, (2)

making as few queries to the oracle OO as possible.

The triangle sum promised problem has an additional promise that if such a target triangle abc\triangle abc exists in GG, there is only one.

In this paper we obtain the following result.

Theorem 1.

There is a deterministic quantum algorithm that solves the triangle sum promised problem with certainty and making O(n9/7)O(n^{9/7}) queries.

Specifically, the algorithm outputs the target triangle if it exists and claims there’s none if no such triangle exists.

Corollary 1.

There is a deterministic quantum algorithm for triangle finding which makes O(n9/7)O(n^{9/7}) queries.

Proof.

Triangle finding is a special case of the triangle sum problem, which can be seen by setting M=4,d=3M=4,d=3 and restricting AA to [2]n×n[2]^{n\times n}. Thus, quantum algorithm solving the triangle sum problem also solves triangle finding. ∎

Note that the addition in Eq. (2) is modulo MM, which is crucial in proving the Ω(n9/7/logn)\Omega(n^{9/7}/\sqrt{\log n}) lower bound of the triangle sum problem [38]. Intuitively, ‘addition modulo MM’ makes it impossible for an algorithm to rule out potential triangle, say abc\triangle a^{\prime}b^{\prime}c^{\prime} in GG, when the queried edge weights Aa,bA_{a^{\prime},b^{\prime}} and Ab,cA_{b^{\prime},c^{\prime}} already sum up to greater than dd or either of them is zero. A more formal description of this property can be found in [41, 38] referred to as the orthogonal array condition or the orthogonality property.

1.3 Paper organization

The rest of the paper is organized as follows. In Section 2 we introduce some important techniques that will be used later: two forms of quantum walk search on Johnson graph dubbed “edge-walk” and “vertex-walk”, a technique to reduce the dimension of the invariant subspace of quantum vertex-walk on Johnson graph, and deterministic quantum search with adjustable parameters. In Section 3, we first sketch the procedure of our algorithm which contains four layers of subroutines in Section 3.1, and then show that each layer of subroutine can be derandomized in Section 3.2, thus obtaining a deterministic quantum algorithm for the triangle sum promised problem. The details of the quantum walk search on Johnson graph used in three of the four layers, i.e. how to implement the setup, update, checking operations and what is the probability of reaching the target state, are presented in Section 4. We conclude this paper with some related problems in Section 5.

2 Preliminaries

In this section, we present some techniques and results that will be used latter in our deterministic quantum algorithm for the triangle sum promised problem. We will use two forms of quantum walks search on Johnson graph with subtle differences. The first one described in Section 2.1 stems from the nested quantum walk [39], and we call it “quantum edge-walk on Johnson graph”, since its basis state |R|R\ket{R}\ket{R^{\prime}} can be seen as an edge of a Johnson graph. The second one described in Section 2.2 originates from Ambainis’ quantum walks for the element distinctness problem [33], and we call it “quantum vertex-walk on Johnson graph”, since in its basis state |R,y\ket{R,y}, |R\ket{R} can be seen as a vertex of a Johnson graph and |y\ket{y} as a coin used to update |R\ket{R}.

In Section 2.2 we will also introduce a technique (Lemma 1) to reduce the dimension of the invariant subspace of quantum vertex-walk on Johnson graph, when certain conditions (Condition 1) are satisfied. In order to achieve certainty of success, we will also need deterministic quantum search (with adjustable parameters) as described in Section 2.3.

2.1 Quantum edge-walk search on Johnson graph

A Johnson graph J(N,r)J(N,r) has (Nr)\binom{N}{r} vertices. Each vertex is a subset R[N]R\subseteq[N] of size rr, and two vertices R,RR,R^{\prime} are connected by an edge if and only if |RR|=r1|R\cap R^{\prime}|=r-1. We denote by V(G)V(G) the vertex set of G:=J(N,r)G:=J(N,r).

The quantum edge-walk on GG has state space {|R|R|D(R):R,RV(G)}\{\ket{R}\ket{R^{\prime}}\ket{D(R)}:R,R^{\prime}\in V(G)\}. The data D(R)D(R) associated with RR relies on the input of the problem to be solved, and we check if a vertex RR is marked based on whether D(R)D(R) satisfies certain condition. The goal of quantum walk search on GG is to obtain a marked vertex with constant probability, starting from an initial state |ψ0\ket{\psi_{0}} and using update operations that comply with the graph’s edges (i.e. to walk on the graph). Specifically, the quantum edge-walk on GG consists of the following three operations.

Setup. Denote by SS the Setup operation that transforms the all zero state to the initial state:

|ψ0=S|0,\ket{\psi_{0}}=S\ket{0}, (3)

where |ψ0\ket{\psi_{0}} is an equal superposition of all the edges in GG:

|ψ0=1(Nr)R|R1r(Nr)RR|R|D(R),\ket{\psi_{0}}=\frac{1}{\sqrt{\binom{N}{r}}}\sum_{R}\ket{R}\frac{1}{\sqrt{r(N-r)}}\sum_{R\to R^{\prime}}\ket{R^{\prime}}\ket{D(R)}, (4)

where RRR\to R^{\prime} means RR^{\prime} is adjacent to RR in GG, or equivalently |RR|=r1|R\cap R^{\prime}|=r-1.

Update. One step of quantum walk, denoted by the update operation UU, consists of three unitary operators:

U=DataSwapCoin,U=\mathrm{Data}\cdot\mathrm{Swap}\cdot\mathrm{Coin}, (5)

where ‘Coin’ acting on |R|R\ket{R}\ket{R^{\prime}} is the Grover diffusion of vertices adjacent to |R\ket{R}:

Coin\displaystyle\mathrm{Coin} =R|RR|(2|φ(R)φ(R)|I),\displaystyle=\sum_{R}\ket{R}\bra{R}\otimes\big{(}2\ket{\varphi(R)}\bra{\varphi(R)}-I\big{)}, (6)
|φ(R)\displaystyle\ket{\varphi(R)} =1r(Nr)RR|R,\displaystyle=\frac{1}{\sqrt{r(N-r)}}\sum_{R\to R^{\prime}}\ket{R^{\prime}}, (7)

and

Swap|R|R=|R|R,\displaystyle\mathrm{Swap}\ket{R}\ket{R^{\prime}}=\ket{R^{\prime}}\ket{R}, (8)
Data|R|R|D(R)=|R|R|D(R).\displaystyle\mathrm{Data}\ket{R^{\prime}}\ket{R}\ket{D(R)}=\ket{R^{\prime}}\ket{R}\ket{D(R^{\prime})}. (9)

Checking. The checking subroutine CC adds phase shift (1)(-1) to |R|R|D(R)\ket{R}\ket{R^{\prime}}\ket{D(R)}, if the associated data |D(R)\ket{D(R)} satisfies certain condition.

The whole process of quantum walk search on GG can be formulated in the following equation

|ψk=(UrC)kS|0.\ket{\psi_{k}}=(U^{\sqrt{r}}C)^{k}S\ket{0}. (10)

The process is similar to Grover’s algorithm, as UrU^{\sqrt{r}} can be seen as a reflection through the initial state |ψ0\ket{\psi_{0}} and CC as a reflection through the marked states. It should be noted that the UrU^{\sqrt{r}} we used in this paper is replaced with phase estimation and selected (1)(-1) phase shift in [39, 40]. Finally, by choosing an appropriate kk and measuring |ψk\ket{\psi_{k}} in the first register, we will obtain a marked vertex with constant probability.

2.2 Quantum vertex-walk search on Johnson graph

The quantum vertex-walk search on Johnson graph J(N,r)J(N,r) has state space {|R,y|D(R):R[N],y[N]R}\{\ket{R,y}\ket{D(R)}:R\subseteq[N],y\in[N]-R\}.

Setup. The initial state is

|ψ0=1(Nr)R|R|D(R)1Nry[N]R|y.\ket{\psi_{0}}=\frac{1}{\sqrt{\binom{N}{r}}}\sum_{R}\ket{R}\ket{D(R)}\frac{1}{\sqrt{N-r}}\sum_{y\in[N]-R}\ket{y}. (11)

Update. One step of quantum walk UU consists of two unitary operators: U=UB(θ2)UA(θ1)U=U_{B}(\theta_{2})U_{A}(\theta_{1}). The first operator UA(θ1)U_{A}(\theta_{1}) acts on |R,y\ket{R,y}, and can be seen as choosing a random y[N]Ry\in[N]-R to be moved into RR:

UA(θ1)\displaystyle U_{A}(\theta_{1}) =R|RR|(I(1eiθ1)|φ(R)φ(R)|),\displaystyle=\sum_{R}\ket{R}\bra{R}\otimes\big{(}I-(1-e^{i\theta_{1}})\ket{\varphi(R)}\bra{\varphi(R)}\big{)}, (12)
|φ(R)\displaystyle\ket{\varphi(R)} =1Nry[N]R|y.\displaystyle=\frac{1}{\sqrt{N-r}}\sum_{y\in[N]-R}\ket{y}. (13)

The second operator UB(θ2)U_{B}(\theta_{2}) can be seen as choosing a random yRy^{\prime}\in R being removed from RR and at the same time moving yy into RR. To update D(R)D(R) simultaneously, UB(θ2)U_{B}(\theta_{2}) acts on all registers, but we only define its effect on register |R,y\ket{R,y} for simplicity:

UB(θ2)\displaystyle U_{B}(\theta_{2}) =I(1eiθ2)R+y[N]|φ(R+y)φ(R+y)|,\displaystyle=I-(1-e^{i\theta_{2}})\sum_{R+y\subseteq[N]}\ket{\varphi(R+y)}\bra{\varphi(R+y)}, (14)
|φ(R+y)\displaystyle\ket{\varphi(R+y)} =1r+1yR+y|R+yy,y.\displaystyle=\frac{1}{\sqrt{r+1}}\sum_{y^{\prime}\in R+y}\ket{R+y-y^{\prime},y^{\prime}}. (15)

Note that we enhance the original update operation from [33] with general phase shift eiθe^{i\theta} instead of (1)(-1), in order to achieve dimensional reduction of the walk’s invariant subspace.

Checking. The checking subroutine S(α)S_{\mathcal{M}}(\alpha) adds relative phase shift eiαe^{i\alpha} to a marked state |R,y|D(R)\ket{R,y}\ket{D(R)}, based on whether the associated data |D(R)\ket{D(R)} satisfies certain condition. In fact, S(α)S_{\mathcal{M}}(\alpha) can be implemented by C(Idiag(1,eiα))CC(I\otimes\mathrm{diag}(1,e^{i\alpha}))C, if there is a checking subroutine CC that flips an auxiliary qubit initialized with |0\ket{0}, when the basis state is marked.

5-dimensional invrariant subspace 0\mathcal{H}_{0}. Suppose the Checking subroutine CC satisfies the following condition:

Condition 1.

There is a special subset K[N]K\subseteq[N] with |K|=2|K|=2, such that for a certain (j0,l0){(j,0)}j=02{(j,1)}j=01(j_{0},l_{0})\in\{(j,0)\}_{j=0}^{2}\cup\{(j,1)\}_{j=0}^{1}, the checking subroutine CC marks a basis state |R,y\ket{R,y} satisfying |RK|=j0|R\cap K|=j_{0} and |yK|=l0|y\cap K|=l_{0}.

Then the quantum vetex-walk search on J(N,r)J(N,r) can be reduced to a 55-dimensional invariant subspace 0\mathcal{H}_{0} spanned by:

0:={|0,0,|0,1,|1,0,|1,1,|2,0},\mathcal{B}_{0}:=\{\ket{0,0},\ket{0,1},\ket{1,0},\ket{1,1},\ket{2,0}\}, (16)

where |j,l0\ket{j,l}\in\mathcal{B}_{0} is the equal superposition of basis states in Sjl:={|R,y:|RK|=j,|yK|=l}S_{j}^{l}:=\{\ket{R,y}:|R\cap K|=j,|y\cap K|=l\}. In basis 0\mathcal{B}_{0}, the initial state takes the following form:

|ψ0=1(Nr)(Nr)|j,l0|Sjl||j,l,\ket{\psi_{0}}=\frac{1}{\sqrt{\binom{N}{r}(N-r)}}\sum_{\ket{j,l}\in\mathcal{B}_{0}}\sqrt{|S_{j}^{l}|}\cdot\ket{j,l}, (17)

and the target state is |j0,l0\ket{j_{0},l_{0}}.

Because SjlS_{j}^{l} can also be seen as the set of |R,y\ket{R,y} satisfying |(R+y)K|=j+l|(R+y)\cap K|=j+l and |yK|=l|y\cap K|=l, the size of SjlS_{j}^{l} can be calculated in two ways. For {|j,0}j=02\{\ket{j,0}\}_{j=0}^{2}, we have:

(2j)(N2rj)(N2(rj))=|Sj0|=(2j)(N2r+1j)(r+1j),\binom{2}{j}\binom{N-2}{r-j}(N-2-(r-j))=|S_{j}^{0}|=\binom{2}{j}\binom{N-2}{r+1-j}(r+1-j), (18)

and for {|j,1}j=01\{\ket{j,1}\}_{j=0}^{1}, we have:

(2j)(N2rj)(2j)=|Sj1|=(2j+1)(N2rj)(j+1).\binom{2}{j}\binom{N-2}{r-j}(2-j)=|S_{j}^{1}|=\binom{2}{j+1}\binom{N-2}{r-j}(j+1). (19)

This is depicted in Fig. 1 by the two equivalent ways (from left or from right) of calculating the weight of the middle line marked by |j,l\ket{j,l} with dashed box.

Refer to caption
Figure 1: Illustration of the 5 basis states |j,l0\ket{j,l}\in\mathcal{B}_{0} of the invariant subspace 0\mathcal{H}_{0}. The two equivalent ways of calculating |Sjl||S_{j}^{l}| is depicted by the two ways of calculating the weights of the lines.

From Fig. 1 and the definition of UA(θ1)U_{A}(\theta_{1}) and UB(θ2)U_{B}(\theta_{2}), it can be seen that U=UB(θ2)UA(θ1)U=U_{B}(\theta_{2})U_{A}(\theta_{1}) takes the following form in 0\mathcal{B}_{0}:

U\displaystyle U =(I(1eiθ2)BB)(I(1eiθ1)AA),\displaystyle=(I-(1-e^{i\theta_{2}})BB^{\dagger})\cdot(I-(1-e^{i\theta_{1}})AA^{\dagger}), (20)
A.2\displaystyle A.^{2} =[12Nr002Nr00011Nr001Nr0001],B.2=[10001r+10011r+10002r+10012r+1],\displaystyle=\left[\begin{array}[]{ccc}{1-\frac{2}{N-r}}&0&0\\ {\frac{2}{N-r}}&0&0\\ 0&{1-\frac{1}{N-r}}&0\\ 0&{\frac{1}{N-r}}&0\\ 0&0&1\end{array}\right],\quad B.^{2}=\left[\begin{array}[]{ccc}1&0&0\\ 0&\frac{1}{r+1}&0\\ 0&1-\frac{1}{r+1}&0\\ 0&0&\frac{2}{r+1}\\ 0&0&1-\frac{2}{r+1}\end{array}\right], (31)

where A,BA,B are non-negative matrices, and A.2A.^{2} denotes the entry wise square of AA.

Reducing the dimension further to 2. We can now state the following Lemma 1 due to Lemmas 1 and 2 in Ref. [27].

Lemma 1.

By setting the parameters (θ1,θ2)(\theta_{1},\theta_{2}) in U=UB(θ2)UA(θ1)U=U_{B}(\theta_{2})U_{A}(\theta_{1}) and tO(r)t\in O(\sqrt{r}) appropriately, UtU^{t} becomes a phase shift of the initial state in 0\mathcal{H}_{0}:

Ut=I(1eiβ)|ψ0ψ0|.U^{t}=I-(1-e^{i\beta})|{\psi_{0}}\rangle\langle{\psi_{0}}|. (32)

Furthermore, the angle β=tθ1+θ22mod 2π\beta=t\frac{\theta_{1}+\theta_{2}}{2}\ {\rm mod}\ 2\pi is known and β1.29π\beta\approx 1.29\pi when NN\to\infty.

Thus the invariant subspace of quantum vertex-walk search on J(N,r)J(N,r), formulated in the following equation:

|ψk=(UtS(α))k|ψ0,\ket{\psi_{k}}=\big{(}U^{t}S_{\mathcal{M}}(\alpha)\big{)}^{k}\ket{\psi_{0}}, (33)

further reduces to 22-dimensional spanned by |ψ0\ket{\psi_{0}} and the target state |j0,l0\ket{j_{0},l_{0}}.

2.3 Deterministic quantum search with adjustable parameters

Suppose there is a quantum process (unitary operation) 𝒜\mathcal{A} that transforms the all zero state |0\ket{0} to |ψ0\ket{\psi_{0}}, which contains a set of target basis states :={|t}\mathcal{M}:=\{\ket{t}\}. Denote by Π:=|t|tt|\Pi_{\mathcal{M}}:=\sum_{\ket{t}\in\mathcal{M}}\ket{t}\bra{t} the projection onto span()\mathrm{span}(\mathcal{M}). If the success probability of measuring |ψ0\ket{\psi_{0}} that leads to a target state, i.e. λ:=Π|ψ02\lambda:=\|\Pi_{\mathcal{M}}\ket{\psi_{0}}\|^{2} is known beforehand. Then we can transform |ψ0\ket{\psi_{0}} to |:=1|||t|t\ket{\mathcal{M}}:=\frac{1}{\sqrt{|\mathcal{M}|}}\sum_{\ket{t}\in\mathcal{M}}\ket{t} with certainty, by iterating the generalized Grover’s operation G(α,β)G(\alpha,\beta) for O(1/λ)O(1/\sqrt{\lambda}) times:

G(α,β)\displaystyle G(\alpha,\beta) :=Sψ0(β)S(α)\displaystyle:=S_{\psi_{0}}(\beta)\cdot S_{\mathcal{M}}(\alpha) (34)
:=eiβ|ψ0ψ0|eiαΠ\displaystyle:=e^{-i\beta\ket{\psi_{0}}\bra{\psi_{0}}}\cdot e^{i\alpha\Pi_{\mathcal{M}}} (35)
=(𝒜eiβ|00|𝒜)eiαΠ.\displaystyle=(\mathcal{A}e^{-i\beta\ket{0}\bra{0}}\mathcal{A}^{\dagger})\cdot e^{i\alpha\Pi_{\mathcal{M}}}. (36)

If the two parameters α,β\alpha,\beta are user-controllable, there are at least three schemes to achieve deterministic quantum search [20, 21, 22]. But the following lemma due to Long [22] is most concise.

Lemma 2 ([22]).

Suppose parameter α\alpha satisfies the equation “sinπ4k+2=λsinα2\sin\frac{\pi}{4k+2}=\sqrt{\lambda}\sin\frac{\alpha}{2}”, and integer k>koptk>k_{\mathrm{opt}}, then

||[G(α,α)]k|ψ0|=1.\left|\bra{\mathcal{M}}[G(\alpha,-\alpha)]^{k}\ket{\psi_{0}}\right|=1. (37)

The lower bound of number of iterations kk is

kopt=π4arcsinλ12.k_{\mathrm{opt}}=\frac{\pi}{4\arcsin\sqrt{\lambda}}-\frac{1}{2}. (38)

If one of the parameters, for example β\beta, is uncontrollable but fixed and known, we can apply the following lemma from [24, Theorem 2].

Lemma 3.

Suppose β(0,2π)\beta\in(0,2\pi) is arbitrarily given, and k>klowerk>k_{\mathrm{lower}}, then there always exits a pair of parameters (α1,α2)(\alpha_{1},\alpha_{2}) such that

||[G(α1,β)G(α2,β)]k|ψ0|=1.\left|\bra{\mathcal{M}}[G(\alpha_{1},\beta)G(\alpha_{2},\beta)]^{k}\ket{\psi_{0}}\right|=1. (39)

The lower bound of kk is

klower=π|4arcsin(λsinβ2)mod[π2,π2]|O(1/λ),k_{\mathrm{lower}}=\frac{\pi}{\Big{|}4\arcsin(\sqrt{\lambda}\sin\frac{\beta}{2})\mod[-\frac{\pi}{2},\frac{\pi}{2}]\Big{|}}\in O(1/\sqrt{\lambda}), (40)

where the notation “xmod[π2,π2]x\mod[-\frac{\pi}{2},\frac{\pi}{2}]” means to add xx with an appropriate integer multiples ll of π\pi, such that x+lπ[π2,π2]x+l\pi\in[-\frac{\pi}{2},\frac{\pi}{2}].

The explicit equations that (α1,α2)(\alpha_{1},\alpha_{2}) need to satisfy in Lemma 3 can be found in [24].

3 Deterministic quantum algorithm for the triangle sum promised problem

Since our algorithm for the promised problem of triangle sum (Definition 1) is based on the derandomization of Jeffery et al.’s algorithm [39], it also has 44 layers of subroutines as described in Section 3.1. We show the derandomization of each layer in Section 3.2, and thus obtain a deterministic quantum algorithm and complete the proof of Theorem 1.

3.1 Outline and query complexity

Recall that in the triangle sum problem, we are trying to find a triangle whose edges sum up to a given weight dd modulo MM in an edge-weighted graph GG with nn vertices, by querying its edge weight matrix A[M]n×nA\in[M]^{n\times n} as few times as possible (through oracle OO in Eq. (1)).

Our algorithm has 44 layers of subroutines: layers 1,2,41,2,4 are quantum walk search on Johnson graph, and layer 33 is a Grover search. Each layer implements the Check operation of its upper layer. Intuitively, layer 11, 22, and (3,4)(3,4) as a whole, find one by one, three vertices in the target triangle abc:=\triangle abc:=\triangle.

Denote by Si,Ui,CiS_{i},U_{i},C_{i} the setup, update, checking operation in the ii-th layer, the query complexity of implementing the respective operations from the oracle OO are denoted by si,ui,cis_{i},u_{i},c_{i}. We also denote by ϵi\epsilon_{i} the proportion of marked vertices in V(Gi)V(G_{i}), where GiG_{i} is the Johnson graph in the ii-th layer. For two subsets R1R_{1} and R2R_{2} of graph GG’s vertex set [n][n], denote by GR1,R2G_{R_{1},R_{2}} the sub-matrix of the edge weight matrix AA with rows indexed by R1R_{1} and columns indexed by R2R_{2}.

The 4 layers of subroutines are listed below.

  1. 1.

    A quantum edge-walk search on Johnson graph G1=J(n,r1)G_{1}=J(n,r_{1}). We set r1=n4/7r_{1}=n^{4/7} so that the total query complexity c0c_{0} is n9/7n^{9/7} as shown by Eq. (52) (See [39] for why setting r1=n4/7r_{1}=n^{4/7}, and r2=n5/7,m=n3/7r_{2}=n^{5/7},m=n^{3/7} below). A basis state |R1|R1|D(R1)\ket{R_{1}}\ket{R_{1}^{\prime}}\ket{D(R_{1})} is marked if |R1|=1|R_{1}\cap\triangle|=1 and |R1|=1|R_{1}^{\prime}\cap\triangle|=1. The query complexity is (with big OO omitted)

    c0\displaystyle c_{0} :=s1+1ϵ1(r1u1+c1)\displaystyle:=s_{1}+\frac{1}{\sqrt{\epsilon_{1}}}(\sqrt{r_{1}}u_{1}+c_{1}) (41)
    =r1r2+nr1(r1(r1+r2)+c1),\displaystyle=r_{1}r_{2}+\sqrt{\frac{n}{r_{1}}}(\sqrt{r_{1}}(r_{1}+r_{2})+c_{1}), (42)

    where the value of s1s_{1} and u1u_{1} will be explained below. The checking operation C1C_{1} which checks if |R1|R1\ket{R_{1}}\ket{R_{1}^{\prime}} is marked, is implemented in layer 2 (see also Section 3.2).

  2. 2.

    A quantum vertex-walk search on Johnson graph G2=J(n1,r2)G_{2}=J(n_{1},r_{2}), where n1=nr1n_{1}=n-r_{1}, and we set r2=n5/7r_{2}=n^{5/7}. A basis state |R1|R2,y|GR1,R2\ket{R_{1}}\ket{R_{2},y}\ket{G_{R_{1},R_{2}}}, where R2[n]R1R_{2}\subseteq[n]-R_{1} and y[n]R1R2y\in[n]-R_{1}-R_{2}, is marked if |R1|=1|R_{1}\cap\triangle|=1, |R2|=1|R_{2}\cap\triangle|=1 and yy\notin\triangle. To avoid the intolerable Setup cost s2=r1r2s_{2}=r_{1}r_{2} to construct |GR1,R2\ket{G_{R_{1},R_{2}}}, nested quantum walks with quantum data structure [39] are used. That is, the data D(R1)D(R_{1}) associated with |R1\ket{R_{1}} in layer 1 is the partial initial state (but |y\ket{y} is not initialized) of layer 2:

    |D(R1)=1(n1r2)R2[n]R1|R2|GR1,R2,\ket{D(R_{1})}=\frac{1}{\sqrt{\binom{n_{1}}{r_{2}}}}\sum_{R_{2}\subseteq[n]-R_{1}}\ket{R_{2}}\ket{G_{R_{1},R_{2}}}, (43)

    where the data |GR1,R2\ket{G_{R_{1},R_{2}}} stores GR1,R2G_{R_{1},R_{2}} in a r1×r2r_{1}\times r_{2} matrix of registers. Therefore, to maintain this data structure, the setup cost in layer 1 is s1=r1r2s_{1}=r_{1}r_{2}, and u1=2(r1+r2)u_{1}=2(r_{1}+r_{2}) so as to implement D(R1)D(R1)D(R_{1})\mapsto D(R_{1}^{\prime}) based on |R1|R1\ket{R_{1}^{\prime}}\ket{R_{1}} (see Lemma 5). Also, s2=0s_{2}=0, and u2=2r1u_{2}=2r_{1} so as to implement GR1,R2GR1,R2G_{R_{1},R_{2}}\mapsto G_{R_{1},R_{2}^{\prime}}. Thus, the query complexity of this layer is

    c1\displaystyle c_{1} =s2+1ϵ2(r2u2+c2)\displaystyle=s_{2}+\frac{1}{\sqrt{\epsilon_{2}}}(\sqrt{r_{2}}u_{2}+c_{2}) (44)
    =0+nr2(r2r1+c2).\displaystyle=0+\sqrt{\frac{n}{r_{2}}}(\sqrt{r_{2}}r_{1}+c_{2}). (45)

    The checking operation C2C_{2} which checks if |R2,y\ket{R_{2},y} is marked, is implemented in layer 3.

  3. 3.

    A Grover search on [n]R1R2y[n]-R_{1}-R_{2}-y to find the last vertex cc\in\triangle, assuming R1=aR_{1}\cap\triangle=a and R2=bR_{2}\cap\triangle=b. The query complexity of this layer is

    c2=nc3.c_{2}=\sqrt{n}c_{3}. (46)

    The checking operation C3C_{3} which checks if z[n]R1R2yz\in[n]-R_{1}-R_{2}-y is the last vertex cc\in\triangle, is implemented in layer 4.

  4. 4.

    A quantum vertex-walk search on the product Johnson graph G4=J(r1,m)×J(r2,m)G_{4}=J(r_{1},m)\times J(r_{2},m) with vertex set V(G4)={|S1|S2:SiRi,|Si|=m}V(G_{4})=\{\ket{S_{1}}\ket{S_{2}}:S_{i}\subseteq R_{i},|S_{i}|=m\}. We set m=(r1r2)1/3=n3/7m=(r_{1}r_{2})^{1/3}=n^{3/7}. Vertices |S1|S2\ket{S_{1}}\ket{S_{2}} and |S1|S2\ket{S_{1}^{\prime}}\ket{S_{2}^{\prime}} are adjacent if |SiSi|=m1|S_{i}\cap S_{i}^{\prime}|=m-1 for i=1,2i=1,2. The data associated with |Si\ket{S_{i}} is GSi,zG_{S_{i},z}. Assuming R1=aR_{1}\cap\triangle=a, R2=bR_{2}\cap\triangle=b and z=cz=c, vertex |S1|S2\ket{S_{1}}\ket{S_{2}} is marked if aS1,bS2a\in S_{1},b\in S_{2}. The query complexity of this layer is

    c3\displaystyle c_{3} =s4+1ϵ4(mu4+c4)\displaystyle=s_{4}+\frac{1}{\sqrt{\epsilon_{4}}}(\sqrt{m}u_{4}+c_{4}) (47)
    =m+r1r2m(mO(1)+0).\displaystyle=m+\frac{\sqrt{r_{1}r_{2}}}{m}(\sqrt{m}\cdot O(1)+0). (48)

    The checking operation C4C_{4} flips an auxiliary qubit if there exists aS1,bS2a\in S_{1},b\in S_{2} such that Aa,b+Ab,c+Aa,c=d(modM)A_{a,b}+A_{b,c}+A_{a,c}=d\,(\mathrm{mod}\,M). Since Aa,bGR1,R2,Ab,cGS1,c,Aa,cGS2,cA_{a,b}\in G_{R_{1},R_{2}},A_{b,c}\in G_{S_{1},c},A_{a,c}\in G_{S_{2},c} are already stored in the data structures, C4C_{4} requires no oracle query.

We can now calculate the total query complexity as follows:

c3\displaystyle c_{3} =(r1r2)1/3=n3/7,\displaystyle=(r_{1}r_{2})^{1/3}=n^{3/7}, (49)
c2\displaystyle c_{2} =nc3=n6.5/7,\displaystyle=\sqrt{n}c_{3}=n^{6.5/7}, (50)
c1\displaystyle c_{1} =n1/7(n6.5/7+c2)=n7.5/7,\displaystyle=n^{1/7}(n^{6.5/7}+c_{2})=n^{7.5/7}, (51)
c0\displaystyle c_{0} =n9/7+n1.5/7(n+c1)=n9/7.\displaystyle=n^{9/7}+n^{1.5/7}(n+c_{1})=n^{9/7}. (52)

3.2 Proof of Theorem 1

The condition that R1,R2,y,zR_{1},R_{2},y,z are mutually disjoint, and the promise that there’s at most one target triangle, enable us to implement the checking operation C3C_{3}, C2C_{2} and then C1C_{1} with 100% success probability successively as shown below.

Implementing C3C_{3} with 100% success probability. We consider C3C_{3} implemented in layer 4 first, whose checking operation C4C_{4} does not rely on other layer. The input state of this layer is |R1|R2|z\ket{R_{1}}\ket{R_{2}}\ket{z}, and the quantum walk basis state is |S1|S2\ket{S_{1}}\ket{S_{2}} with SiRiS_{i}\subseteq R_{i}. From the definition of the checking operation C4C_{4}, we can see that only when the input state |R1|R2|z\ket{R_{1}}\ket{R_{2}}\ket{z} satisfies |R1|=1|R_{1}\cap\triangle|=1, |R2|=1|R_{2}\cap\triangle|=1 and |z|=1|z\cap\triangle|=1, dose C4C_{4} not degenerates to the identity operator II. In this special case, the quantum walk process (Ut1C4)t2|ψ0(U^{t_{1}}C_{4})^{t_{2}}\ket{\psi_{0}} can be reduced to a 99-dimensional invariant subspace as shown in Section 4.1. Setting t1=Θ(m)t_{1}=\Theta(\sqrt{m}) and t2=Θ(r1r2/m)t_{2}=\Theta(\sqrt{r_{1}r_{2}}/m), the success amplitude p=|t|(Ut1C4)t2|ψ0|=Ω(1)p=|\bra{t}(U^{t_{1}}C_{4})^{t_{2}}\ket{\psi_{0}}|=\Omega(1) by Lemma 4, where the target state |t\ket{t} is an equal superposition of |S1|S2\ket{S_{1}}\ket{S_{2}} with aS1,bS2a\in S_{1},b\in S_{2} (assuming aR1,bR2a\in R_{1},b\in R_{2}), and pp can be computed exactly beforehand. Thus combined with Lemma 2, we can obtain |t\ket{t} with certainty. Denote by 𝒜4\mathcal{A}_{4} the above process that on input state |R1|R2|z\ket{R_{1}}\ket{R_{2}}\ket{z}, implements |0|t\ket{0}\mapsto\ket{t}. Then applying C4C_{4} once more we can flip an auxiliary qubit with certainty. Thus 𝒜4C4𝒜4\mathcal{A}_{4}^{\dagger}C_{4}\mathcal{A}_{4} implements C3C_{3} with 100% success probability, and it acts nontrivially when |R1|=1|R_{1}\cap\triangle|=1, |R2|=1|R_{2}\cap\triangle|=1 and |z|=1|z\cap\triangle|=1.

Implementing C2C_{2} with 100% success probability. The input state of layer 3 is |R1|R2,y\ket{R_{1}}\ket{R_{2},y}, and the search space is z[n]R1R2yz\in[n]-R_{1}-R_{2}-y. Thus combined with the effect of C3C_{3} shown above, we can see that only when the input state |R1|R2,y\ket{R_{1}}\ket{R_{2},y} satisfies |R1|=1|R_{1}\cap\triangle|=1, |R2|=1|R_{2}\cap\triangle|=1 and yy\notin\triangle, does C3IC_{3}\neq I. In this special case, suppose aR1,bR2a\in R_{1},b\in R_{2}, then the only target t[n]R1R2yt\in[n]-R_{1}-R_{2}-y is cc\in\triangle. Therefore, using the deterministic quantum search shown by Lemma 2, we can obtain |t\ket{t}. Denote by 𝒜3\mathcal{A}_{3} the above process that on input state |R1|R2,y\ket{R_{1}}\ket{R_{2},y}, implements |0|t\ket{0}\mapsto\ket{t}. Then applying C3C_{3} once more we can flip an auxiliary qubit with certainty, and thus 𝒜3C3𝒜4\mathcal{A}_{3}^{\dagger}C_{3}\mathcal{A}_{4} implements C2C_{2} with 100% success probability, which acts nontrivially when |R1|=1|R_{1}\cap\triangle|=1, |R2|=1|R_{2}\cap\triangle|=1 and yy\notin\triangle.

Implementing C1C_{1} with 100% success probability. Recall that we want C1C_{1} to act nontrivially on |R1|R1|D(R1)\ket{R_{1}}\ket{R_{1}^{\prime}}\ket{D(R_{1})} when |R1|=1|R_{1}\cap\triangle|=1 and |R1|=1|R_{1}^{\prime}\cap\triangle|=1. We will implement C1C_{1} from C¯1\bar{C}_{1}, which acts nontrivially on |R1|D(R1)\ket{R_{1}}\ket{D(R_{1})} when |R1|=1|R_{1}\cap\triangle|=1. The implementation of C1C_{1} from C¯1\bar{C}_{1} is described in Section 4.3, which requires c1=2u1+4c¯1c_{1}=2u_{1}+4\bar{c}_{1} queries. Since u1=n5/7c1¯=n7.5/7u_{1}=n^{5/7}\ll\bar{c_{1}}=n^{7.5/7}, we have c1=Θ(c¯1)c_{1}=\Theta(\bar{c}_{1}). We now describe how to implement C¯1\bar{C}_{1}. The input state is |R1|D(R1)\ket{R_{1}}\ket{D(R_{1})}, and the quantum walk basis state is |R2,y\ket{R_{2},y} with R2[n]R1R_{2}\subseteq[n]-R_{1}, y[n]R1R2y\in[n]-R_{1}-R_{2}. From the effect of C2C_{2} shown above, we can see that only when the input state satisfies |R1|=1|R_{1}\cap\triangle|=1, does C2IC_{2}\neq I. In this special case, |([n]R1)|=2|([n]-R_{1})\cap\triangle|=2, and thus the quantum walk search process satisfies Condition 1 with K=R1K=\triangle-R_{1} and (j0,l0)=(1,0)(j_{0},l_{0})=(1,0). Therefore, the walk can be reduced to a 2-dimensional invariant subspace by Lemma 1, and then by Lemma 3 we can obtain with certainty the target state |t\ket{t}, which is an equal superposition of |R2,y\ket{R_{2},y} with |R2|=1|R_{2}\cap\triangle|=1 and yy\notin\triangle. See Section 4.2 for more details. Denote by 𝒜2\mathcal{A}_{2} the above process that on input state |R1|D(R1)\ket{R_{1}}\ket{D(R_{1})}, implements |0|t\ket{0}\mapsto\ket{t}. Then applying C2C_{2} once more we can flip an auxiliary qubit with certainty, and thus 𝒜2C2𝒜2\mathcal{A}_{2}^{\dagger}C_{2}\mathcal{A}_{2} implements C¯1\bar{C}_{1} with 100% success probability.

Remark 1.

It’s worth noting that in the implementation of C¯1\bar{C}_{1} in layer 2, we cannot use Lemma 2 to obtain with certainty the target state like in the implementation of C3C_{3} in layer 4. This is because in the implementation of the phase shift operator Sψ0(β)=eiβ|ψ0ψ0|S_{\psi_{0}}(\beta)=e^{-i\beta\ket{\psi_{0}}\bra{\psi_{0}}} in Lemma 2, we would otherwise need to query r1×r2r_{1}\times r_{2} times to construct |GR1,R2\ket{G_{R_{1},R_{2}}} in |ψ0\ket{\psi_{0}}, which is intolerable since r1×r2=n9/7r_{1}\times r_{2}=n^{9/7} would then be multiplied by 1/ϵ1=n1.5/71/\sqrt{\epsilon_{1}}=n^{1.5/7} of layer 1, making the query complexity exceed n9/7n^{9/7}.

Derandomizing layer 1 and finishing the proof of Theorem 1. As shown above, C1C_{1} acts nontrivially only when basis state |R1|R1|D(R1)\ket{R_{1}}\ket{R_{1}^{\prime}}\ket{D(R_{1})} satisfies |R1|=1|R_{1}\cap\triangle|=1 and |R1|=1|R_{1}^{\prime}\cap\triangle|=1. Therefore, the quantum walk search on G1=J(n,r1)G_{1}=J(n,r_{1}) can be reduced to a 1010-dimensional invariant subspace, as shown in Section 4.3. Also, by setting t1=π22r1t_{1}=\lfloor\frac{\pi}{2}\sqrt{2r_{1}}\rceil and t2=π4n3r1t_{2}=\lfloor\frac{\pi}{4}\sqrt{\frac{n}{3r_{1}}}\rceil, the success amplitude p=|t|(Wt1C1)t2|ψ0|=Ω(1)p=\left|\bra{t}(W^{t_{1}}C_{1})^{t_{2}}\ket{\psi_{0}}\right|=\Omega(1) as shown by Lemma 6, and pp can be computed exactly beforehand. Thus combined with Lemma 2, we can obtain with certainty the target state |t\ket{t}, which is an equal superposition of |R1\ket{R_{1}} satisfying |R1|=1|R_{1}\cap\triangle|=1.

We can now apply the deterministic (quantum walk) search 𝒜2,𝒜3,𝒜4\mathcal{A}_{2},\mathcal{A}_{3},\mathcal{A}_{4} of layers 2,3,4 successively and then measure all the registers. This will lead to |R1|R2|z|S1|S2\ket{R_{1}}\ket{R_{2}}\ket{z}\ket{S_{1}}\ket{S_{2}} satisfying aS1a\in S_{1}, bS2b\in S_{2} and z=cz=c. Thus from the associated data |GR1,R2|GS1,z|GS2,z\ket{G_{R_{1},R_{2}}}\ket{G_{S_{1},z}}\ket{G_{S_{2},z}} we can find the target abc\triangle abc with certainty. If there’s no aS1,bS2a\in S_{1},b\in S_{2} such that Aa,b+Aa,z+Ab,z=dA_{a,b}+A_{a,z}+A_{b,z}=d, we claim that the graph GG does not contain the target triangle.

4 Details of quantum walk search in different layer

In the following subsections, we will fill in the missing details of the three aforementioned quantum walk search on Johnson graphs: (i) edge-walk on G1=J(n,r1)G_{1}=J(n,r_{1}) of layer 1, (ii) vertex-walk on G2=J(n1,r2)G_{2}=J(n_{1},r_{2}) of layer 2, and (iii) vertex-walk on the product Johnson graph G4=J(r1,m)×J(r2,m)G_{4}=J(r_{1},m)\times J(r_{2},m) of layer 4. We start with the layer 4 whose checking operation does not rely on other layer.

4.1 Layer 4

Suppose the input state |R1|R2|GR1,R2|z\ket{R_{1}}\ket{R_{2}}\ket{G_{R_{1},R_{2}}}\ket{z} of this layer satisfies aR1,bR2,z=ca\in R_{1},b\in R_{2},z=c, the target state of quantum vertex-walk search on G4=J(r1,m)×J(r2,m)G_{4}=J(r_{1},m)\times J(r_{2},m) is an equal superposition of |S1|S2\ket{S_{1}}\ket{S_{2}} such that aS1,bS2a\in S_{1},b\in S_{2}.

Setup. The initial state is

|ψ0=i=121(rim)SiRi|Si|GSi,z1rimziRiSi|zi.\ket{\psi_{0}}=\bigotimes_{i=1}^{2}\frac{1}{\sqrt{\binom{r_{i}}{m}}}\sum_{S_{i}\subseteq R_{i}}\ket{S_{i}}\ket{G_{S_{i},z}}\frac{1}{\sqrt{r_{i}-m}}\sum_{z_{i}\in R_{i}-S_{i}}\ket{z_{i}}. (53)

We first construct an equal superposition of |Si\ket{S_{i}} s.t. SiRiS_{i}\subseteq R_{i} and |Si|=m|S_{i}|=m based on |Ri\ket{R_{i}}, and then query the oracle for mm times to construct the associated data |GSi,z\ket{G_{S_{i},z}} based on |Si|z\ket{S_{i}}\ket{z}, and finally construct an equal superposition of |zi\ket{z_{i}} s.t. ziRiSiz_{i}\in R_{i}-S_{i} based on |Ri|Si\ket{R_{i}}\ket{S_{i}}.

Update. A step of quantum walk UU consists of 22 query operations and 22 diffusion operations:

U=QUBQUA,U=Q\cdot U_{B}\cdot Q\cdot U_{A}, (54)

with working registers:

|zi=12|Ri|Si|zi|GSi,z|Gzi,z.\ket{z}\bigotimes_{i=1}^{2}\ket{R_{i}}\ket{S_{i}}\ket{z_{i}}\ket{G_{S_{i},z}}\ket{G_{z_{i},z}}. (55)

The first diffusion operation UAU_{A} acts on registers i=12|Ri|Si|zi\bigotimes_{i=1}^{2}\ket{R_{i}}\ket{S_{i}}\ket{z_{i}}, and can be seen as choosing a random ziRiSiz_{i}\in R_{i}-S_{i} to be moved into SiS_{i}:

UA\displaystyle U_{A} =R1,R2S1R1S2R2i=12|Ri,SiRi,Si|(2i=12(|φ(Ri,Si)φ(Si,Ri)|)I),\displaystyle=\sum_{R_{1},R_{2}}\sum_{S_{1}\subseteq R_{1}}\sum_{S_{2}\subseteq R_{2}}\bigotimes_{i=1}^{2}\ket{R_{i},S_{i}}\bra{R_{i},S_{i}}\otimes\Big{(}2\bigotimes_{i=1}^{2}\big{(}\ket{\varphi(R_{i},S_{i})}\bra{\varphi(S_{i},R_{i})}\big{)}-I\Big{)}, (56)
|φ(Si,Ri)\displaystyle\ket{\varphi(S_{i},R_{i})} =1rimziRiSi|zi.\displaystyle=\frac{1}{\sqrt{r_{i}-m}}\sum_{z_{i}\in R_{i}-S_{i}}\ket{z_{i}}. (57)

The sum R1,R2\sum_{R_{1},R_{2}} is over R1[n]R_{1}\subseteq[n], R2[n]R1R_{2}\subseteq[n]-R_{1}, and for other R2,S1,S2R_{2},S_{1},S_{2} we define UAU_{A} to act trivially on |z1|z2\ket{z_{1}}\ket{z_{2}}. The query operation QQ calls the oracle OO (Eq. (1)) on registers |zi|z|Gzi,z\ket{z_{i}}\ket{z}\ket{G_{z_{i},z}} for i=1,2i=1,2. The second diffusion operation UBU_{B} acts on all registers except |z\ket{z}, and can be seen as choosing a random ziSiz_{i}^{\prime}\in S_{i} being removed from SiS_{i} and at the same time moving ziz_{i} into SiS_{i}, while updating the associated data |GSi,z|Gzi,z\ket{G_{S_{i},z}}\ket{G_{z_{i},z}} simultaneously:

UB\displaystyle U_{B} =R1,R2|R1,R2R1,R2|CR1,R2,\displaystyle=\sum_{R_{1},R_{2}}\ket{R_{1},R_{2}}\bra{R_{1},R_{2}}\otimes C_{R_{1},R_{2}}, (58)
CR1,R2\displaystyle C_{R_{1},R_{2}} =2i=12(Si+ziRiG¯i[M]m+1|φSi+ziG¯iφSi+ziG¯i|)I,\displaystyle=2\bigotimes_{i=1}^{2}\left(\sum_{S_{i}+z_{i}\subseteq R_{i}}\sum_{\bar{G}_{i}\in[M]^{m+1}}\ket{\varphi_{S_{i}+z_{i}}^{\bar{G}_{i}}}\bra{\varphi_{S_{i}+z_{i}}^{\bar{G}_{i}}}\right)-I, (59)
|φSi+ziG¯i\displaystyle\ket{\varphi_{S_{i}+z_{i}}^{\bar{G}_{i}}} =1m+1ziSi+zi|Si|zi|GSi,z|Gzi,z.\displaystyle=\frac{1}{\sqrt{m+1}}\sum_{z_{i}^{\prime}\in S_{i}+z_{i}}\ket{S_{i}^{\prime}}\ket{z_{i}^{\prime}}\ket{G_{S_{i}^{\prime},z}}\ket{G_{z_{i}^{\prime},z}}. (60)

In |φSi+ziG¯i\ket{\varphi_{S_{i}+z_{i}}^{\bar{G}_{i}}}, suppose the vertical juxtaposition [GSi,z;Gzi,z]=G¯i[G_{S_{i},z};G_{z_{i},z}]=\bar{G}_{i}, then for |Si|zi\ket{S_{i}^{\prime}}\ket{z_{i}^{\prime}} s.t. Si=Sizi+ziS_{i}^{\prime}=S_{i}-z_{i}^{\prime}+z_{i}, its associated data [GSi,z;Gzi,z][G_{S_{i}^{\prime},z};G_{z_{i}^{\prime},z}] is a corresponding permutation of G¯i\bar{G}_{i}: we exchange row ziz_{i} and ziz_{i}^{\prime} in G¯i\bar{G}_{i}, and then sort the first mm rows in the ascending order. Thus, if G¯i\bar{G}_{i} is a sub-matrix of the edge weight matrix AA, then GSi,zG_{S_{i}^{\prime},z} is still a sub-matrix of AA with rows indexed by SiS_{i}^{\prime} and columns indexed by zz.

Checking. The checking operation C4C_{4} flips an auxiliary qubit if there exists aS1,bS2a\in S_{1},b\in S_{2} such that Aa,b+Ab,z+Aa,z=dA_{a,b}+A_{b,z}+A_{a,z}=d, based on the data |GSi,z\ket{G_{S_{i},z}} constructed in layer 4, and |GR1,R2\ket{G_{R_{1},R_{2}}} constructed in layer 1. Thus no additional query is needed. Using the phase kick-back effect: X|=|X\ket{-}=-\ket{-}, where XX is the Pauli-X matrix and |:=(|0|1)/2\ket{-}:=(\ket{0}-\ket{1})/\sqrt{2}, we can add (1)(-1) phase shift to the marked states.

Invariant subspace. Denote by |(j1,j2)(k1,k2)\ket{(j_{1},j_{2})-(k_{1},k_{2})} the equal superposition of states in {|S1,z1,S2,z2:|Si|=ji,|(Si+zi)|=ki}\{\ket{S_{1},z_{1},S_{2},z_{2}}:|S_{i}\cap\triangle|=j_{i},|(S_{i}+z_{i})\cap\triangle|=k_{i}\}. The 99 basis states of the quantum walk’s invariant subspace 0\mathcal{H}_{0} is illustrated in Fig. 2.

Refer to caption
Figure 2: Illustration of the 99 basis states |(j1,j2)(k1,k2)\ket{(j_{1},j_{2})-(k_{1},k_{2})} of the invariant subspace 0\mathcal{H}_{0} of quantum walk search on G4=J(r1,m)×J(r2,m)G_{4}=J(r_{1},m)\times J(r_{2},m).

It can be seen form Fig. 2 that a step of quantum walk UU takes the following matrix form in 0\mathcal{H}_{0}.

W=(2BBI)(2AAI),W=(2BB^{\dagger}-I)(2AA^{\dagger}-I), (61)

where non-negative matrices AA and BB satisfy:

A.2=[(11r1m)(11r2m)0001r1m(11r2m)000(11r1m)1r2m0001(r1m)(r2m)000011r2m0001r2m000011r1m0001r1m00001],B.2=[100001m+100001m+100001(m+1)20mm+100000m(m+1)200mm+10000m(m+1)2000m2(m+1)2]A.^{2}=\begin{bmatrix}(1-\frac{1}{r_{1}-m})(1-\frac{1}{r_{2}-m})&0&0&0\\ \frac{1}{r_{1}-m}(1-\frac{1}{r_{2}-m})&0&0&0\\ (1-\frac{1}{r_{1}-m})\frac{1}{r_{2}-m}&0&0&0\\ \frac{1}{(r_{1}-m)(r_{2}-m)}&0&0&0\\ 0&1-\frac{1}{r_{2}-m}&0&0\\ 0&\frac{1}{r_{2}-m}&0&0\\ 0&0&1-\frac{1}{r_{1}-m}&0\\ 0&0&\frac{1}{r_{1}-m}&0\\ 0&0&0&1\end{bmatrix},B.^{2}=\begin{bmatrix}1&0&0&0\\ 0&\frac{1}{m+1}&0&0\\ 0&0&\frac{1}{m+1}&0\\ 0&0&0&\frac{1}{(m+1)^{2}}\\ 0&\frac{m}{m+1}&0&0\\ 0&0&0&\frac{m}{(m+1)^{2}}\\ 0&0&\frac{m}{m+1}&0\\ 0&0&0&\frac{m}{(m+1)^{2}}\\ 0&0&0&\frac{m^{2}}{(m+1)^{2}}\\ \end{bmatrix} (62)

From the number of basis states in |(j1,j2)(k1,k2)\ket{(j_{1},j_{2})-(k_{1},k_{2})} (or weights of the 99 lines in Fig. 2), it’s easy to see the initial state takes the following form in 0\mathcal{H}_{0} after simplification:

|ψ0.2=[(r1m1)(r2m1)(r2m1)(r1m1)1m(r2m1)m(r1m1)mmm2]÷(r1r2),\ket{\psi_{0}}.^{2}=\begin{bmatrix}(r_{1}-m-1)(r_{2}-m-1)\\ (r_{2}-m-1)\\ (r_{1}-m-1)\\ 1\\ m(r_{2}-m-1)\\ m\\ (r_{1}-m-1)m\\ m\\ m^{2}\end{bmatrix}\div(r_{1}r_{2}), (63)

and the overlap with the target state |t=|e9\ket{t}=\ket{e_{9}} is ϵ4=mr1r2\sqrt{\epsilon_{4}}=\frac{m}{\sqrt{r_{1}r_{2}}}.

Lemma 4.

Setting t1=π2m2t_{1}=\lfloor\frac{\pi}{2}\sqrt{\frac{m}{2}}\rceil and t2=π4r1r2mt_{2}=\lfloor\frac{\pi}{4}\frac{\sqrt{r_{1}r_{2}}}{m}\rceil, the success amplitude p=|t|(Wt1C4)t2|ψ0|p=\left|\bra{t}(W^{t_{1}}C_{4})^{t_{2}}\ket{\psi_{0}}\right| satisfies p=1O(mr2+mr1+1m)p=1-O(\frac{m}{r_{2}}+\frac{m}{r_{1}}+\frac{1}{m}).

Proof.

Similar to [42, Lemma 2], it can be shown that WW has two eigenvectors |u±\ket{u_{\pm}} with corresponding eigenvalues e±iφe^{\pm i\varphi} such that

|t|u±|\displaystyle\left|\braket{t}{u_{\pm}}\right| =12+O(1m+mr1+mr2),\displaystyle=\frac{1}{\sqrt{2}}+O(\frac{1}{m}+\frac{m}{r_{1}}+\frac{m}{r_{2}}), (64)
φ\displaystyle\varphi =22m(1+O(1m+mr1+mr1)).\displaystyle=\frac{2\sqrt{2}}{\sqrt{m}}(1+O(\frac{1}{\sqrt{m}}+\frac{m}{r_{1}}+\frac{m}{r_{1}})). (65)

Similar to [42, Lemma 3], it can be shown that when t1φπt_{1}\varphi\approx\pi and C4=2|tt|IC_{4}=2\ket{t}\bra{t}-I adds relative phase shift (1)(-1) to the only target basis state |t\ket{t} in 0\mathcal{H}_{0}, Wt1C4W^{t_{1}}C_{4} has two eigenvectors |θ±\ket{\theta_{\pm}} with corresponding eigenvalues e±iθe^{\pm i\theta} such that

t|θ±\displaystyle\braket{t}{\theta_{\pm}} =12+δ,ψ0|θ±=±i2+δ,\displaystyle=\frac{1}{\sqrt{2}}+\delta,\quad\braket{\psi_{0}}{\theta_{\pm}}=\pm\frac{i}{\sqrt{2}}+\delta, (66)
θ\displaystyle\theta =2mr1r2(1+δ),\displaystyle=\frac{2m}{\sqrt{r_{1}r_{2}}}(1+\delta), (67)

where δ=O(mr2+mr1+1m)\delta=O(\frac{m}{r_{2}}+\frac{m}{r_{1}}+\frac{1}{m}). Consider p(t2)=|t|(Wt1C4)t2|ψ0|p(t_{2})=\left|\bra{t}(W^{t_{1}}C_{4})^{t_{2}}\ket{\psi_{0}}\right|. Let Π±:=|θ+θ+|+|θθ|\Pi_{\pm}:=\ket{\theta_{+}}\bra{\theta_{+}}+\ket{\theta_{-}}\bra{\theta_{-}}, and Πj\Pi_{j} be the projection onto the other 77 eigenvectors of Wt1C4W^{t_{1}}C_{4}. Then Π±|ψ0=1δ\|\Pi_{\pm}\ket{\psi_{0}}\|=1-\delta, and |t|Πj|ψ0|Πj|ψ0=δ\left|\bra{t}\Pi_{j}\ket{\psi_{0}}\right|\leq\|\Pi_{j}\ket{\psi_{0}}\|=\delta. Therefore,

p(t2)\displaystyle p(t_{2}) |eit2θt|θ+θ+|ψ0+eit2θt|θθ|ψ0|j|t|Πj|ψ0|\displaystyle\geq\left|e^{it_{2}\theta}\braket{t}{\theta_{+}}\braket{\theta_{+}}{\psi_{0}}+e^{-it_{2}\theta}\braket{t}{\theta_{-}}\braket{\theta_{-}}{\psi_{0}}\right|-\sum_{j}\left|\bra{t}\Pi_{j}\ket{\psi_{0}}\right| (68)
|eit2θi2(1+δ)+eit2θi2(1+δ)|7δ\displaystyle\geq\left|e^{it_{2}\theta}\frac{-i}{2}(1+\delta)+e^{-it_{2}\theta}\frac{i}{2}(1+\delta)\right|-7\delta (69)
=sin(t2θ)O(δ).\displaystyle=\sin(t_{2}\theta)-O(\delta). (70)

Setting t2=π4r1r2mt_{2}=\lfloor\frac{\pi}{4}\frac{\sqrt{r_{1}r_{2}}}{m}\rceil we have p(t2)=1δp(t_{2})=1-\delta which completes the proof. ∎

4.2 Layer 2

Suppose the input state |R1|D(R1)\ket{R_{1}}\ket{D(R_{1})} (see Eq. (43) for D(R1)D(R_{1})) of this layer satisfies |R1|=1|R_{1}\cap\triangle|=1, the target state of quantum edge-walk search on G2=J(n1,r2)G_{2}=J(n_{1},r_{2}) is an equal superposition of |R2,y\ket{R_{2},y} such that |R2|=1,y|R_{2}\cap\triangle|=1,y\notin\triangle.

Setup. The initial state is

|ψ0=|R1|D(R1)1n2y|y,\ket{\psi_{0}}=\ket{R_{1}}\ket{D(R_{1})}\frac{1}{\sqrt{n_{2}}}\sum_{y}\ket{y}, (71)

where |D(R1)=1(n1r2)R2[n]R1|R2|GR1,R2\ket{D(R_{1})}=\frac{1}{\sqrt{\binom{n_{1}}{r_{2}}}}\sum_{R_{2}\subseteq[n]-R_{1}}\ket{R_{2}}\ket{G_{R_{1},R_{2}}}. We only need to construct an equal superposition of y[n]R1R2y\in[n]-R_{1}-R_{2} based on |R1|R2\ket{R_{1}}\ket{R_{2}}, which requires no query.

Update. A step of quantum walk UU consists of 22 query operations and 22 diffusion operations:

U=QUB(θ2)QUA(θ1),U=Q\cdot U_{B}(\theta_{2})\cdot Q\cdot U_{A}(\theta_{1}), (72)

with working registers:

|R1|R2|GR1,R2|y|GR1,y.\ket{R_{1}}\ket{R_{2}}\ket{G_{R_{1},R_{2}}}\ket{y}\ket{G_{R_{1},y}}. (73)

The first diffusion operation UA(θ1)U_{A}(\theta_{1}) acts on registers |R1|R2|y\ket{R_{1}}\ket{R_{2}}\ket{y}, and can be seen as choosing a random y[n]R1R2y\in[n]-R_{1}-R_{2} to be moved in to R2R_{2}:

UA(θ1)\displaystyle U_{A}(\theta_{1}) =R1R2=ϕ|R1,R2R1,R2|CR1,R2(θ1),\displaystyle=\sum_{R_{1}\cap R_{2}=\phi}\ket{R_{1},R_{2}}\bra{R_{1},R_{2}}\otimes C_{R_{1},R_{2}}(\theta_{1}), (74)
CR1,R2(θ1)\displaystyle C_{R_{1},R_{2}}(\theta_{1}) =I(1eiθ1)|φ(R1,R2)φ(R1,R2)|,\displaystyle=I-(1-e^{i\theta_{1}})\ket{\varphi(R_{1},R_{2})}\bra{\varphi(R_{1},R_{2})}, (75)
|φ(R1,R2)\displaystyle\ket{\varphi(R_{1},R_{2})} =1n2y[n]R1R2|y\displaystyle=\frac{1}{\sqrt{n_{2}}}\sum_{y\in[n]-R_{1}-R_{2}}\ket{y} (76)

The query operation QQ calls the oracle OO (Eq. (1)) for r1r_{1} times to update the data GR1,yG_{R_{1},y} associated with |R1|y\ket{R_{1}}\ket{y}. The second diffusion operation UB(θ2)U_{B}(\theta_{2}) acts on all registers, and can be seen as choosing a random yR2y^{\prime}\in R_{2} being removed from R2R_{2} and at the same time moving yy into R2R_{2}, while updating the associated data |GR1,R2|GR1,y\ket{G_{R_{1},R_{2}}}\ket{G_{R_{1},y}} simultaneously:

UB(θ2)\displaystyle U_{B}(\theta_{2}) =R1|R1R1|CR1(θ2),\displaystyle=\sum_{R_{1}}\ket{R_{1}}\bra{R_{1}}\otimes C_{R_{1}}(\theta_{2}), (77)
CR1(θ2)\displaystyle C_{R_{1}}(\theta_{2}) =I(1eiθ2)R2+y[n]R1G¯[M]r1×(r2+1)|φR2+yG¯φR2+yG¯|,\displaystyle=I-(1-e^{i\theta_{2}})\sum_{R_{2}+y\subseteq[n]-R_{1}}\sum_{\bar{G}\in[M]^{r_{1}\times(r_{2}+1)}}\ket{\varphi_{R_{2}+y}^{\bar{G}}}\bra{\varphi_{R_{2}+y}^{\bar{G}}}, (78)
|φR2+yG¯\displaystyle\ket{\varphi_{R_{2}+y}^{\bar{G}}} =1r2+1yR2+y|R2|y|GR1,R2|GR1,y.\displaystyle=\frac{1}{\sqrt{r_{2}+1}}\sum_{y^{\prime}\in R_{2}+y}\ket{R_{2}^{\prime}}\ket{y^{\prime}}\ket{G_{R_{1},R_{2}^{\prime}}}\ket{G_{R_{1},y^{\prime}}}. (79)

In |φR2+yG¯\ket{\varphi_{R_{2}+y}^{\bar{G}}}, suppose the horizontal juxtaposition [GR1,R2,GR1,y][G_{R_{1},R_{2}},G_{R_{1},y}] equals G¯\bar{G}, then for |R2|y\ket{R_{2}^{\prime}}\ket{y^{\prime}} s.t. R2=R2y+yR_{2}^{\prime}=R_{2}-y^{\prime}+y, its associated data [GR1,R2,GR1,y][G_{R_{1},R_{2}^{\prime}},G_{R_{1},y^{\prime}}] is an appropriate permutation of the columns of G¯\bar{G}. This is similar to |φSi+ziG¯i\ket{\varphi_{S_{i}+z_{i}}^{\bar{G}_{i}}} defined in Eq. (60).

Checking. The checking operator S(α)=C2(Idiag(1,eiα))C2S_{\mathcal{M}}(\alpha)=C_{2}(I\otimes\mathrm{diag}(1,e^{i\alpha}))C_{2} adds phase shift eiαe^{i\alpha} to states |R1|R2|GR1,R2|y\ket{R_{1}}\ket{R_{2}}\ket{G_{R_{1},R_{2}}}\ket{y} which satisfies |R1|=1|R_{1}\cap\triangle|=1, |R2|=1|R_{2}\cap\triangle|=1 and yy\notin\triangle.

Assume |R1|=1|R_{1}\cap\triangle|=1, then |([n]R1)|=2|([n]-R_{1})\cap\triangle|=2. Therefore, the quantum vertex-walk search on G2=J(n1,r2)G_{2}=J(n_{1},r_{2}) satisfies Condition 1 with K=R1K=\triangle-R_{1} and (j0,l0)=(1,0)(j_{0},l_{0})=(1,0), and we can obtain the same 55-dimensional invariant subspace as shown by Fig. 1 in Section 2.2, but now N:=n1N:=n_{1}, r:=r2r:=r_{2}, R:=R2R:=R_{2}, and K:=R1K:=\triangle-R_{1}. Since the target state is now |t=|1,0\ket{t}=\ket{1,0}, the proportion of marked states becomes

ϵ2\displaystyle\epsilon_{2} =2(n12r21)(n1r21)(n1r2)(n1r2)\displaystyle=\frac{2\binom{n_{1}-2}{r_{2}-1}(n_{1}-r_{2}-1)}{\binom{n_{1}}{r_{2}}(n_{1}-r_{2})} (80)
=2r2n1(1r2n11)=Θ(r2n).\displaystyle=2\frac{r_{2}}{n_{1}}(1-\frac{r_{2}}{n_{1}-1})=\Theta(\frac{r_{2}}{n}). (81)

Thus by combing Lemma 1 (where now tO(r2)t\in O(\sqrt{r_{2}})) and Lemma 3 (let Sψ0(β)=UtS_{\psi_{0}}(-\beta)=U^{t} and λ=ϵ2\lambda=\epsilon_{2}), we can obtain |t\ket{t} with certainty, and the query complexity is 0+n/r2(r2r1+c2)0+\sqrt{{n}/{r_{2}}}(\sqrt{r_{2}}r_{1}+c_{2}), same as Eq. (45).

4.3 Layer 1

The goal of this layer is to construct an equal superposition of |R1|R1\ket{R_{1}}\ket{R_{1}^{\prime}} such that |R1|=1|R_{1}\cap\triangle|=1 and |R1|=1|R_{1}^{\prime}\cap\triangle|=1. The quantum edge-walk search on G1=J(n,r1)G_{1}=J(n,r_{1}) is the same as in Section 2.1. We first describe how to implement the update operator in the following lemma.

Lemma 5.

The ‘Data’ operator that transform the data D(R1)D(R_{1}) to D(R1)D(R_{1}^{\prime}) based on |R1|R1\ket{R_{1}^{\prime}}\ket{R_{1}} requires 2(r1+r2)2(r_{1}+r_{2}) queries.

Proof.

The transformation consists of the following two steps:

|D(R1)=\displaystyle\ket{D(R_{1})}= 1(n1r2)R2R1=ϕ|R2|GR1,R2\displaystyle\frac{1}{\sqrt{\binom{n_{1}}{r_{2}}}}\sum_{R_{2}\cap R_{1}=\phi}\ket{R_{2}}\ket{G_{R_{1},R_{2}}}
U1,1\displaystyle U_{1,1}\mapsto 1(n1r2)R2R1=ϕ|R2|GR1,R2\displaystyle\frac{1}{\sqrt{\binom{n_{1}}{r_{2}}}}\sum_{R_{2}^{\prime}\cap R_{1}^{\prime}=\phi}\ket{R_{2}^{\prime}}\ket{G_{R_{1},R_{2}^{\prime}}} (82)
U1,2\displaystyle U_{1,2}\mapsto 1(n1r2)R2R1=ϕ|R2|GR1,R2=|D(R1).\displaystyle\frac{1}{\sqrt{\binom{n_{1}}{r_{2}}}}\sum_{R_{2}^{\prime}\cap R_{1}^{\prime}=\phi}\ket{R_{2}^{\prime}}\ket{G_{R_{1}^{\prime},R_{2}^{\prime}}}=\ket{D(R_{1}^{\prime})}. (83)

Specifically, let x1:=R1R1x_{1}:=R_{1}\setminus R_{1}^{\prime} and x1=R1R1x_{1}^{\prime}=R_{1}^{\prime}\setminus R_{1}, which can be calculated from |R1|R1\ket{R_{1}}\ket{R_{1}^{\prime}}. Consider some R2[n]R1R_{2}\subseteq[n]-R_{1}. If x1R2x_{1}^{\prime}\notin R_{2}, then U1,1U_{1,1} keeps R2R_{2} unchanged; if x1R2x_{1}^{\prime}\in R_{2}, then U1,1U_{1,1} implements R2R2=R2x1+x1R_{2}\mapsto R_{2}^{\prime}=R_{2}-x_{1}^{\prime}+x_{1} and also update the data |GR1,R2\ket{G_{R_{1},R_{2}}} simultaneously: it clears the data GR1,x1G_{R_{1},x_{1}^{\prime}} in column x1x_{1}^{\prime}, and then writes back GR1,x1G_{R_{1},x_{1}}, and finally permutes the r2r_{2} columns so that the indexes R2=R2x1+x1R_{2}^{\prime}=R_{2}-x_{1}^{\prime}+x_{1} remain the ascending order. Therefore, U1,1U_{1,1} requires 2r12r_{1} queries.

Operator U1,2U_{1,2} does not need to deal with separate cases, and is simpler to implement. It updates Gx1,R2G_{x_{1},R_{2}^{\prime}} to Gx1,R2G_{x_{1}^{\prime},R_{2}^{\prime}} in row x1x_{1}, and then permutes the r1r_{1} rows so that the indexes R1=R1x1+x1R_{1}^{\prime}=R_{1}-x_{1}+x_{1}^{\prime} remain the ascending order. Therefore, U1,2U_{1,2} requires 2r22r_{2} queries. The above process is illustrated in Fig. 3.

Refer to caption
Figure 3: The update operator in layer 1 requires 2r1+2r22r_{1}+2r_{2} queries as shown in Lemma 5.

Checking. The checking operator C1C_{1} adds phase shift to |R1|R1|D(R1)\ket{R_{1}}\ket{R_{1}^{\prime}}\ket{D(R_{1})} such that |R1|=1|R_{1}\cap\triangle|=1 and |R1|=1|R_{1}^{\prime}\cap\triangle|=1. Suppose C¯1\bar{C}_{1} implemented in layer 2 flips an auxiliary qubit based on |D(R1)\ket{D(R_{1})} if |R1|=1|R_{1}\cap\triangle|=1, then C1C_{1} can be implemented with costs c1=2u1+4c¯1c_{1}=2u_{1}+4\bar{c}_{1} as shown below:

1. apply C¯1\bar{C}_{1} to |R1|D(R1)\ket{R_{1}}\ket{D(R_{1})} and store the result on |b1\ket{b_{1}} initialized to |0\ket{0}; 2. update the data |D(R1)\ket{D(R_{1})} to |D(R1)\ket{D(R_{1}^{\prime})} using Lemma 5; 3. apply C¯1\bar{C}_{1} to |R1|D(R1)\ket{R_{1}^{\prime}}\ket{D(R_{1}^{\prime})} and store the result on |b1\ket{b_{1}^{\prime}} initialized to |0\ket{0}; 4. use phase kick-back to add phase shift (1)(-1) if b1b1=1b_{1}\wedge b_{1}^{\prime}=1; 5. clear the register |b1\ket{b_{1}}, |b1\ket{b_{1}^{\prime}} and recover D(R1)D(R_{1}) by applying the inverse of the first 3 steps.

Invariant subspace. Denote by |j,l\ket{j,l} the equal superposition of states |R1|R1\ket{R_{1}}\ket{R_{1}^{\prime}} satisfying |R1|=j\left|R_{1}\cap\triangle\right|=j and |R1|=l\left|R_{1}^{\prime}\cap\triangle\right|=l. The 1010 basis states of the quantum walk’s invariant subspace 0\mathcal{H}_{0} is illustrated in Fig. 4.

Refer to caption
Figure 4: Illustration of the 1010 basis states |j,l\ket{j,l} of the invariant subspace 0\mathcal{H}_{0} of quantum walk search on G1=J(n,r1)G_{1}=J(n,r_{1}).

It can be seen from Fig. 4 and the definition of a step of quantum walk UU which consists of ‘Coin’ and ‘Swap’ operators as shown in Section 2.1, that UU takes the following matrix form WW in 0\mathcal{H}_{0}:

W=S(2AAI),W=S(2AA^{\dagger}-I), (84)

where S=diag(1,X,1,X,1,X,1)S=\mathrm{diag}(1,X,1,X,1,X,1), and non-negative matrix AA satisfies

A.2=[13nr0003nr0000nr2r(nr)000(r1)(nr2)+2r(nr)0002(r1)r(nr)00002(nr1)r(nr)000(r2)(nr1)+2r(nr)000r2r(nr)00003r00013r].A.^{2}=\begin{bmatrix}1-\frac{3}{n-r}&0&0&0\\ \frac{3}{n-r}&0&0&0\\ 0&\frac{n-r-2}{r(n-r)}&0&0\\ 0&\frac{(r-1)(n-r-2)+2}{r(n-r)}&0&0\\ 0&\frac{2(r-1)}{r(n-r)}&0&0\\ 0&0&\frac{2(n-r-1)}{r(n-r)}&0\\ 0&0&\frac{(r-2)(n-r-1)+2}{r(n-r)}&0\\ 0&0&\frac{r-2}{r(n-r)}&0\\ 0&0&0&\frac{3}{r}\\ 0&0&0&1-\frac{3}{r}\end{bmatrix}. (85)

The initial state takes the following form in 0\mathcal{H}_{0}:

|ψ0.2=[(nr11)(nr12)(nr13)3(nr11)(nr12)3(nr11)(nr12)3(nr11)((r11)(nr12)+2)6(r11)(nr11)6(r11)(nr11)3(r11)((r12)(nr11)+2)3(r11)(r12)3(r11)(r12)(r11)(r12)(r13)]÷(n(n1)(n2)).\ket{\psi_{0}}.^{2}=\begin{bmatrix}(n-r_{1}-1)(n-r_{1}-2)(n-r_{1}-3)\\ 3(n-r_{1}-1)(n-r_{1}-2)\\ 3(n-r_{1}-1)(n-r_{1}-2)\\ 3(n-r_{1}-1)((r_{1}-1)(n-r_{1}-2)+2)\\ 6(r_{1}-1)(n-r_{1}-1)\\ 6(r_{1}-1)(n-r_{1}-1)\\ 3(r_{1}-1)((r_{1}-2)(n-r_{1}-1)+2)\\ 3(r_{1}-1)(r_{1}-2)\\ 3(r_{1}-1)(r_{1}-2)\\ (r_{1}-1)(r_{1}-2)(r_{1}-3)\end{bmatrix}\div(n(n-1)(n-2)). (86)

It can be seen that the overlap between |ψ0\ket{\psi_{0}} and the target state |t=|e4\ket{t}=\ket{e_{4}} is ϵ1=Θ(r1/n)\sqrt{\epsilon_{1}}=\Theta(\sqrt{r_{1}/n}).

Lemma 6.

Setting t1=π22r1t_{1}=\lfloor\frac{\pi}{2}\sqrt{2r_{1}}\rceil and t2=π4n3r1t_{2}=\lfloor\frac{\pi}{4}\sqrt{\frac{n}{3r_{1}}}\rceil, the success amplitude p=|t|(Wt1C1)t2|ψ0|p=\left|\bra{t}(W^{t_{1}}C_{1})^{t_{2}}\ket{\psi_{0}}\right| satisfies p=1O(1r1+r1n)p=1-O(\frac{1}{r_{1}}+\frac{r_{1}}{n}).

Proof.

Similar to [42, Lemma 2], it can be shown that WW has two eigenvectors |u±\ket{u_{\pm}} with eigenvalues e±iφe^{\pm i\varphi} such that

|t|u±|\displaystyle\left|\braket{t}{u_{\pm}}\right| =12+δ,\displaystyle=\frac{1}{\sqrt{2}}+\delta, (87)
φ\displaystyle\varphi =2r(1+δ),\displaystyle=\sqrt{\frac{2}{r}}(1+\delta), (88)

where δ:=O(1r1+r1n)\delta:=O(\frac{1}{r_{1}}+\frac{r_{1}}{n}). To make t1φπt_{1}\varphi\approx\pi, we set t1t_{1} to be the nearest integer to π22r1\frac{\pi}{2}\sqrt{2r_{1}}. Note that C1=2|tt|IC_{1}=2\ket{t}\bra{t}-I adds phase shift to the only target basis state |t=|e4\ket{t}=\ket{e_{4}} in 0\mathcal{H}_{0}. Thus, similar to [42, Lemma 3], it can be shown that Wt1C1W^{t_{1}}C_{1} has two eigenvectors |θ±\ket{\theta_{\pm}} with eigenvalues e±iθe^{\pm i\theta} such that

t|θ±\displaystyle\braket{t}{\theta_{\pm}} =12+δ,ψ0|θ±=±i2+δ,\displaystyle=\frac{1}{\sqrt{2}}+\delta,\quad\braket{\psi_{0}}{\theta_{\pm}}=\pm\frac{i}{\sqrt{2}}+\delta, (89)
θ\displaystyle\theta =23rn(1+δ).\displaystyle=2\sqrt{\frac{3r}{n}}(1+\delta). (90)

Consider p(t2)=|t|(Wt1C1)t2|ψ0|p(t_{2})=\left|\bra{t}(W^{t_{1}}C_{1})^{t_{2}}\ket{\psi_{0}}\right|. Let Π±:=|θ+θ+|+|θθ|\Pi_{\pm}:=\ket{\theta_{+}}\bra{\theta_{+}}+\ket{\theta_{-}}\bra{\theta_{-}}, and Πj\Pi_{j} be the projection onto the other 88 eigenvectors of Wt1C1W^{t_{1}}C_{1}. Then Π±|ψ0=1δ\|\Pi_{\pm}\ket{\psi_{0}}\|=1-\delta, and |t|Πj|ψ0|Πj|ψ0=δ\left|\bra{t}\Pi_{j}\ket{\psi_{0}}\right|\leq\|\Pi_{j}\ket{\psi_{0}}\|=\delta. Therefore,

p(t2)\displaystyle p(t_{2}) |eit2θt|θ+θ+|ψ0+eit2θt|θθ|ψ0|j|t|Πj|ψ0|\displaystyle\geq\left|e^{it_{2}\theta}\braket{t}{\theta_{+}}\braket{\theta_{+}}{\psi_{0}}+e^{-it_{2}\theta}\braket{t}{\theta_{-}}\braket{\theta_{-}}{\psi_{0}}\right|-\sum_{j}\left|\bra{t}\Pi_{j}\ket{\psi_{0}}\right| (91)
|eit2θi2(1+δ)+eit2θi2(1+δ)|8δ\displaystyle\geq\left|e^{it_{2}\theta}\frac{-i}{2}(1+\delta)+e^{-it_{2}\theta}\frac{i}{2}(1+\delta)\right|-8\delta (92)
=sin(t2θ)O(δ).\displaystyle=\sin(t_{2}\theta)-O(\delta). (93)

Setting t2=π4n3r1t_{2}=\lfloor\frac{\pi}{4}\sqrt{\frac{n}{3r_{1}}}\rceil, we have p(t2)=1δp(t_{2})=1-\delta, which completes the proof. ∎

5 Discussions

In this paper, we have shown that there is a deterministic quantum algorithm for the triangle sum promised problem (i.e. the graph contains at most one target triangle) based on derandomization of a nested-quantum-walk-based algorithm by Jeffery et al. Our algorithm achieves the same O(n9/7)O(n^{9/7}) queries with the state-of-the-art bounded error quantum algorithm, utilizing several non-trivial techniques. It may be worth further considering the following problems.

  1. 1.

    Will the lower bound of Ω(n9/7/logn)\Omega(n^{9/7}/\sqrt{\log n}) remains unchanged for the triangle sum promised problem considered in this paper?

  2. 2.

    Is it still possible to design a deterministic quantum algorithm when the graph is promised to contain none or k>1k>1 target triangles?

  3. 3.

    Is it possible to derandomize the state-of-the-art O(n5/4)O(n^{5/4})-query quantum algorithm for triangle finding [29] when given an additional promise?

References

  • [1] Gary L. Miller. “Riemann’s hypothesis and tests for primality”. Journal of Computer and System Sciences 13, 300–317 (1976).
  • [2] Michael O Rabin. “Probabilistic algorithm for testing primality”. Journal of Number Theory 12, 128–138 (1980).
  • [3] R. Solovay and V. Strassen. “A fast monte-carlo test for primality”. SIAM Journal on Computing 6, 84–85 (1977).
  • [4] Romas Aleliunas, Richard M. Karp, Richard J. Lipton, Laszlo Lovasz, and Charles Rackoff. “Random walks, universal traversal sequences, and the complexity of maze problems”. In 20th Annual Symposium on Foundations of Computer Science (sfcs 1979). Pages 218–223.  (1979).
  • [5] R. M. Karp, E. Upfal, and A. Wigderson. “Constructing a perfect matching is in random nc”. Combinatorica 6, 35–48 (1986).
  • [6] Manindra Agrawal, Neeraj Kayal, and Nitin Saxena. “Primes is in p”. Annals of Mathematics 160, 781–793 (2004). url: http://www.jstor.org/stable/3597229.
  • [7] Valentine Kabanets. “Derandomization: A brief overview”. Current Trends in Theoretical Computer Science 1, 165–188 (2002).
  • [8] Russell Impagliazzo. “Can every randomized algorithm be derandomized?”. In Proceedings of the Thirty-Eighth Annual ACM Symposium on Theory of Computing. Page 373–374. STOC ’06New York, NY, USA (2006). Association for Computing Machinery.
  • [9] Zeyu Guo, Mrinal Kumar, Ramprasad Saptharishi, and Noam Solomon. “Derandomization from algebraic hardness: Treading the borders”. In 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS). Pages 147–157.  (2019).
  • [10] Lijie Chen and Roei Tell. “Simple and fast derandomization from very hard functions: Eliminating randomness at almost no cost”. In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing. Page 283–291. STOC 2021New York, NY, USA (2021). Association for Computing Machinery.
  • [11] Dean Doron and Roei Tell. “Derandomization with Minimal Memory Footprint”. In Amnon Ta-Shma, editor, 38th Computational Complexity Conference (CCC 2023). Volume 264 of Leibniz International Proceedings in Informatics (LIPIcs), pages 11:1–11:15. Dagstuhl, Germany (2023). Schloss Dagstuhl – Leibniz-Zentrum für Informatik.
  • [12] Omer Reingold. “Undirected connectivity in log-space”. J. ACM55 (2008).
  • [13] Ola Svensson and Jakub Tarnawski. “The matching problem in general graphs is in quasi-nc”. In 2017 IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS). Pages 696–707.  (2017).
  • [14] Michael Luby and Avi Wigderson. “Pairwise independence and derandomization”. Foundations and Trends in Theoretical Computer Science 1, 237–301 (2006).
  • [15] Salil P. Vadhan. “Pseudorandomness”. Foundations and Trends in Theoretical Computer Science 7, 1–336 (2012).
  • [16] Roei Tell. “Quantified derandomization: How to find water in the ocean”. Foundations and Trends in Theoretical Computer Science 15, 1–125 (2022).
  • [17] Peter W. Shor. “Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer”. SIAM Journal on Computing 26, 1484–1509 (1997).
  • [18] Lov K. Grover. “A fast quantum mechanical algorithm for database search”. In Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing. Page 212–219. STOC ’96New York, NY, USA (1996). Association for Computing Machinery.
  • [19] Ashley Montanaro. “Quantum algorithms: an overview”. npj Quantum Information 2, 15023 (2016).
  • [20] Gilles Brassard, Peter Hoyer, Michele Mosca, and Alain Tapp. “Quantum amplitude amplification and estimation”. Contemporary Mathematics 305, 53–74 (2002). url: arxiv.org/abs/quant-ph/0005055.
  • [21] Peter Hoyer. “On arbitrary phases in quantum amplitude amplification”. Physical Review A62 (2000).
  • [22] G. L. Long. “Grover algorithm with zero theoretical failure rate”. Phys. Rev. A 64, 022307 (2001).
  • [23] Tanay Roy, Liang Jiang, and David I. Schuster. “Deterministic grover search with a restricted oracle”. Phys. Rev. Res. 4, L022013 (2022).
  • [24] Guanzhong Li and Lvzhou Li. “Deterministic quantum search with adjustable parameters: Implementations and applications”. Information and Computation 292, 105042 (2023).
  • [25] G. Brassard and P. Hoyer. “An exact quantum polynomial-time algorithm for simon’s problem”. In Proceedings of the Fifth Israeli Symposium on Theory of Computing and Systems. Pages 12–23.  (1997).
  • [26] Zekun Ye, Yunqi Huang, Lvzhou Li, and Yuyi Wang. “Query complexity of generalized simon’s problem”. Information and Computation 281, 104790 (2021).
  • [27] Guanzhong Li and Lvzhou Li. “Optimal exact quantum algorithm for the promised element distinctness problem” (2022). arXiv:2211.05443.
  • [28] Guanzhong Li, Jingquan Luo, and Lvzhou Li. “Recover the original simplicity: concise and deterministic quantum algorithm for the welded tree problem” (2023). arXiv:2304.08395.
  • [29] Titouan Carette, Mathieu Lauriere, and Frederic Magniez. “Extended Learning Graphs for Triangle Finding”. In Heribert Vollmer and Brigitte Vallee, editors, 34th Symposium on Theoretical Aspects of Computer Science (STACS 2017). Volume 66 of Leibniz International Proceedings in Informatics (LIPIcs), pages 20:1–20:14. Dagstuhl, Germany (2017). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
  • [30] Harry Buhrman, Christoph Dürr, Mark Heiligman, Peter Høyer, Frédéric Magniez, Miklos Santha, and Ronald de Wolf. “Quantum algorithms for element distinctness”. SIAM Journal on Computing 34, 1324–1330 (2005).
  • [31] Mario Szegedy. “On the quantum query complexity of detecting triangles in graphs” (2003). arXiv:quant-ph/0310107.
  • [32] Frédéric Magniez, Miklos Santha, and Mario Szegedy. “Quantum algorithms for the triangle problem”. SIAM J. Comput. 37, 413–424 (2007).
  • [33] Andris Ambainis. “Quantum walk algorithm for element distinctness”. SIAM J. Comput. 37, 210–239 (2007).
  • [34] Aleksandrs Belovs. “Span programs for functions with constant-sized 1-certificates: Extended abstract”. In Proceedings of the Forty-Fourth Annual ACM Symposium on Theory of Computing. Page 77–84. STOC ’12New York, NY, USA (2012). Association for Computing Machinery.
  • [35] Troy Lee, Frédéric Magniez, and Miklos Santha. “Improved quantum query algorithms for triangle finding and associativity testing”. In Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms. Page 1486–1502. SODA ’13USA (2013). Society for Industrial and Applied Mathematics. url: dl.acm.org/doi/10.5555/2627817.2627924.
  • [36] Francois Le Gall. “Improved quantum algorithm for triangle finding via combinatorial arguments”. In 2014 IEEE 55th Annual Symposium on Foundations of Computer Science. Pages 216–225.  (2014).
  • [37] Stacey Jeffery and Peter Richter. “Quantum algorithm for finding triangles”. Pages 1–6. Springer Berlin Heidelberg. Berlin, Heidelberg (2014).
  • [38] Aleksandrs Belovs and Ansis Rosmanis. “On the power of non-adaptive learning graphs”. In 2013 IEEE Conference on Computational Complexity. Pages 44–55.  (2013).
  • [39] Stacey Jeffery, Robin Kothari, and Frédéric Magniez. “Nested quantum walks with quantum data structures”. In Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms. Page 1474–1485. SODA ’13USA (2013). Society for Industrial and Applied Mathematics.
  • [40] Frederic Magniez, Ashwin Nayak, Jeremie Roland, and Miklos Santha. “Search via quantum walk”. In Proceedings of the Thirty-Ninth Annual ACM Symposium on Theory of Computing. Page 575–584. STOC ’07New York, NY, USA (2007). Association for Computing Machinery.
  • [41] Aleksandrs Belovs and Robert Spalek. “Adversary lower bound for the k-sum problem” (2012). arXiv:1206.6528.
  • [42] Andrew M Childs and Jason M Eisenberg. “Quantum algorithms for subset finding”. Quantum Information & Computation 5, 593–604 (2005). url: dl.acm.org/doi/abs/10.5555/2011656.2011663.