Skip to main content
Log in

Graph comparison via nonlinear quantum search

  • Published:
Quantum Information Processing Aims and scope Submit manuscript

Abstract

Graph comparison is an established NP-hard problem. In this paper, we present an efficiently scaling quantum algorithm which finds the size of the maximum common edge subgraph for any pair of unlabelled graphs and thus provides a meaningful measure of graph similarity. The algorithm makes use of a two-part quantum dynamic process: in the first part, we obtain information crucial for the comparison of two graphs through linear quantum computation. However, this information is hidden in the quantum system with such a vanishingly small amplitude that even quantum algorithms such as Grover’s search are not fast enough to distil it efficiently. In order to extract the information, we call upon techniques in nonlinear quantum computing to provide the speed-up necessary for an efficient algorithm. The linear quantum circuit requires \(\mathcal {O}(n^3 \log ^3 (n) \log \log (n))\) elementary quantum gates, and the nonlinear evolution under the Gross–Pitaevskii equation has a time scaling of \(\mathcal {O}(\frac{1}{g} n^2 \log ^3 (n) \log \log (n))\), where n is the number of vertices in each graph and g is the strength of the Gross–Pitaevskii nonlinearity. Through this example, we demonstrate the power of nonlinear quantum search techniques to solve a subset of NP-hard problems.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7

Similar content being viewed by others

References

  1. Koutra, D., Vogelstein, J.T., Faloutsos, C.: DELTACON: A Principled Massive-Graph Similarity Function. ArXiv e-prints (2013)

  2. Baláž, V., Koča, J., Kvasnička, V., Sekanina, M.: A metric for graphs. Časopis pro pěstování matematiky 111(4), 431–433 (1986)

    MathSciNet  MATH  Google Scholar 

  3. Umeyama, S.: An eigendecomposition approach to weighted graph matching problems. IEEE Trans. Pattern Anal. Mach. Intell. 10(5), 695–703 (1988)

    Article  MATH  Google Scholar 

  4. Jiang, T., Wang, L., Zhang, K.: Alignment of trees—an alternative to tree edit. Theor. Comput. Sci. 143(1), 137–148 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  5. Dehmer, M., Emmert-Streib, F., Kilian, J.: A similarity measure for graphs with low computational complexity. Appl. Math. Comput. 182(1), 447–459 (2006)

    MathSciNet  MATH  Google Scholar 

  6. Rossi, R., Torsello, A., Hancock, E.R.: Measuring graph similarity through continuous-time quantum walks and the quantum Jensen–Shannon divergence. Phys. Rev. E 91(2), 2 (2015)

    Article  MathSciNet  Google Scholar 

  7. Abrams, D.S., Lloyd, S.: Nonlinear quantum mechanics implies polynomial-time solution for np-complete and# p problems. Phys. Rev. Lett. 81(18), 3992 (1998)

    Article  ADS  Google Scholar 

  8. Childs, A.M., Young, J.: Optimal state discrimination and unstructured search in nonlinear quantum mechanics. Phys. Rev. A 93(2), 022314 (2016)

    Article  ADS  Google Scholar 

  9. Bokhari, S.H.: On the mapping problem. IEEE Trans. Comput. 30(3), 207–214 (1981)

    Article  MathSciNet  Google Scholar 

  10. Bahiense, L., Manić, G., Piva, B., De Souza, C.C.: The maximum common edge subgraph problem: a polyhedral investigation. Discrete Appl. Math. 160(18), 2523–2541 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  11. Sanfeliu, A., King-Sun, F.: A distance measure between attributed relational graphs for pattern recognition. IEEE Trans. Syst. Man. Cybern. 3, 353–362 (1983)

    Article  MATH  Google Scholar 

  12. Durr, C., Hoyer, P.: A quantum algorithm for finding the minimum. arXiv preprint arXiv:quant-ph/9607014 (1996)

  13. Baritompa, W.P., Bulger, D.W., Wood, G.R.: Grover’s quantum algorithm applied to global optimization. SIAM J. Optim. 15(4), 1170–1184 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  14. Abrams, D.S., Lloyd, S.: Simulation of many-body fermi systems on a universal quantum computer. Phys. Rev. Lett. 79, 2586–2589 (1997)

    Article  ADS  Google Scholar 

  15. Sedgewick, R.: Permutation generation methods. ACM Comput. Surv. 9(2), 137–164 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  16. Brassard, G., Hoyer, P., Mosca, M., Tapp, A.: Quantum Amplitude Amplification and Estimation. eprint arXiv:quant-ph/0005055 (2000)

  17. Cleve, R., Ekert, A., Macchiavello, C., Mosca, M.: Quantum algorithms revisited. Proc. R. Soc. Lond. A Math. Phys. Eng. Sci. 454, 339–354 (1998)

    Article  MathSciNet  MATH  Google Scholar 

  18. Lee, C.M., Selby, J.H.: Generalised phase kick-back: the structure of computational algorithms from physical principles. New J. Phys. 18(3), 033023 (2016)

    Article  ADS  Google Scholar 

  19. Barenco, A., Bennett, C.H., Cleve, R., et al.: Elementary gates for quantum computation. Phys. Rev. A 52(5), 3457 (1995)

    Article  ADS  Google Scholar 

  20. Berry, D.W., Kieferová, M., Scherer, A., Sanders, Y.R., Guang, H.L., Wiebe, N., Gidney, C., Babbush, R.: Improved techniques for preparing eigenstates of fermionic hamiltonians. NPJ Quantum Inf 4, 1–7 (2018)

    Article  Google Scholar 

  21. Vedral, V., Barenco, A., Ekert, A.: Quantum networks for elementary arithmetic operations. Phys. Rev. A 54, 147–153 (1996)

    Article  ADS  MathSciNet  Google Scholar 

  22. Meyer, D.A., Wong, T.G.: Nonlinear quantum search using the Gross–Pitaevskii equation. New J. Phys. 15(6), 063014 (2013)

    Article  ADS  MathSciNet  Google Scholar 

  23. Meyer, D.A., Wong, T.G.: Quantum search with general nonlinearities. Phys. Rev. A 89(1), 012312 (2014)

    Article  ADS  Google Scholar 

  24. Kahou, M.E., Feder, D.L.: Quantum search with interacting Bose–Einstein condensates. Phys. Rev. A 88(3), 032310 (2013)

    Article  ADS  Google Scholar 

  25. de Lacy, K., Noakes, L.: Controlled Quantum Search. ArXiv e-prints (2017)

  26. Maeda, M., Sasaki, H., Segawa, E., Suzuki, A., Suzuki, K.: Scattering and inverse scattering for nonlinear quantum walks. ArXiv e-prints (2018)

  27. Maeda, M., Sasaki, H., Segawa, E., Suzuki, A., Suzuki, K.: Weak limit theorem for a nonlinear quantum walk. Quantum Inf. Process. 17, 215 (2018)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  28. Maeda, M., Sasaki, H., Segawa, E., Suzuki, A., Suzuki, K.: On nonlinear scattering for quantum walks. ArXiv e-prints (2017)

  29. Alberti, A., Wimberger, S.: Quantum walk of a Bose–Einstein condensate in the Brillouin zone. Phys. Rev. A 96(2), 023620 (2017)

    Article  ADS  Google Scholar 

  30. Lucas, A.: Ising formulations of many NP problems. Front. Phys. 2, 5 (2014)

    Article  Google Scholar 

Download references

Acknowledgements

We thank Jason Twamley and Lyle Noakes for valuable comments and discussions.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to J. B. Wang.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Appendix A: Proofs

Proof of Theorem 1

Theorem

For any n and any \(1 \le s \le n!\), we can find a value k such that the \(\lfloor ks \rfloor \)the candidate state is suitable for zooming. Specifically,

  1. (a)

    For \(1 \le n \le 5\), we can determine candidate states suitable for zooming on a case-by-case basis.

  2. (b)

    For \(n \ge 5\) and \(2 \le s \le n!\), the \(\lfloor s/2 \rfloor \)th candidate state is always suitable for zooming.

Proof

Consider the candidate state number as a continuous variable. That is, define the sth candidate state to be the point along the candidate state arc which has inner product with the 0th candidate state equal to

$$\begin{aligned}\frac{1-(s/n!)}{\sqrt{1-2(s/n!)+2(s/n!)^2}},\end{aligned}$$

even if s is not an integer.

Lower bound. Consider the candidate states immediately prior to nonlinear evolution, at time \(t=0\) (refer to the left diagram in Fig. 7). Immediately after production by the circuit in Fig. 5, the inner product of the 0th and sth candidate states is

$$\begin{aligned} \cos \bigg (\frac{\alpha _0}{2}\bigg )= \frac{1-(s/n!)}{\sqrt{1-2(s/n!)+2(s/n!)^2}}. \end{aligned}$$
(A1)

Similarly, the inner product of the 0th and (ks)th candidate states is

$$\begin{aligned} \cos \bigg (\frac{\theta _0}{2}\bigg )=\frac{1-(ks/n!)}{\sqrt{1-2(ks/n!)+2(ks/n!)^2}}\, . \end{aligned}$$
(A2)

Define \(\mu _0/2\) to be the angle subtended by the ksth candidate state and its projection when reflected about the midpoint of the arc between the 0th and sth candidate states. Via simple trigonometry, we have

$$\begin{aligned} \cos \bigg (\frac{\mu _0}{2}\bigg )&=\cos (\alpha _0/2-\theta _0) = \cos \bigg (\frac{\alpha _0}{2}\bigg )\cos (\theta _0) + \sin \bigg (\frac{\alpha _0}{2}\bigg )\sin (\theta _0). \end{aligned}$$
(A3)

Due to the orientation of the candidate state arc imposed in Fig. 6, candidate states will move to opposite poles of the Bloch sphere depending on whether they are closer to the 0th candidate state or the sth. All angles and figures defined in this section thus far have intuitively assumed that the (ks)th candidate state is closer to the 0th candidate state than the sth. With the assistance of Lemma 2, we have found and imposed the upper limit of 1 / 2 on k in order to ensure the consistency of all figures and angles in this section.

Lemma 2

If \(k \le 1/2\), then the (ks)th candidate state is closer to the 0th candidate state than the sth for all \(1 \le s \le n!\).

Proof

The (ks)th candidate state is closer to the 0th candidate state than the sth—so it subtends an angle of at most \(\alpha _0/4\) with the 0th candidate state. The inner product with the 0th candidate state of such a point is

$$\begin{aligned} \cos \bigg (\frac{\alpha _0}{4}\bigg )&= \sqrt{\frac{1}{2}\bigg (1+\frac{1-(s/n!)}{\sqrt{1-2(s/n)+2(s/n!)^2}}}\bigg )\, . \end{aligned}$$

The candidate state having this inner product, the \(s'\)th, is such that

$$\begin{aligned} \frac{1-(s'/n!)}{\sqrt{1-2(s'/n!)+2(s'/n!)^2}}&= \sqrt{\frac{1}{2}\bigg (1+\frac{1-(s/n!)}{\sqrt{1-2(s/n)+2(s/n!)^2}}}\bigg )\,, \end{aligned}$$

giving

$$\begin{aligned} \frac{s'}{n!}&= \frac{1}{1+\sqrt{1-2(s/n!)+2(s/n!)^2}} \frac{s}{n!} \\&\ge \frac{s/2}{n!}. \end{aligned}$$

Therefore, the (ks)th candidate state is guaranteed to be closer to the 0th candidate state than the sth as long as \(k \le 1/2\). \(\square \)

Lemma 2 also tells us that \(\cos (\theta (T(s/n!))/2) \ge 1/\sqrt{2}\) as long as \(k \le 1/2\), because the minimum possible value of \(\cos (\alpha _0/2)\) is \(1/\sqrt{2}\) (and the angle cannot increase throughout the evolution). For this result to be meaningful, we must restore the status of s as a discrete variable. In Measurements 1 and 2, we take the \(\lfloor ks \rfloor \)th candidate state. In doing so, we pick either the (ks)th or \((ks-1)\)th candidate state. In the latter case, we are effectively using \(\tilde{k}=k-\frac{1}{s}\) as our k value, which is less than 1 / 2 and so our result still holds.

Upper bound. Aside: First, let us make it abundantly clear that the position of the (ks)th candidate after nonlinear evolution for time T(s / n!) discussed throughout this section (and in all figures referring to the position of the (ks)th candidate state after time T(s / n!)) is not the actual position of the (ks)th candidate state, but an approximation. The true position of the (ks)th candidate state after nonlinear evolution for time T(s / n!) is some distance away from the arc connecting the 0th and sth candidate states, as the evolution distorts the arc from its initial shape (see Fig. 8). This displacement need not cause concern, as we are in pursuit of an upper bound for \(\cos (\theta (T(s/n!))/2)\), not a lower bound. This aside and Fig. 8 justify this statement and are the only parts of the proof that make reference to this true position of the (ks)th candidate state.

Consider the assortment of candidate states after nonlinear evolution for time T(s / n!). Recall that the nonlinear evolution is corrected by a linear amount (see Eq. 30) such that only the endpoints (and midpoint) of S remain along the extension of the arc S. The orientation of S was such that along this arc, points separate more quickly than if they were aligned along any other arc of the Bloch sphere (see Fig. 6). Therefore, any non-endpoint, non-midpoint candidate state will leave this arc and drag behind it as the 0th and sth candidate states are separated. After nonlinear evolution for time T(s / n!) as per Procedure B, this leads to the distortion as displayed in the dark curve in Fig. 8.

Fig. 8
figure 8

Left: prior to nonlinear evolution. Right: after nonlinear evolution for time T(s / n!). The actual candidate states progress towards opposite poles more slowly than their approximate counterparts. This means that the (ks)th candidate state is further from the 0th than the approximate (ks)th candidate state for all \(k \le 1/2\). The position of the approximate (ks)th candidate state is where the (ks)th candidate state would end up after nonlinear evolution for time T(s / n!) if we were to run the nonlinear evolution of Procedure B for an arc with endpoints initially subtending an angle of \(\mu (t)\) (grey line), rather than \(\alpha (t)\) (black line)

There is a subarc of S with the (ks)th candidate state as one endpoint and the other chosen symmetrically about the midpoint of S. Let the angle subtended by its endpoints in Hilbert space be \(\mu (t)\), and let \(\mu _0 =\mu (0)\). Consider the result if we performed Procedure B upon this subarc instead of S, but maintained the nonlinear evolution time of T(s / n!). In this instance, Eq. (28) would become

$$\begin{aligned} \cos \left( \frac{\mu (t)}{2}\right) = \frac{\cos \frac{\mu _0}{2} \cosh \frac{gt}{2} - \sinh \frac{gt}{2}}{\cosh \frac{gt}{2} - \cos \frac{\mu _0}{2} \sinh \frac{gt}{2}}. \end{aligned}$$
(A4)

and the nonlinear evolution, previously Eq. (30), would instead be

$$\begin{aligned} H(t) = \frac{g}{4} \cos \left( \frac{\mu (t)}{2}\right) \sigma _x . \end{aligned}$$
(A5)

The nonlinear evolution time of T(s / n!), however, is not long enough to force the endpoints of this smaller arc all the way to opposite poles of the Bloch sphere. Recalling that \(T(s/n!) = 2\ln (\cot (\alpha _0/4))/g\), we have

$$\begin{aligned} \cos \bigg ( \frac{\mu (T(s/n!))}{2} \bigg )&= \frac{\cos (\mu _0/2) - \cos (\alpha _0/2)}{1-\cos (\mu _0/2) \cos (\alpha _0/2)}. \end{aligned}$$
(A6)

In this hypothetical scenario, at the end of nonlinear evolution, this “approximate” (ks)th candidate state would necessarily lie closer to \(|0\rangle \) than the actual (ks)th candidate state does—so the angle \(\mu (T(s/n!))/2\) is greater than the angle subtended by the true (ks)th state and its symmetric point after nonlinear evolution for time T(s / n!). Again, this works in our favour for proving Theorem 1. End aside.

Consider the assortment of candidate states after nonlinear evolution for time T(s / n!). We orient this curve with the measurement basis \(\{|0\rangle ,|1\rangle \}\) by aligning the 0th and sth candidate states with \(|0\rangle \) and \(|1\rangle \), respectively. The curve is no longer an arc after nonlinear evolution, but for our purposes—namely, the impending measurement of the qubit—we need only consider the components of the candidate states in the \(|0\rangle \) and \(|1\rangle \) directions. The candidate state curve is then a quarter circle when projected onto the measurement basis, as visualised in the right diagram in Fig. 7. Via simple trigonometry, we have

$$\begin{aligned} \cos \bigg ( \frac{\theta (T(s/n!))}{2}\bigg )&= \cos \bigg (\frac{\pi }{4} - \frac{\mu (T(s/n!))}{4}\bigg ) \end{aligned}$$
(A7)
$$\begin{aligned}&= \frac{1}{2}\bigg (\sqrt{1+\cos (\mu (T(s/n!))/2)} + \sqrt{1- \cos (\mu (T(s/n!))/2)}\bigg ), \end{aligned}$$
(A8)

which is a decreasing function of \(\cos (\mu (T(s/n!))/2)\). Recall Eq. (A6):

$$\begin{aligned} \cos \left( \frac{\mu (T(s/n!))}{2}\right)&= \frac{\cos (\mu _0/2) - \cos (\alpha _0/2)}{1-\cos (\mu _0/2) \cos (\alpha _0/2)} \end{aligned}$$
(A9)
$$\begin{aligned}&= \frac{(\cos (\alpha _0/2)\cos (\theta _0)+\sin (\alpha _0/2)\sin (\theta _0))-\cos (\alpha _0/2)}{1-(\cos (\alpha _0/2)\cos (\theta _0)+\sin (\alpha _0/2)\sin (\alpha _0/2))\cos (\alpha _0/2)}\, , \end{aligned}$$
(A10)

which, using Eqs. (A1) and (A3) and basic trigonometry,

$$\begin{aligned} = \frac{\left( \frac{1-s/n!}{\sqrt{1-2s/n!+2(s/n!)^2}} \left( 2\frac{(1-ks/n!)^2}{1-2ks/n!+2(ks/n!)^2}-1\right) +\frac{s/n!}{\sqrt{1-2s/n!+2(s/n!)}}\left( \frac{2ks/n!(1-ks/n!)}{1-2ks/n!+2(ks/n!)^2}\right) \right) -\frac{1-s/n!}{\sqrt{1-2s/n!+2(s/n!)^2}}}{1-\left( \frac{1-s/n!}{\sqrt{1-2s/n!+2(s/n!)^2}} \left( 2\frac{(1-ks/n!)^2}{1-2ks/n!+2(ks/n!)^2}-1\right) +\frac{s/n!}{\sqrt{1-2s/n!+2(s/n!)}}\left( \frac{2ks/n!(1-ks/n!)}{1-2ks/n!+2(ks/n!)^2}\right) \right) \frac{1-s/n!}{\sqrt{1-2s/n!+2(s/n!)^2}}}\, .\nonumber \\ \end{aligned}$$
(A11)

Note that, for \(k=1/2\), this has a minimum of \(2\sqrt{2}/3\) at \(s=n!/2\). We substitute Eqs. (A11) into (A8) to obtain a large expression for \(\cos (\theta (T(s/n!))/2)\). At this stage, it is convenient to restore the status of s as a discrete variable by replacing ks with \(\lfloor s/2\rfloor \). Figure 9 shows the values of \(\cos (\theta (T(s/n!))/2)\) with \(1 \le s \le n!\) for graphs of size \(n=3,4,5\) and 6, alternating between smooth functions which serve as upper and lower bounds:

$$\begin{aligned}&\cos \left( \frac{\theta (T(s/n!))}{2}\right) \bigg \vert _{\lfloor s/2\rfloor \longleftrightarrow s/2} \le \cos \left( \frac{\theta (T(s/n!))}{2}\right) \\&\quad \le \cos \left( \frac{\theta (T(s/n!))}{2}\right) \bigg \vert _{\lfloor s/2\rfloor \longleftrightarrow (s-1)/2}. \end{aligned}$$
Fig. 9
figure 9

The data points are values of \(\cos (\theta (T(s/n!))/2)\) for \(1\le s \le n!\). The red curve is the upper bound, obtained when we replace \(\lfloor s/2 \rfloor \) with \((s-1)/2\) in \(\cos (\theta (T(s/n!))/2)\). Likewise, the blue curve is the lower bound we obtain by replacing \(\lfloor s/2 \rfloor \) with s / 2. For \(n \ge 5\), we can safely assume that \(\cos (\theta (T(s/n!))/2) \le \sqrt{2/3} + \epsilon _n\) in the region \(s>7\), where \(\epsilon _n\) is a vanishingly small quantity corresponding to the maximum of the blue curve (Color figure online)

Inspired by Fig. 9, we consider only graphs with five or more vertices and show that \(\cos (\theta (T(s/n!))/2)\) is always less than \(\sqrt{2/3}+\epsilon \) (for a known quantity \(\epsilon \)) when \(7 \le s \le n! \). When s is even, \(\cos (\theta (T(s/n!))/2)\) appears on the lower bound function (blue curve) in Fig. 9, which has a maximum of \(\sqrt{2/3}\) (using the fact that \(\cos (\mu (T(s/n!))/2)\) from Eq. (A11) has a minimum of \(2\sqrt{2}/3\) at \(s=n!/2\) when \(k=1/2\)). Therefore, for all even s,

$$\begin{aligned} \cos \left( \frac{\theta (T(s/n!))}{2}\right) \le \sqrt{\frac{2}{3}}\, , \end{aligned}$$

and so we have shown that the \(\lfloor s/2 \rfloor \)th candidate state is suitable for zooming (via Definition 1) when s is even.

When s is odd, take the expression for \(\cos (\theta (T(s/n!))/2)\) for fixed values of s and varying values of n to observe that

$$\begin{aligned} \cos \left( \frac{\theta (T(1/n!))}{2}\right)&= 1, \nonumber \\ \frac{2}{\sqrt{5}} < \cos \left( \frac{\theta (T(3/n!))}{2}\right)&\le \frac{2 \sqrt{2}}{3}, \end{aligned}$$
(A12)
$$\begin{aligned} \frac{3}{\sqrt{13}} < \cos \left( \frac{\theta (T(5/n!))}{2}\right)&\le \frac{18 \sqrt{2}}{29}, \end{aligned}$$
(A13)

and that, for \(n \ge 5\),

$$\begin{aligned} \frac{4}{5}< \cos \left( \frac{\theta (T(7/n!))}{2}\right)&< \sqrt{\frac{2}{3}}. \end{aligned}$$
(A14)

As s is odd, \(\cos (\theta (T(s/n!))/2)\) lands on the upper bound function (red curve in Fig. 9). For \(n \ge 5\), the upper bound function has a maximum value, slightly above \(\sqrt{2/3}\), occurring somewhere between \(s = n!/2-1\) and \(s=n!/2-2\). Equation (A14) assures us that the value of \(\cos (\theta (T(s/n!))/2)\) is less than whatever this maximum is, as long as \(s \ge 7\). We evaluate \(\cos (\theta (T(s/n!))/2)\) at \(s=n!/2-2\) to approximate the maximum as

$$\begin{aligned} \frac{1}{2}&\left( \sqrt{\frac{\left( 2 \sqrt{\frac{32}{(n!)^2}+2}+3\right) (n!)^4-4 \left( 4 \sqrt{\frac{32}{(n!)^2}+2}+5\right) (n!)^3+12 \left( 2 \sqrt{\frac{32}{(n!)^2}+2}+5\right) (n!)^2-192 n!+576}{n! (n! (n! (3 n!-20)+60)-192)+576^{\phantom {\frac{.}{1}}}}}\right. \nonumber \\&\quad +\left. \sqrt{\frac{\left( 3-2 \sqrt{\frac{32}{(n!)^2}+2}\right) (n!)^4+4 \left( 4 \sqrt{\frac{32}{(n!)^2}+2}-5\right) (n!)^3+12 \left( 5-2 \sqrt{\frac{32}{(n!)^2}+2}\right) (n!)^2-192 n!+576}{n! (n! (n! (3 n!-20)+60)-192)+576^{\phantom {\frac{.}{1}}}}}\right) \, .\nonumber \\ \end{aligned}$$
(A15)

For the first two values of n for which this maximum exists, we obtain

$$\begin{aligned}&n=5: \quad&\cos \left( \frac{\theta (T(s/n!))}{2}\right) \le \sqrt{\frac{2}{3}} + \underbrace{0.00907762\dots }_{\epsilon _5}\\&n=6: \quad&\cos \left( \frac{\theta (T(s/n!))}{2}\right) \le \sqrt{\frac{2}{3}} + \underbrace{0.00151206\dots }_{\epsilon _6}. \end{aligned}$$

We can calculate \(\epsilon _n\) for any graph size n by calculating the difference between (A15) and \(\sqrt{2/3}\). However, as seen in Fig. 10, \(\epsilon _n\) is a decreasing function of n and so, for any \(n \ge 5\), it suffices to use \(\sqrt{2/3}+ \epsilon _5\) as an upper bound for \(cos(\theta (T(s/n!))/2)\).

Fig. 10
figure 10

When s is odd, the maximum value of \(\cos (\theta (T(s/n!))/2)\) approaches \(\sqrt{2/3}\) as n increases

Therefore, we have shown that for \(n \ge 5\) and odd \(s \ge 7\) that the \(\lfloor s/2 \rfloor \)th candidate state is suitable for zooming (via Definition 1). The results in Eqs. (A12) and (A13) show that for \(s=3\) and \(s=5\), the \(\lfloor s/2 \rfloor \)th candidate state is also suitable for zooming. This completes the proof of part (b) of Theorem 1. Part (a) of Theorem 1 is trivial: as there are only 153 pairs (sn) for \(n \le 4\), all different values of \(\cos (\theta (T(s/n!))/2)\) will not draw arbitrarily close to 1. We can draw from a list of these 153 different values to determine which candidate states are suitable for zooming on a case-by-case basis.

To summarise, for \( n \ge 5\), we have

$$\begin{aligned}&s = 1,&\quad \cos (\theta (T(s/n!))/2) = 1&\quad \\&s = 2,&\quad 1/\sqrt{2}< \cos (\theta (T(s/n!))/2)< \sqrt{2/3}&\approx 0.82 \quad \\&s = 3,&\quad 1/\sqrt{2}< \cos (\theta (T(s/n!))/2) \le 2\sqrt{2}/2&\approx 0.94 \quad \\&s = 4,&\quad 1/\sqrt{2}< \cos (\theta (T(s/n!))/2) \le \sqrt{2/3} \quad \\&s = 5,&\quad 1/\sqrt{2}< \cos (\theta (T(s/n!))/2) \le 18\sqrt{2}/29&\approx 0.88\quad \\&s = 6,&\quad 1/\sqrt{2}< \cos (\theta (T(s/n!))/2) \le \sqrt{2/3}\\&s \ge 7,&\quad 1/\sqrt{2} < \cos (\theta (T(s/n!))/2) \le \sqrt{2/3} + \epsilon _5&\approx 0.83.\\ \end{aligned}$$

\(\square \)

Proof of Lemma 1

Proof

Using Eqs. (27) and (29), we have

$$\begin{aligned} T(s/n!)&=\frac{2}{g} \log \left( \cot \left( \frac{1}{2}\arccos \left( \frac{1-s/n!}{1-2s/n!+2(s/n!)^2}\right) \right) \right) . \end{aligned}$$

Treating s / n! as a continuous variable, we can take the Taylor series of T(s / n!) about 0 to give us an expression which is strictly less than or equal to T(s / n!):

$$\begin{aligned} T(s/n!)\,\le&\,\frac{2}{g} \left( \log \frac{2}{s/n!} - s/n! - \frac{(s/n!)^2}{4} + \frac{(s/n!)^3}{6}\right. \\&\left. +\,\frac{13(s/n!)^4}{32} + \frac{17(s/n!)^5}{40} + \mathcal {O}(s/n!)^6 \right) \end{aligned}$$

By taking the series to the fifth order in s / n!, the above inequality holds. Then,

$$\begin{aligned}&\sum _{i=0}^{\lfloor \log _2 s\rfloor } T(\lfloor s/2^i\rfloor ) \le \, \frac{2}{g}\sum _{i=0}^{\log _2 s} \left( \log \frac{2}{s/n!} - s/n! - \frac{(s/n!)^2}{4} + \frac{(s/n!)^3}{6}\right. \\&\qquad \left. +\,\frac{13(s/n!)^4}{32} + \frac{17(s/n!)^5}{40} + \mathcal {O}(s/n!)^6 \right) \\&\quad <\, \frac{2}{g}\left( \underbrace{\log \left( \frac{2s}{(s/(n!)^{\log 2})^{\log _2 2s}}\right) }_{O(\mathrm {poly}(n))} + \underbrace{\frac{68(s/n!)^5}{155}+\frac{13(s/n!)^4}{30}+\frac{4(s/n!)^3}{21}}_{\ll 1}\right) \\&\quad \approx \, \frac{2}{g} \log (2s)\left( \log _2\frac{n!}{\sqrt{s}}+1\right) , \end{aligned}$$

discarding the infinitesimal polynomial terms. \(\square \)

Comment on Theorem 2: suitable choices for the ensemble size \(\omega \)

Recall the proof of Theorem 2. Procedure A has the highest chance of failure when \(s=3\), as shown in Appendix 2.. During the course of an entire run-through of Algorithm 2, the iterations of Procedure B when \(s = 3\) are infrequent enough that we will neglect their slight lowering of the success probability of Algorithm 2, and instead estimate the overall probability of success as

$$\begin{aligned} P(\text {Algorithm~2 does not fail}) \approx \left( 1 - \left( \sqrt{2/3}+\epsilon _n\right) ^{2\omega } \right) ^{\log _2(E_{\max })}. \end{aligned}$$

Using this definition, we observe the pattern shown in Fig. 11. Most notably, the probability of Algorithm 2 performing successfully is greater than 1 / 2 for \(\omega \ge 10 \log (\log (n))\).

Fig. 11
figure 11

\(\omega = 10(\log (\log (n))\) is a suitable choice for \(n \ge 5\) to ensure that our overall quantum algorithm succeeds with a decent chance

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Chiew, M., de Lacy, K., Yu, C.H. et al. Graph comparison via nonlinear quantum search. Quantum Inf Process 18, 302 (2019). https://doi.org/10.1007/s11128-019-2407-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11128-019-2407-2

Keywords

Navigation