Path Detection: A Quantum Algorithmic Primitive

Shelby Kimmel

Middlebury College

Based on work with Stacey Jeffery: arXiv: 1704.00765 (Quantum vol 1 p 26) Michael Jarret, Stacey Jeffery, Alvaro Piedrafita, arXiv:1804.10591 (ESA 2018) Kai DeLorenzo, Teal Witter, arXiv:1904.05995 (TQC 2019) Primitives!

• Quantum algorithmic primitives 1. Widely applicable 2. Can be used in a black box manner (with easily analyzable behavior) Primitives!

• Quantum algorithmic primitives 1. Widely applicable 2. Can be used in a black box manner (with easily analyzable behavior)

– Ex: Searching unordered list of � items – Classically, takes Ω(�) time – Quantumly, takes �( �) time Primitives!

• Quantum algorithmic primitives 1. Widely applicable 2. Can be used in a black box manner (with easily analyzable behavior)

– Ex: Searching unordered list of � items – Classically, takes Ω(�) time – Quantumly, takes �( �) time

Good primitive: ��-connectivity Outline:

A. Introduction to st-connectivity B. st-connectivity makes a good algorithmic primitive 1. Widely applicable 2. Easy to analyze Outline:

A. Introduction to st-connectivity B. st-connectivity makes a good algorithmic primitive 1. Widely applicable 2. Easy to analyze

Applications: • Read-once Boolean formulas (query optimal) [JK] • Total connectivity (query optimal) [JJKP] • Cycle detection (query optimal) [DKW] • Even length cycle detection [DKW] • Bipartiteness (query optimal) [DKW] • Directed st-connectivity (query optimal) (Beigi et al ‘19) • Directed smallest cycle (query optimal) (Beigi et al ‘19) Outline:

Applications: • Topological sort (Beigi et al ‘19) • Connected components (Beigi et al ‘19) • Strongly connected components (Beigi et al ‘19) • k-cycle at vertex v (Beigi et al ‘19) • st-connectivity (Reichardt, Belovs ‘12) ��-connectivity

�� − ������������: is there a path from � to �?

� ��-connectivity

�� − ������������: is there a path from � to �?

� Input to Algorithm

Bit String:

� � … � Input to Algorithm

Bit String:

� � … � 1 0 1 Input to Algorithm

Skeleton � Bit String: 1 2 Graph 3 � � � 3 1 2 3 � Input to Algorithm

Skeleton � Bit String: 1 2 Graph 3 � � � 3 1 1 0 1 2 3 � Input to Algorithm

Skeleton � Bit String: 1 2 Graph 3 � � � 3 1 0 0 1 2 3 � Input to Algorithm

Skeleton � Bit String: 1 2 Graph 3 � � � 3 1 1 2 • Bit string initially hidden, can query 3 value of string at each bit. � Input to Algorithm

�! � � = � � + �" Skeleton � Bit String: 1 2 Graph 3 � � � 3 1 1 2 • Bit string initially hidden, can query 3 value of string at each bit. � Algorithm

Skeleton � 1 2 Graph 3

3 1 2 Q. Algorithm to Ye s / N o 3 Solve connectivity �

�for Bit String:

� � � Outline:

A. Introduction to st-connectivity B. st-connectivity makes a good algorithmic primitive 1. Widely applicable 2. Easy to analyze Cycle Detection

Is there a cycle?

Ye s Cycle Detection

Is there a cycle?

No Cycle Detection

Is there a cycle? 1 Input to Cycle Detection: 2 5 3 • Skeleton graph • Hidden bit string 4 �����

� = 1 ↔edge � is present Cycle Detection

Is there a cycle through edge 1? 1 2 5 3

4 Cycle Detection

Is there a cycle through edge 1? 1 2 5 3

4 There is a cycle through Edge 1 iff • Edge 1 is present • Path between the endpoints of Edge 1 not using Edge 1 Cycle Detection

Is there a cycle through edge 1? � 1 1 Edge 1 is present 2 5 3

4 2 5 There is a cycle through 4 Path between Edge 1 iff the endpoints • Edge 1 is present 3 of Edge 1 not • Path between the � using Edge 1 endpoints of Edge 1 not using Edge 1 Cycle Detection

Is there a cycle? 1 2 5 3

4 There is a cycle if there is a cycle through some edge Cycle Detection

� Is there a cycle? 1 4 5 1 2 3 1 2 5 3 2 5 1 5 1 5 3 3 2 2 4 4 1 4 4 4 There is a cycle if 5 3 2 3 there is a cycle through some edge � Boolean Formulas �

�(�) � � � � ⋀

⋁ � �#$ � 1 � ⋀ ⋀ ⋀ � �

⋁ ⋁ � �# �% �& �' � 0 0 1 0 �( �) �* �+ �, 0 1 0 1 1 Outline:

A. Introduction to st-connectivity B. st-connectivity makes a good algorithmic primitive 1. Widely applicable 2. Easy to analyze Algorithm Analysis:

Space Complexity: � log(# ����� �� �������� ����ℎ) Algorithm Analysis:

Query Complexity:

• Bit string initially unknown • Minimum # of oracle uses to determine w.h.p. on worst input Algorithm Analysis:

Query Complexity:

• Bit string initially unknown • Minimum # of oracle uses to determine w.h.p. on worst input ≈

Time Complexity Algorithm Analysis:

Query Complexity:

� max �, � max �, �

Effective resistance Effective capacitance Algorithm Analysis:

Query Complexity:

� max �, � max �, �

Effective resistance Effective capacitance [Belovs, [Jarret, Jeffery, Kimmel, Reichardt, ’12] Piedrafita, ’18] Effective Resistance

1 unit of flow �

� 1 unit of flow Effective Resistance

1 unit of flow � Valid flow: 1 0 • 1 unit in at � • 1 unit out at � � 1 − � • At all other nodes, zero net flow 1 � 1 unit of flow Effective Resistance

1 unit of flow � Flow energy: 1 0 ���� �� ���� � 1 − �

1 � 1 unit of flow Effective Resistance

1 unit of flow � Flow energy: 1 0 ���� �� ���� � 1 − �

Effective Resistance: �,(�) • Smallest energy of any valid 1 flow from � to � on �. � 1 unit of flow Effective Resistance

1 unit of flow � Flow energy: 1 0 ���� �� ���� 1/2 1/2

Effective Resistance: �,(�) • Smallest energy of any valid 1 flow from � to � on �. � 1 unit of flow Algorithm Analysis:

Query Complexity:

� max �, � max �, �

Effective resistance Effective capacitance Effective Capacitance

� Generalized cut: 1 • 1 at � 1 • 0 at � 1 • Difference is 0 across edge

� 0 � Effective Capacitance

Potential energy: � 1 ��� ���������� 1 1

� 0 � Effective Capacitance

Potential energy: � 1 ��� ���������� 1 1

Effective Capacitance: � (�) , 2/3 • Smallest potential energy of any valid generalized cut 0 � between � and � on �. Algorithm Analysis:

Query Complexity:

� max �, � max �, �

Effective resistance Effective capacitance Example

Cycle Detection � max �, � max �, �

� 1 5 2 3 4 1 2 5 5 1 3 1 3 2 5 2 4 1 4 4 5 4 3 2 3

� Example

Cycle Detection � max �, � max �, �

� 1 5 2 3 4 1 2 5 5 1 3 1 3 2 5 2 4 1 4 4 5 4 3 2 3

� Example

Cycle Detection � max �, � max �, �

� 1 5 2 3 4 1 2 5 5 1 3 1 3 2 5 2 4 1 4 4 5 4 3 2 3

� • k parallel paths of length k Length k cycle • 1/� flow on each path • Effective resistance is 1 Example

Cycle Detection � max �, � max �, �

� 1 5 2 3 4 1 2 5 5 1 3 1 3 2 5 2 4 1 4 4 5 4 3 2 3

Multiple cycles Effective resistance is < 1 Example

Cycle Detection � max �, � max �, �

� 1 5 2 3 4 1 2 5 5 1 3 1 3 2 5 2 4 1 4 4 5 4 3 2 3

� Example

Cycle Detection � max �, � max �, �

� % • � � subgraphs 1 5 2 3 4 corresponding to non- 1 2 5 5 1 3 1 present edges: cut at top 3 2 5 2 • � � 4 1 subgraphs 4 4 5 4 corresponding to present 3 2 3 edges, cut could have � �(�%) edges in cut Example

Cycle Detection � max �, � max �, �

�, � = �(1) �, � = �(� )

Query complexity: � �/

(optimal – logarithmic improvement over previous algorithm) Example

Cycle Detection � max �, � max �, �

�, � = ������� ���� = min # of edges to cut to create a cycle free graph

• Quantum algorithm picks out critical topological parameter • If promised either large circuit rank or no cycle, then cycle detection algorithm runs faster • Proved by 2nd year undergrads Estimation Algorithm:

Quantum query algorithm to estimate effective resistance or effective capacitance of �. (Jeffery, Ito ’15) Estimation Algorithm:

Quantum query algorithm to estimate effective resistance or effective capacitance of �. (Jeffery, Ito ’15)

Because effective resistance depends directly on circuit rank, we now have a quantum algorithm to estimate circuit rank. Umm…Algorithm? N Theorem 14. Let U(P, x)=(2Πker A I)(2ΠH(x) I).FixX 0, 1 and f : X 0, 1 ,andletPbeaspan N − − ⊆ { } → { } program on 0, 1 that decides f . Let W+( f , P)=maxx f 1(1) w+(x, P) and W ( f , P)=maxx f 1(0) w (x, P). { } ∈ − − ∈ − − Then there is a bounded error quantum algorithm that decides fbymakingO( W+( f , P)W ( f , P)) calls to U(P, x), − and elementary gates. In particular, this algorithm has quantum query complexity O( W+( f , P)W ( f , P)). ! − Ref. [IJ16]definestheapproximate positive and negative witness sizes, w˜ +(x, !P) and w˜ (x, P).Theseare − similar to the positive and negative witness sizes, but with the conditions w H(x) and ωAΠH(x) = 0 relaxed. | ⟩∈ Definition 15 (Approximate Positive Witness). For any span program P on 0, 1 N and x 0, 1 N,wedefine the positive error of x in Pas: { } ∈ { }

2 e+(x)=e+(x, P) := min Π w : A w = τ .(14) H(x)⊥| ⟩ | ⟩ "# # $ # # # # 2 We say w is an approximate positive witness for x in P if Π w = e+(x) and A w = τ. We define | ⟩ H(x)⊥ | ⟩ | ⟩ the approximate positive witness size as # # # # # # 2 2 w˜ +(x)=w˜ +(x, P) := min w : A w = τ, Π w = e+(x) .(15) ∥| ⟩∥ | ⟩ H(x)⊥ | ⟩ " # # $ # # If x P ,thene+(x)=0. In that case, an approximate positive# witness for# x is a positive witness, and ∈ 1 w˜ +(x)=w+(x).Fornegativeinputs,thepositiveerrorislargerthan0. We can define a similar notion of approximate negative witnesses (see [IJ16]). N R Theorem 16 ([IJ16]). Let U(P, x)=(2Πker A I)(2ΠH(x) I).FixX 0, 1 and f : X 0.LetPbea ≥ N − − ⊆ { } → span program on 0, 1 such that for all x X, f(x)=w (x, P) and define W+ = W+(P)=maxx X w˜ +(x, P). { } ∈ − ∈ 1 Then there exists a quantum algorithm that estimates f to accuracy ϵ and that uses O w (x)W+ calls to % % ϵ3/2 − & ( U(P, x) and elementary gates. ' % %

Aspanprogramforst-connectivity An important example of a span program is one for st-connectivity, first introduced in [KW93], and used in [BR12]togiveanewquantumalgorithmforst-connectivity. We state this span program below, somewhat generalized to include weighted graphs, and to allow the input to be specified as a subgraph of some parent graph G that is not necessarily the complete graph. We allow astringx 0, 1 N to specify a subgraph G(x) of G in a fairly general way, as described in Section 2.2. ∈ { } In particular, for i Umm…Algorithm[N],let−→E −→E (G) denote the set? of (directed) edges associated with the literal x , ∈ i,1 ⊆ i and −→E the set of edges associated with the literal x .Notethatif(u, v, ℓ) −→E then we must also have i,0 i ∈ i,b (v, u, ℓ) −→E ,sinceG(x) is an undirected graph. We assume G has some implicit weighting function c. ∈ i,b Span Program Then we refer to the following span program as PG:

i [N], b 0, 1 : H = span e : e −→E ∀ ∈ ∈ { } i,b {| ⟩ ∈ i,b} U = span v : v V(G) {| ⟩ ∈ } τ = s t | ⟩−| ⟩ e =(u, v, ℓ) −→E (G) : A u, v, ℓ = c(u, v, ℓ)( u v ) (16) ∀ ∈ | ⟩ | ⟩−| ⟩ ' One can check that ifSpans and Programt are connected,->Unitary U then= (reflection if w represents about space a weightedthat st-path or linear combination of weighted st-pathsdepends in G(x )on,then skeletonw isgraph)(reflection a positive| witness⟩ about for a spacex.Furthermore,thisistheonlypossibility that | ⟩ for a positive witness,depends so x ison a input) positive input for PG if and only if G(x) is st-connected, and in particular, 1 w+(x, PG)= 2 Rs,t(G(x)) [BR12]. Since the weights c(e) are positive, the set of positive inputs of PG are Do phase estimation on U to precision � max �, � max �, � independent of the choice of c,however,thewitnesssizeswilldependon c.

10 Open Questions and Current Directions

• How to choose edge weights? (Beigi et al ‘19) • Conditions when st-connectivity reduction optimal? • What is the classical time/query complexity of st- connectivity in the black box model? Under the promise of small capacitance/resistance? • Better estimation algorithm for st-connectivity effective resistance/capacitance • Primitives/Pedagogical Problems? Thank you!

Stacey Michael Jarret Andr Jeffery ew Zhao

Alvaro Piedrafita Te a l Kai De Witter Lorenzo