# Upperbounds on the probability of finding marked connected components using quantum walks

Finding a marked vertex in a graph can be a complicated task when using quantum walks. Recent results show that for two or more adjacent marked vertices search by quantum walk with Grover's coin may have no speed-up over classical exhaustive search. In this paper, we analyze the probability of finding a marked vertex and prove several upper bounds for various sets of marked vertices. All upper bounds are given in explicit form.

• 7 publications
• 2 publications
• 1 publication
• 20 publications
03/18/2019

### Quadratic speedup for finding marked vertices by quantum walks

A quantum walk algorithm can detect the presence of a marked vertex on a...
09/28/2022

### Quantum Subroutine Composition

An important tool in algorithm design is the ability to build algorithms...
11/14/2017

### Improved quantum backtracking algorithms through effective resistance estimates

We investigate quantum backtracking algorithms of a type previously intr...
11/16/2021

### The Lovász Local Lemma is Not About Probability

Given a collection of independent events each of which has strictly posi...
01/30/2022

### Spatial search with multiple marked vertices is optimal for almost all queries and its quantum advantage is not always guaranteed

We contribute to fulfil the long-lasting gap in the understanding of the...
01/31/2018

### A Continuous - Time Quantum Walk for Attributed Graphs Matching

Diverse facets Of the Theory of Quantum Walks on Graph are reviewed Till...
11/22/2020

### Algorithmic upper bounds for graph geodetic number

Graph theoretical problems based on shortest paths are at the core of re...

## 1 Introduction

Quantum walks are quantum counterparts of classical random walks [1]. Similarly to classical random walks, there are two types of quantum walks: discrete-time quantum walks (DTQW), introduced by Aharonov et al. [2], and continuous-time quantum walks (CTQW), introduced by Farhi et al. [3]. For the discrete-time version, the step of the quantum walk is usually given by two operators – coin and shift – which are applied repeatedly. The coin operator acts on the internal state of the walker and rearranges the amplitudes of going to adjacent vertices. The shift operator moves the walker between the adjacent vertices.

Quantum walks have been useful for designing algorithms for a variety of search problems [4]. To solve a search problem using quantum walks, we introduce the notion of marked elements (vertices), corresponding to elements of the search space that we want to find. We perform a quantum walk on the search space with one transition rule at the unmarked vertices, and another transition rule at the marked vertices. If this process is set up properly, it leads to a quantum state in which the marked vertices have higher probability to be found than the unmarked ones. This method of search using quantum walks was first introduced in [5] and has been used many times since then.

In contrary to classical random walks, the behavior of the quantum walk can drastically change if the search space contains more than one marked element. In 2008 Ambainis and Rivosh [6] have studied DTQW on two-dimensional grid and showed that if the diagonal of the grid is fully marked then the probability of finding a marked element does not grow over time. Later, in 2015 Wong and Ambainis [7] have analysed DTQW on the simplex of complete graphs and showed that if one of the complete graphs is fully marked then there is no speed-up over classical exhaustive search. In both cases the configuration consists of marked vertices. The same year Nahimovs and Rivosh [8, 9] have studied DTQW on two-dimensional grid for various placements of multiple marked vertices and demonstrated configurations of a constant number of marked vertices (naming them exceptional configurations) for which the walk have no speed-up over classical exhaustive search. Later, Nahimovs and Santos [10] have extended the results to general graphs.

The reason why some configuration are exceptional is that for such configurations the initial state of the algorithm is close to a 1-eigenvector of a step of the walk algorithm. Therefore, the probability of finding a marked vertex stays close to the initial probability and does not grow over time. Nahimovs, Khadiev and Santos

[11] analysed the search for a set of connected marked vertices forming an exceptional configuration and proved the upper bound on the probability of finding a marked vertex. The proved bound, however, depends on a parameter – a sum of squares of amplitudes of edges between the marked vertices inside the stationary state – which was left unestimated.

In this paper we continue the analysis and prove the upper bound in explicit form, which depends properties of the graph and the configuration of marked vertices. In particular we showed, that if is the set of edges in the graph, is the set of marked vertices and is the maximum number of unmarked neighbours over , then the success probability satisfies

 maxt≥0pM(t)=\order|VM|3∥K∥2|E|. (1)

Additionally, we analyse several examples of sets of marked vertices and show tightness of our results in the worst case scenario (but not in general). We believe that the proved results as well as used techniques might be of independent interest.

## 2 Preliminaries

### 2.1 Quantum walks

Let be an simple, undirected graph. We denote and . Let be a neighbourhood of a vertex , that is a set of vertices is adjacent to.

We define a location register with basis states for and a direction or coin register, which for a vertex has basis states for . The state of the quantum walk is given by:

 |ψ(t)⟩=n∑i=1∑j∈N(vi)αi,j|i,j⟩.

A step of the quantum walk is performed by first applying , where is a unitary transformation on the coin register. The usual choice of transformation on the coin register is Grover’s diffusion transformation . Then, the shift transformation is applied:

 S=n∑i=1∑j∈N(vi)|j,i⟩⟨i,j|,

which for each pair of connected vertices swaps an amplitude of vertex pointing to with an amplitude of vertex pointing to .

The quantum walk starts in the equal superposition over all pairs vertex-direction:

 |ψ0⟩=1√2mn∑i=1∑j∈N(vi)|i,j⟩.

It can be easily verified that the state stays unchanged, regardless of the number of steps.

To use the quantum walk as a tool for search, we introduce the notion of marked vertices. We perform the quantum walk with one set of transformations at the unmarked vertices, and another set of transformations at the marked vertices. Usually the separation between marked and unmarked vertices is given by the query transformation , which flips the sign at a marked vertex, irrespective of the coin state, i.e. iff is marked. In this case a step of the walk is given by the transformation .

The running time of the walk and the probability of finding a marked vertex in general case depends on both the structure of the graph and the configuration, i.e. the number and the placement, of marked vertices.

### 2.2 Stationary states

We call a state stationary if it is not changed by a step of the algorithm. Below we summarize known facts on stationary states.

###### Theorem 1 ([10]).

Consider a state with the following properties: all amplitudes of the unmarked vertices are equal; the sum of the amplitudes of any marked vertex is 0; the amplitudes of two adjacent vertices pointing to each other are equal. Then is a stationary state of the evolution operator .

Furthermore, the state that maximize the overlap between stationary state and the initial state can be chosen of the above form.

###### Theorem 2 ([12]).

There exists a stationary state of the form as in Theorem 1 that maximizes the overlap between it and the initial state over all possible stationary states.

Note that since the amplitudes of adjacent vertices pointing to each other should be equal it is enough to set values on edges instead of arcs .

We say that a graph is bipartite if there exists a non-empty such that . We call a bipartite set.

###### Theorem 3 ([12]).

A bipartite marked connected component has a stationary state if and only if the sums of degrees of each bipartite set are equal. A non-bipartite marked connected component always have a stationary state.

Note that instead of comparing the sums of degrees of each bipartite set, one can count the number of outgoing edges, i.e. edges connecting marked and non-marked vertices – this comes from the fact that the numbers of internal edges for bipartite sets must be equal. Let us denotes the number of all outgoing edges . We use notation or simply , if the graph is clear from the context, as a replacement of .

###### Theorem 4 ([11]).

Consider a graph with a connected component of marked vertices . Let be such that there exists a stationary state of the form

 |ψS⟩=∑v∼Gwa|vw⟩+∑v∼Mwa(c{w,v}−1)|vw⟩. (2)

Then the probability of finding any element from at time satisfies

 maxt≥0pM(t)≤2|E|⎛⎝∑e∈EMc2(e)+2D¯M+2|EM|⎞⎠. (3)

While , and depend on and only, there exist multiple assignments of and, therefore,

is not uniquely defined. In the next section, which is the main result of the paper, we will focus on estimating the sum.

Note that a simple lower bound on maximum probability is probability of the initial state, which is

 maxt≥0pM(t)≥pM(0)=2|EM|+D¯M2|E|. (4)

## 3 Summary of the results

It turns out that the sum in Eq. (3) may have large impact. In this section we give the summary of results on estimating the sum for various types of graphs. The technical details can be found in appendix.

We call a sequence a cycle if and , and there is no vertex repetition. We say graph is a tree if there is no cycle, and a unicyclic graph if there is precisely one cycle.

Let be the number of marked vertices and let be the number of unmarked neighbors connected to , i.e.

 K(v)=|{w∈V∖VM:w∼Gv}|. (5)

Let . Note that , as otherwise the marked component is at the same the connected component of , and by this the success probability equals for all . Note that we are only interested on a value of on , thus, for simplicity we will use notation for the original sum.

Our results are of two kinds, as we have considered general and constant . In the first scenario, we can show that for trees we have where is the diameter of the tree. Note that needs to satisfy requirement given in Theorem 3 in order to have a stationary states, however no other requirements are needed. For graphs with a cycle we show upperbound . The upperbound does not depend whether the graph is bipartite or not, however for bipartite graph requirement given in Theorem 3 needs to be satisfied. The proofs of these facts can be found in Appendices B and C. Since we can conclude these results with following theorem.

###### Theorem 5.

Consider a graph with a connected component of marked vertices . Let the be defined as in (5). Let be such that there exists a stationary state. Then the probability of finding any element from at time satisfies

 maxt≥0pM(t)=\order|VM|3∥K∥2|E|. (6)
###### Proof.

By Theorem 4 we need to upperbound three addends given in that theorem. First by the consideration above equivalent to considering Theorems 11, 15 and 17 from Appendix C we have

 ∑e∈EMc2(e)=\order|VM|3∥K∥2. (7)

Furthermore we have and . By combining all these facts we have the result. ∎

We would like to emphasize several interesting additional remarks. The proofs of the theorem were always constructive. Furthermore, it turned out that for trees and unicyclic nonbipartite graphs the function is unique and for unicyclic bipartite graphs it lies on a hyperline in space. These properties are particularly helpful, as the optimal is needed to show the tightness of the bound derived in the theorem above. In particular there exists tree for which optimal satisfies , see Theorem 12. This shows, that we cannot improve in general the result of the previous theorem, unless we provide some upperbound of different form than the one given in Theorem 4.

However we can improve the theorem provided is a constant function. In this case we can show that for graphs with a cycle we have , where is the length of any cycle of the graph. In particular the is small if the marked component is Hamiltonian.

###### Theorem 6.

Consider a graph . Let be a connected component of marked vertices with cycle of length . Let the be defined as in Eq. (5). Let be such that there exists a stationary state. Then the probability of finding any element from at time satisfies

 maxt≥0pM(t)=\order|VM|(|VM|−¯g+1)2∥K∥2+|VM|2|E|. (8)
###### Proof.

By Theorem 4 we need to upperbound three addends. First by the consideration above equivalent to Theorems 19 and 22 from Appendix D we have

 ∑e∈EMc2(e)=\order|VM|(|VM|−¯g+1)2∥K∥2. (9)

Furthermore we have and . By combining all these facts we have the result. ∎

Again we could provide some lowerbounds on the theorem: there exists graphs for which the optimal satisfies independently whether graph is bipartite or not, see Theorems 20 and 23 in Appendix D.

Finally we would like to emphasize two remarks based on Theorem 5. First, for every bounded-degree graphs the success probability of finding any vertex from constant size component is . Second, success probability of finding any vertex from constant size component in -regular graphs is .

## References

• [1] R. Portugal, Quantum walks and search algorithms. Springer, New York, 2013.
• [2] Y. Aharonov, L. Davidovich, and N. Zagury, “Quantum random walks,” Physical Review A, vol. 48, no. 2, pp. 1687–1690, 1993.
• [3]

E. Farhi and S. Gutmann, “Quantum computation and decision trees,”

Physical Review A, vol. 58, pp. 915–928, 1998.
• [4] D. Reitzner, D. Nagaj, and V. Buzek, “Quantum walks,” in Acta Physica Slovaca 61, vol. 6, pp. 603–725, 2011. arxiv.org/abs/1207.7283.
• [5] N. Shenvi, J. Kempe, and K. B. Whaley, “A quantum random walk search algorithm,” Physical Review A, vol. 67, no. 052307, 2003.
• [6] A. Ambainis and A. Rivosh, “Quantum walks with multiple or moving marked locations,” in Proceedings of SOFSEM, pp. 485–496, 2008.
• [7] T. G. Wong and A. Ambainis, “Quantum search with multiple walk steps per oracle query,” Phys. Rev. A, vol. 92, Aug 2015.
• [8] N. Nahimovs and A. Rivosh, “Quantum walks on two-dimensional grids with multiple marked locations,” in Proceedings of SOFSEM 2016, vol. 9587, pp. 381–391, 2016.
• [9] N. Nahimovs and A. Rivosh, “Exceptional configurations of quantum walks with Grover’s coin,” in Proceedings of MEMICS, pp. 79–92, 2015.
• [10] N. Nahimovs and R. Santos, “Adjacent vertices can be hard to find by quantum walks,” in Proceedings of SOFSEM 2017, vol. 10139, pp. 256–267, 2017.
• [11] K. Khadiev, N. Nahimovs, and R. A. M. Santos, “On the probability of finding marked connected components using quantum walks,” Lobachevskii Journal of Mathematics, vol. 39, pp. 1016–1023, Sep 2018.
• [12] K. Prūsis, J. Vihrovs, and T. G. Wong, “Stationary states in quantum walk search,” Phys. Rev. A, vol. 94, 2016.

## Appendix A Preliminaries and the optimization problem description

### a.1 Graph theory preliminaries

Let be an simple, undirected graph. We denote and . We use notation as a replacement of . We say that the graph is bipartite if there exists a non-empty such that . We call a bipartite set. We define to be the set of edges incident to , and to be the set of adjacent vertices. Furthermore, we define a degree of the vertex . We call a sequence

 Pwv=(v1=w,e1,v2,e2,…,vk−1,ek−1,vk=v), (10)

where a path, if each vertex appears exactly one, allowing . If we call the path a cycle. For such path is the length of the path. Let be the diameter in a graph, i.e. the maximum distance between any pair of vertices in . Let be the largest degree in a graph. We call vertex a leaf iff its degree is one.

We call graph a subgraph of iff and . Furthermore, a subgraph is an spanning subgraph iff . Note that is a (spanning) subgraph of as well. We call subgraph a component (or an induced subgraph) of iff for each we have .

We say is a tree if it does not contain any cycles. Forest is a disjoint union of trees. Connected graph is a tree iff it has precisely edges. We say is unicyclic if it contains precisely one cycle. Every connected graph is unicyclic iff it has precisely edges. One can prove the following theorem.

###### Lemma 7.

Let be a connected undirected graph with a subgraph being a cycle. Then there exists connected, unicyclic, spanning subgraph such that .

###### Proof.

The proof is constructive. Let us start with . If contains precisely edges, then it matches the requirements of the theorem. If not, it means it has another cycle . Let be an edge that is in but not in , Then we construct new graph . Removing the edge from any cycle does not break connectivity, and still we have , but with having one edge less. We repeat the procedure as long as we have graph with precisely edges. By construction we have and that is connected spanning subgraph of . ∎

We call a rooted tree iff is a tree and . For such graph, for each vertex there exists a unique path . The length of the path is denoted by . We call the height of the tree the length of maximal path from its root, i.e.

 h(T)\coloneqqmaxw∈V|Pwv|. (11)

For each there exists an edge which is the first edge of the path , that is the edge which connects the vertex to its parent . Let be a collection of vertices is a parent of. Let be a collection of edges pointing to vertices in . Note that for the root we have and .

For any rooted tree we can define a natural partial order called tree-order. We have iff the path passes through . We denote a set of all descendants of . Note, that we assume is its own descendant. We call a linear extension of the partial order iff the is linear and for each we have . Note that the root is the unique minimum for both tree-order and its linear extension. Furthermore, the maximal elements of the tree-order (and, thus, the maximum of its linear extension) are leafs.

### a.2 The optimization problem

Let be an undirected connected graph and let . We need to construct a function such that is minimized and for each we have

 ∑e∈I(v)c(e)=−K(v). (12)

Furthermore we denote .

In the original problem would be the component of marked vertices, and would be the number of edges from vertex to unmarked vertices. Hence, we will often assume that . Furthermore, in the case of being a bipartite graph with bipartite sets and we need to add another condition on

 ∑u∈UK(u)=∑u∈V∖UK(u). (13)

This comes directly from Theorem 3.

## Appendix B Success probability for trees

The notation used in this section is described in Sec. A.

###### Lemma 8.

Let be a tree with height . Then

 ∑v∈V∖{v}|D(u)|2≤n2h. (14)
###### Proof.

Note that for tree has height 0, thus the statement is true. We will show the statement by proving inductively for all in linear extension of tree order

 ∑w∈D(u)∖{u}|D(w)|2≤hu|D(u)|2, (15)

where is the longest path from to its descendant. Note that for we have the original statement. The equation above is true for being a leaf. For other nodes we have

 ∑w∈D(u)∖{u}|D(w)|2=∑w∈NC(u)∑t∈D(w)∖{w}|D(t)|2+∑w∈NC(u)|D(w)|2≤∑w∈NC(u)hw|D(w)|2+∑w∈NC(u)|D(w)|2≤(hu−1)∑w∈NC(u)|D(w)|2+∑w∈NC(u)|D(w)|2≤hu∑w∈NC(u)|D(w)|2≤hu⎛⎝∑w∈NC(u)|D(w)|⎞⎠2≤hu|D(u)|2. (16)

We start with a lemma which will be used in almost all proofs.

###### Lemma 9.

Let be a rooted undirected tree and . Then there is a unique function satisfying Eq. (12) for all vertices except the root. Furthermore it satisfies

 ∀u∈V∣∣∑e∈IC(u)c(e)∣∣≤(|D(u)|−1)∥K∥, (17) ∀u∈V∖{v}|c(ep(u))|≤|D(u)|∥K∥. (18)
###### Proof.

For Eqs. (17) (18) are straightforward. Suppose .

Let be vertices enumerated according to some linear extension of the tree-order of . We will assign the values of and prove Eqs. (17) and (18) inductively with the given order of vertices. Note that uniqueness comes directly from the construction.

Suppose is a leaf. According to condition Eq. (12), we have

 ∑e∈I(vi)c(e)=c(ep(vi))=−K(vi). (19)

Note that in this case Eq. (17) and (18) are trivially fulfilled as .

Suppose is not a leaf. Then, according to the order , for all edges value of is specified. According to Eq. (12) we have

 ∑e∈I(vi)c(e)=∑e∈IC(vi)c(e)+c(ep(vi))=−K(vi). (20)

From this we have

 c(ep(vi))=−∑e∈IC(vi)c(e)−K(vi). (21)

 ∣∣∑e∈IC(vi)c(e)∣∣≤∑e∈IC(vi)|c(e)|=∑v∈NC(vi)|c(ep(v))|≤∑v∈NC(vi)|D(v)|∥K∥=(|D(vi)|−1)∥K∥, (22)

where the second inequality comes from the induction assumption on Eq. (18), and the last equality results from the fact that we enumerated all descendants of except . Suppose is not the root. We have

 |c(ep(vi))|=∣∣−∑e∈IC(vi)c(e)−K(vi)∣∣≤∣∣∑e∈IC(vi)c(e)∣∣+∥K∥≤(|D(vi)|−1)∥K∥+∥K∥=|D(vi)|∥K∥. (23)

Now let us show the upper-bound on the success probability for tree graph.

###### Proposition 10.

Let be a tree, and let be a function satisfying Eq. (13). Then there exists a unique function satisfying Eq. (12) for all . Furthermore, for arbitrary rooted tree we have

 ∥c∥22≤∥K∥2∑u∈V∖{v}|D(u)|2. (24)
###### Proof.

Let , and let be an rooted tree. Based on Lemma 9 there is unique satisfying Eq. (12) for every . Hence, we only need to show that Eq. (12) holds for as well.

Let be a set of vertices located at distance from root and let . Note that

 0=K(v)+∑e∈I(v)c(e)=K(v)+∑w1∈NC(v)c(ep(w1))=K(v)+∑w1∈NC(v)(−∑w2∈NC(w1)c(ep(w2))−K(w1))=K(v)−∑w1∈V1K(w1)−∑w2∈V2c(ep(w2))=…=K(v)−∑w1∈V1K(w1)+∑w2∈V2K(w2)⋯+(−1)h∑wh∈VhK(wh). (25)

We have obtained an equivalent form of condition on given by Eq. (13). Thus, Eq. (12) holds for . The upperbound comes directly from applying Eq. (18). ∎

###### Theorem 11.

Let be a tree, and let satisfies Eq. (13). Then there exists unique function satisfying Eq. (12). Furthermore we have

 ∥c∥22=\order¯dn2∥K∥2 (26)
###### Proof.

The proof comes from the Proposition 10, Lemma 8, and the fact that for any choice of root. ∎

We will now prove that the bound is tight in the worst case scenario, but not in the general case.

###### Theorem 12.

There exists a tree , and function satisfying Eq. (13), such that the optimal function satisfying Eq. (12) satisfies with .

###### Proof.

Let

be odd and

be even. We consider the following graph. Let be vertices forming a path in the given order, and let and for be vertices connected to and respectively, as in Fig. 1. Let be a constant function. Since graph is a tree, by the Theorem 11 the function is unique and thus optimal.

The function satisfying Eq. (12) takes the form

 c(e)=⎧⎪⎨⎪⎩−k,e={v1,ti},−k,e={v¯d−1,ui},(−1)i+1(n′−1)k,e={vi,vi+1}. (27)

Thus, we have

 ∥c∥22=2n′k2+(¯d−2)((−1)i+1(n′−1)k)2≥(¯d−2)(n′−1)2k2 (28)

Note that , hence . If we choose , then the graph satisfies the theorem statement. ∎

###### Theorem 13.

There exists a tree , and function satisfying Eq. (13), for which the optimal function satisfying Eq. (12), satisfies .

###### Proof.

Let be a constant function. Let us consider a path graph with vertices for even , where are connected. Let

 c({vi,vi+1})={−k,i is odd,0,i is even. (29)

The function satisfies Eq. (12). Furthermore

 ∥c∥22=n2k2=Θ(n∥K∥2). (30)

By Theorem 2 and the uniqueness of from Theorem 10, the function is the one minimizing the . ∎

## Appendix C Success probability for general K function

The notation used in this section is described in Sec. A.

### c.1 Nonbipartite graphs

###### Proposition 14.

Let be a simple, undirected, connected graph with cycle of odd length and . Then there exists function satisfying Eq. (12) such that

 ∥c∥22≤¯g4n2∥K∥2+(n−¯g)(n−¯g+1)2∥K∥2. (31)
###### Proof.

Let be an cycle of of length , with vertices with respectively where . Let be a connected, unicyclic spanning subgraph of containing . We set for all .

Now let as consider graph . Such constructed graph is a forest which consists of trees such that each tree contains precisely one vertex from cycle . Each tree can be considered as an ordered tree with root , and by Lemma 9 we can define uniquely for each tree such that

 ∀u∈Vj∖{vj}|c(ep(u))|≤|Vj|∥K∥, (32) ∀u∈Vj∣∣∑e∈IjC(u)c(e)∣∣≤(|Vj|−1)∥K∥. (33)

Now let us consider the missing part of the domain of , which is . Based on Eq. (12) we have that the values must satisfy

 c(ej)+c(ej+1)=−∑e∈Ij+1C(vj+1)c(e)−K(vj+1)\eqqcolonzj+1. (34)

Since there is odd number of variables, there exists unique solution of the form

 c(ej)=(−1)j2⎛⎝j∑k=1(−1)kzk−¯g∑k=j+1(−1)kzk⎞⎠. (35)

Note that since we have

 |zj|≤∣∣∑e∈IjC(vj)c(e)∣∣+|K(vj)|≤(|Vj|−1)∥K∥+∥K∥=|Vj|∥K∥, (36)

we have as well

 |c(ej)|≤12¯g∑k=1|zk|≤12¯g∑k=1|Vk|∥K∥=12n∥K∥. (37)

Finally using all of the equations above we have

 ∥c∥22=¯g∑j=1|c(ej)|2+¯g∑j=1∑e∈Ej|c(e)|2≤¯g4n2∥K∥2+¯g∑j=1∑e∈Ej|Vj|2∥K∥2≤¯g4n2∥K∥2+(n−¯g)(n−¯g+1)2∥K∥2, (38)

where we used , , and equations given before. ∎

###### Theorem 15.

Let be a simple, undirected, connected graph with cycle of odd length and . Then there is function satisfying Eq. (12) such that .

###### Proof.

Comes directly from Theorem 14 and from . ∎

#### c.1.1 Bipartite graphs

###### Proposition 16.

Let be a simple, undirected, connected, bipartite graph with cycle of even length and satisfying Eq. (13). Then there is function satisfying Eq. (12) such that

 ∥c∥22≤¯gn2∥K∥2+(n−¯g)(n−¯g+1)2∥K∥2. (39)
###### Proof.

The proofs goes similarly to proof of Theorem 14, up to system of linear equations. In this case we have even number of equations there is either no solutions, or infinite number of solutions. Provided satisfies Eq. (13) it turned one that the solution is parametrized by single free variable and takes the form

 c(ej)=(−1)j+1¯g−1∑k=j(−1)kzk+(−1)j+1z. (40)

where is free parameter. Let . Then

 |c(ej)|≤¯g−1∑k=j|zk|+|z¯g|≤¯g∑k=1|zk|≤¯g∑k=1|Vk|∥K∥=n∥K∥. (41)

Finally, similarly to the proof of Theorem 16

 ∥c∥22=¯g∑j=1|c(ej)|2+¯g∑j=1∑e∈Ej|c(e)|2≤¯gn2∥K∥2+(n−¯g)(n−¯g+1)2∥K∥2. (42)

###### Remark 17.

Let be a simple, undirected, connected, bipartite graph with cycle of even length and satisfying Eq. (13). Then there is function satisfying Eq. (12) such that .

###### Proof.

Comes directly from Theorem 16 and from . ∎

Note that the solution is not unique anymore, as it depends on single parameter even if it contains only one cycle. Furthermore, note that in the proof we searched for unicyclic spanning subgraph, while we could search for spanning tree and use Theorem 11. Careful analysis would show the same bound , since diameter of any spanning tree is at most .

## Appendix D Success probability for constant K function

The notation used in this section is described in Sec. A.

### d.1 Nonbipartite graphs

In case of being a constant function, we can slightly reduce obtained result.

###### Proposition 18.

Let be a simple, undirected, connected graph with cycle of odd length and constant function . Then there is function satisfying Eq. (12) such that

 ∥c∥22≤(n−3¯g/4)(n−¯g+1)2∥K∥2. (43)
###### Proof.

Whole construction of and other variables remains the same as in Theorem 14, however we can provide more explicit form of on edges from cycle. Note that according to the construction we have

 zj=−z0j−K′, (44)

where . Thus we can do following

 c(ej)=(−1)j2⎛⎝j∑k=1(−1)kzk−¯g∑k=j+1(−1)kzk⎞⎠=(−1)j+12⎛⎝j∑k=1(−1)k(z0k+K′)−¯g∑k=j+1(−1)k(z0k+K′)⎞⎠=(−1)j+12⎛⎝j∑k=1(−1)kz0k−¯g∑k=j+1(−1)kz0k+K′(−1)j⎞⎠. (45)

Hence we have

 |c(ej)|≤12∣∣ ∣∣j∑k=1(−1)kz0k−¯g∑k=j+1(−1)kz0k+K′(−1)j∣∣ ∣∣≤12