Exponential Quantum Space Advantage for Approximating Maximum Directed Cut in the Streaming Model

While the search for quantum advantage typically focuses on speedups in execution time, quantum algorithms also offer the potential for advantage in space complexity. Previous work has shown such advantages for data stream problems, in which elements arrive and must be processed sequentially without random access, but these have been restricted to specially-constructed problems Le Gall, SPAA ‘06 or polynomial advantage Kallaugher, FOCS ‘21. We show an exponential quantum space advantage for the maximum directed cut problem. This is the first known exponential quantum space advantage for any natural streaming problem. This also constitutes the first unconditional exponential quantum resource advantage for approximating a discrete optimization problem in any setting. Our quantum streaming algorithm 0.4844-approximates the value of the largest directed cut in a graph stream with n vertices using polylog(n) space, while previous work by Chou, Golovnev, and Velusamy FOCS ’20 implies that obtaining an approximation ratio better than 4/9 ≈ 0.4444 requires Ω(√n) space for any classical streaming algorithm. Our result is based on a recent O(√n) space classical streaming approach by Saxena, Singer, Sudan, and Velusamy FOCS ’23, with an additional improvement in the approximation ratio due to recent work by Singer APPROX ’23.


INTRODUCTION
Streaming algorithms are a means of processing very large data sets, in particular those too large to be stored wholly in memory.In this setting data elements arrive sequentially, and a streaming algorithm must process elements as they arrive using as little space as possible-ideally logarithmic in the size of the data.Streaming algorithms have been developed for many applications, including computing statistics of data streams and estimating graph parameters [1,2,9].The practical use of such algorithms goes back to the approximate counting algorithm of Morris [8,18] and has expanded as the growth of the internet has increased the prevalence of extremely large datasets [21].
Quantum computing o ers the prospect of exponential resource advantages over conventional classical computers.The primary resource of interest has traditionally been execution time, and while a handful of examples such as Shor's celebrated algorithm for integer factorization [24] provide exponential speedups over the best-known classical counterparts, provable exponential speedups over the best-possible classical algorithms remain largely elusive.Although speedups are important, space is an especially critical resource for quantum computing, as scalable fault-tolerant qubits are and will likely continue to be scarce.Quantum streaming algorithms o er a natural avenue for exploring space-e cient quantum algorithms.
Moreover, space-e cient quantum algorithms, including streaming algorithms, o er an alternative opportunity for quantum advantage.Very large datasets continue to be prevalent in computing, and so an algorithm with quantum memory can potentially process much larger datasets than one with only classical memory, provided the problem in question evinces a large enough quantum advantage to justify the much higher cost of qubits relative to classical bits.
Provable exponential space advantages for quantum algorithms in the streaming setting have been known since the seminal work of Gavinsky, Kempe, Kerenidis, Raz, and de Wolf [10]; however, the problem studied was constructed for the purpose of proving this separation, leaving open the question of whether such advantages exist for problems of independent classical interest.The question of quantum advantage for a "natural" streaming problem was suggested by Jain and Nayak [11], who proposed a candidate problem of recognizing the Dyck(2) formal language, related to strings of balanced parentheses.It remains open whether quantum advantage is possible for this problem [19].This question of a quantum advantage for a natural streaming problem was recently resolved in [13], which demonstrates quantum advantage for the problem of counting triangles in graph streams.This problem has been long studied classically and drives numerous applications in analyzing social networks [2,4,12].However, the advantage o ered is only polynomial in the input size, and requires additional parametrization of the input (the latter being unavoidable with the triangle counting problem).We give the rst exponential quantum space advantage for a streaming problem of independent interest.
Our Results.We give a polylog( )-space algorithm that gives a 0.4844-approximation for the maximum directed cut (Max-DiCut) problem.Given a directed graph = ( , ) (as a sequence of edges), Max-DiCut( ) is the greatest number of edges that can be simultaneously "cut" by a partition = 0 ⊔ 1 , where − → is cut i ∈ 0 , ∈ 1 .In the classical streaming setting, Chou, Golovnev, and Velusamy [5] showed that any approximation better than 4/9 requires Ω √ space.
Theorem 1.There is a quantum streaming algorithm which 0.4844 -approximates the Max-DiCut value of an input graph with probability 1 − .The algorithm uses O log 5 log1 qubits of space.
Our quantum algorithm is inspired by the classical algorithm of Saxena, Singer, Sudan, and Velusamy [22], which achieves this same approximation ratio in a classically-optimal O √ space.Like theirs, our algorithm estimates a histogram of the edges of where the buckets correspond to edges between "bias classes", which partition the vertices of according to their bias (the di erence between the in-degree and out-degree of a vertex, normalized by the degree).
In their algorithm, the histogram is then used to estimate the output value of a 0.4835-approximation algorithm for Max-DiCut due to Feige and Jozeph [7] that randomly assigns each vertex to a side of a cut based solely on its bias.Their algorithm prescribes a constant number of bias ranges, where the random assignment only depends on these ranges.This allows the aforementioned histogram estimate to be constructed with respect to a constant number of bias classes.We use a result from recent work 1 by Singer [25] that increases the approximation ratio o ered by [7] to 0.4844 with a new set of bias classes, allowing us an improved approximation ratio (we note that this later work also improves the approximation ratio o ered by the aforementioned classical algorithm; the advantage of our quantum algorithm lies in its exponentially better space complexity).
The existence of quantum advantage for this problem contrasts with recent work of Kallaugher and Parekh [14], who show that approximating the undirected maximum cut problem (Max-Cut) in graph streams does not admit any asymptotic quantum advantage.Random assignment of vertices to a side of a cut yields a 1/2-approximation for Max-Cut and a 1/4-approximation for Max-DiCut.These can be implemented as streaming approximations by counting the number of edges and dividing by 2 or 4. While Max-Cut requires linear space (whether in the quantum or classical setting) to do better than a 1/2-approximation, Max-DiCut does admit a O(log )-space classical algorithm that beats the trivial 1/4approximation [5].As noted above, for Max-DiCut, polylog( )space classical algorithms cannot beat a 4/9-approximation, while we show a quantum streaming algorithm achieving this exists.
Quantum Approximation Advantages.Finding provable quantum advantages for approximating discrete optimization problems is an open problem that has received considerable attention, especially following the introduction of the Quantum Approximate Optimization Algorithm (QAOA) [6].As canonical examples of constraint satisfaction problems (CSPs), Max-Cut and related problems have served as focal points in QAOA analysis and empirical performance studies.The approximability of Max-Cut and other CSPs is well understood conditional on the unique games conjecture (UGC) [20].If the latter holds, then for every CSP there is some ∈ (0, 1] for which an -approximation is achievable in polynomial time, but for which it is NP-hard to obtain an ( + )-approximation for any > 0. This leaves little hope for worst-case quantum approximation advantages, as we do not expect polynomial time quantum algorithms to solve NP-hard problems.
Our work, on the other hand, shows that a provable quantum approximation advantage is possible in the space-constrained streaming setting.The polylog-space streaming setting does not admit -approximations of the form described above, which are based on solving semide nite programs, leaving more room for quantum advantage.For Max-DiCut, > 0.874 is known to be possible in general [3,17], but the work of [5] shows that 4/9 is the best classically possible for polylog-space streaming algorithms.As previously mentioned, it is impossible for a polylog-space quantum algorithm to attain better than a 1/2-approximation for any > 0 in the streaming setting.This is also true for Max-DiCut, since approximating Max-Cut can be reduced to approximating Max-DiCut in instances where ( , ) is an edge whenever ( , ) is.Therefore, there is an opportunity for polylog-space quantum -approximations for ∈ (4/9, 1/2], and we indeed demonstrate that an exponential quantum space advantage is possible in this range.

OUR TECHNIQUES
We follow the approach of [22], who give an O √ upper bound for 0.4835-approximation of Max-DiCut.To achieve this result, they use the notion of a " rst-order snapshot" of a graph.Introduced in [23], this is a histogram of the frequency with which the (directed) edges of the graph go from one "bias class" to another.
The bias of a vertex is de ned as = out − in where denotes the degree of , out denotes the out-degree of , and in denotes the out-degree of .Note that , so that all of [−1, 1] is covered), the bias classes are the sets of of vertices whose biases belong to each interval.The rst-order snapshot of the graph is then given by the count of edges − → such that ( , ) ∈ × for each ( , ).From hereon we will drop the " rst-order" quali cation and refer to this simply as a "snapshot".
The key tool used in [22] is a result of [7] stating that 0.4835approximation of the Max-DiCut value of a graph can be computed from its snapshot, where the set of bias classes de ning the snapshot is xed and is independent from the graph itself and so, in particular, the number of di erent bias classes is constant.We use the result of [25] instead, but the central problem is unchanged: given a constant set of bias thresholds, estimate the corresponding snapshot.See a formal description in Section 4. The authors give a O √ -space classical algorithm for estimating these snapshots in the stream, and thereby for computing a 0.4835-approximation of the Max-DiCut value of a graph.
We show that the snapshot of a graph (and thus an approximation to its Max-DiCut value) can be estimated by a quantum streaming algorithm in polylog( ) space.In the remainder of this section, we will describe the main technical ideas behind this contribution.

One-Way Communication, Simpli ed Problem
We will start by considering a simpli ed version of this problem in the one-way communication setting.Suppose there are two parties, Alice and Bob, each with their own input.Alice's input is labelled graph vertices, and Bob's input is a "directed matching" (a set of vertex-disjoint directed edges), and a pair of labels , .Alice is allowed to send a message to Bob, and after receiving this message, Bob's goal is to estimate the number of edges from his matching that have a vertex labeled as its head and vertex labeled as its tail.The question in this setting is how small Alice's message could be.
Note that if Alice chooses O √ /2 vertices uniformly at random and sends the sampled vertices along with the labels, one can show (the "Birthday paradox") that Bob would be able to estimate (up to O( ) additive error) the number of correct edges with probability 2/3.This is (up to a log factor) optimal for classical protocols by [10].
On the other hand, with quantum communication, we can obtain a signi cant improvement using a slightly modi ed version of the quantum Boolean Hidden Matching protocol from [10].Alice sends to Bob copies of the superposition where is the label of the vertex , and the last register ℎ, denotes if the element is to be treated as head or tail of an edge.Bob then measures each copy of the state with the projectors onto the following vectors along with the projector onto the complement of the space they span.
For each copy of the superposition sent and measured, each state of the form for an edge − → will be returned with probability 1/ if and are labelled with and , with probability 1/4 if the vertices have exactly one "correct" label (either is labelled with or is labelled with ), and probability zero otherwise.
If Bob sees such an edge, he adds / to his estimate of the number of edges with head labelled and tail labelled where is an accuracy parameter to be set later.
Each state of the form will be returned with probability 1/4 if the vertices have exactly one correct label, and probability zero otherwise.If Bob sees such an edge, he subtracts / from his estimate.
The expectation of Bob's estimate will therefore be correct, and its variance will be O 2 / .If = Θ 1/ 2 , Bob's estimate isclose to the correct value with probability 2/3.This protocol only uses ( 1 2 log ) qubits.

One-way Communication, Snapshot Approximation
Now, let us return to the original problem of estimating the entries of the graph snapshot, while remaining in the two player one-way communication setting.Both Alice and Bob are given their own directed graph on the same set of vertices, and their goal is to estimate the bias histogram of the union of their graphs.
How is this problem di erent from the one we considered before?Firstly, Bob's input is no longer a matching, which means the projectors Bob used are no longer guaranteed to be orthogonal.We could address this by splitting Bob's graph into matchings and measuring a di erent copy of Alice's state with each, but this would require Alice to send Θ( max ) copies (where max is the maximum degree of the graph), which eliminates the advantage we achieved previously 2 .
Secondly, we still have to estimate the number of edges between vertices with a pair of labels, but now the labels (bias classes) depend on the graph itself.Moreover, neither Alice nor Bob alone know the labels since the labels depend on both Alice and Bob's input graphs.
Fortunately, we can tackle both problems using properties of how the biases depend on the two players' graphs.Our rst observation is that, if we're given the biases of a vertex in Alice's input and Bob's input separately, as well as the degrees of this vertex in each of the graphs, we can obtain its bias with respect to the whole graph.The second observation is that if the degree of a vertex in Bob's graph is much higher than its degree in Alice's graph, Alice's graph contributes very little to the bias of this vertex and thus Bob can compute an estimate of the bias by himself.
The former means that, if Alice splits her vertices into polylog( ) di erent subsets based on their degrees and biases, and sketches each separately (so that for each sketch, Bob knows the degree and bias of the vertices he is dealing with up to a small error), Bob has enough information to approximate the biases in the full graph.The latter fact means that, if Alice copies each of her vertices with multiplicity equal to a su ciently large constant times its degree (which she can a ord to do, as it results in a superposition with no more than O( ) states, where is the number of edges in her input), either Bob will be able to measure with all of his edges, or Bob does not need Alice's input to determine the bias of this vertex.Suppose Alice sends the superposition where , are subsets of Alice's vertices with biases and degrees in a small enough range (such that Bob can know the biases and degrees to an approximation), with , upper bounds on the degrees of vertices in and .Bob may then measure the state with the projectors onto the vectors , and also to sample from such edges 3 .
Given such a sampled edge, Bob can calculate the bias of its endpoints using his knowledge of the degrees and biases of and restricted to Alice's graph, and their degrees and biases in his own graph.So by repeating this process for polylog( ) many combinations of ranges, the players can approximate the number of edges between each pair of "bias classes", with the exception of vertices whose degree is much higher (more than 1/ times as high) for Bob than Alice.
For these vertices, Bob can approximate their contribution to the snapshot with only his own information, as Alice's input only provides an contribution to their biases.Of course, he does not actually know which vertices these should be.However, this can be solved by having Bob calculate this for every vertex, and then performing appropriate corrections when the protocol samples non low-degree vertices.

Streaming Algorithm
Now we want to implement this protocol in the stream.Our rst obstacle is that now, each time a new edge arrives, we need to "process" it both as Alice and as Bob, meaning we need to update the superposition and measure it.Secondly, instead of performing our measurements all at once, we will need to perform them edge by edge, at each point using projectors onto a small part of the space along with a "complementary projector" onto the rest of the space.When a measurement returns something other than the Start by considering the case where we are only interested in whether the endpoints of the edge have the right degree.To make things even simpler, imagine we only care whether a vertex has degree at least .We may store the state where is the degree of among the edges that have arrived up until now, and S is is a collection of "scratch states" that do not contain any information about the graph and are there to be swapped with states we want, in order to maintain this superposition.When a new edge − → arrives, we can maintain this state by sending ⟩. S will therefore require 2 states to start (where is the number of edges in the stream) and so the normalization factor ′ will start at = 2 , before changing as the state is measured.
To use this state, after − → arrives and the state has been updated accordingly, we may measure with the projectors (along with a complementary projector onto the space not spanned by them) onto the vectors where , are the minimum desired degrees for the head and the tail respectively.Then, if the desired degree has been achieved by both endpoints, | ℎ⟩ + | ⟩ is a possible outcome for the measurement but not | ℎ⟩ − | ⟩.Otherwise both are equally likely, and so we can estimate the number of edges between pairs of vertices with the right degrees (similar to the 2-player labeling problem).Note that if | ℎ⟩ ± | ⟩ is returned, the state collapses to the corresponding vector-at this point we stop using the state and proceed classically with the returned vertices and (e.g.counting how many in-and out-edges are seen incident to them after this point).Therefore, each copy of the quantum state maintained allows us to "sample" up to one pair of vertices ( , ).
One side-e ect of this measurement, that will be convenient later, is that conditioned on returning the complementary projector (i.e.not sampling some ( , ) and terminating the quantum stage) it "deletes" | ℎ⟩ and | ⟩ from the superposition after each measurement, so the state we maintain ends up being This also means that each measurement before termination reduces ′ , and so the probability of returning a given measurement outcome does not depend on how many edges have been processed so far (as the probability that the algorithm terminates before a given edge is processed exactly cancels out the decrease in ′ conditioned on the algorithm not terminating before then).We can extend this method to only count (in expectation) edges where and are in ranges [ , ′ ) and [ , ′ ), by maintaining four copies of the state and measuring all the combinations of , ′ and , ′ , and subtracting appropriately.This means we are now maintaining four di erent states for each sample we want, because of the di erence in which states the measurements delete:
Unfortunately, the information only about the degrees is not enough to estimate the bias.Moreover, our method does not automatically permit associating tuples of integers with each vertex.Our approach is to store the out-degree of the vertex in the higher order bits of the degree counter.
To do this without overwriting the degree information 5  In order to avoid blowing up the number of states we need, we only do this with probability 1/ , 1/ respectively (we will always choose and ′ to be within a constant factor of each other), and so if, for instance, we see − 1 edges incident to a vertex that do not trigger this event, and then see one that does trigger it, the | ℎ⟩ portion of our state becomes min( , −1) we can get an estimator that counts when both and have degree at least and respectively, and have each seen at least once outedge that was sampled.So this approximately checks the out-degree of and , and as before we can convert this into approximately counting how often these out-degrees lie in certain ranges by adding three additional estimators.This method only checks a very rough approximation to the outdegrees and therefore biases of and .We improve it by adding extra estimators | ( + ′ )ℎ⟩ ± | ( + ′ ) ⟩ for = 1, . . ., − 1 and = 1, . . ., − 1.This has 2 overhead as we need the measurements to be orthogonal, and so need to perform them on di erent pairs of states, but we only need constant for a su ciently accurate estimate.In combination with some "cleanup" measurement operators we end up with e.g. the | ℎ⟩ portion of the state being ∈ | ℎ⟩ up to normalization, where the are a sequence of intervals, with the last element in each interval encoding the degree of and the number of intervals encoding the out-degree of the graph.
Dealing with noise in the bias.The nal issue is that our estimate of the bias of a vertex is noisy, because of the way we count outedges.One challenge for snapshot algorithms is that even a small error in estimating the bias of a vertex can lead to large errors in the snapshot, if e.g. a vertex with large degree has bias close to the boundary of a class.The authors of [22] address this problem by "smoothing" techniques.We, on the other hand, introduce an object that we call the "pseudosnapshot", corresponding to our noisy estimates of the biases, and show that approximating the entries of this object su ces for the Max-DiCut approximation.

Proof Overview
In section 4 we recall the statement of the reduction from Max-DiCut to computing snapshots.In section 5 we introduce the notion of the pseudosnapshot and how it is related to the snapshot.In section 6 we describe the key quantum primitive that estimates each entry of the pseudosnapshot (restricted to edges with head and tail in speci c ranges of degrees) and prove its correctness.Finally, in section 7 we show how to put everything together to get the algorithm for 0.4844-approximation of Max-DiCut.

PRELIMINARIES
The graphs we deal with will all be directed graphs.When the graph = ( , ) being dealt with is clear, will be the number of the vertices of the graph, and the number of edges.For all ∈ , is its degree, out the number of edges with as their head, in the number with as their tail, and = out − in will be the bias of .
We will be interested in the maximum directed cut value of a graph.
De nition 2. Let = ( , ) be a directed graph.Then Speci cally, we will be interested in the complexity of attaining an -approximation to Max-DiCut.

De nition 3. For any ,
Note that recent work on streaming Max-Cut [14,16] uses the opposite de nition, where ′ ∈ [ , ], so the complexity of achieving an -approximation for us is equivalent to their achieving a 1/ approximation.We adopt this notation for consistency with recent work on streaming Max-DiCut [22].

REDUCING MAX-DICUT TO SNAPSHOT ESTIMATION
We follow [22] in reducing this problem to the problem of estimating a "snapshot" of the graph.

REDUCING MAX-DICUT TO PSEUDOSNAPSHOT ESTIMATION
In this section, we de ne a "pseudosnapshot" PsSnap , based on hash functions and a coarsening of the vertex degrees, and show that it is close to the snapshot of a graph ′ that is in turn close to .In the next section, we will show that this can be approximated by a small space quantum streaming algorithm.

De nition
Let ( ) ⌊log 1+ 3 ⌋ =0 be given by = ⌊(1 + 3 ) ⌋ for < ⌊log 1+ 3 ⌋ and ⌊log 1+ 3 ⌋ = .Let ≤ poly , ∈ [0, 1] be accuracy parameters to be chosen later, and let ( ) be a family of fully independent random hash functions such that : → {0, 1} is 1 with probability /2 , while : → [− , ] is a fully independent random hash function that is uniform on [− , ]. 6Fix an arrival order for the edges of the directed graph.For any vertex and edge , let out,≤ , ≤ , refer to the out-degree and degree of when only and edges that arrive before are counted, and let out,> , > refer to these quantities when counting only edges that arrive after .Let be the largest such that < ≤ .Then de ne ≤ = , and let out,≤ be the number of edges ′ with head that arrive before and have ( ′ ) = 1, multiplied by 2 / .We will then de ne the -pseudobias of , , as In other words, the is the bias of when its degree among and edges that arrive before is rounded to the bottom of the interval [ , +1 ), and its out-degree among these edges is estimated using the number of out-edges "sampled" by , with a small amount of noise ( ) added.Since this can sometimes produce a pseudobias larger than 1, we then cap it at 1.
De nition 6.Let t ∈ [−1, 1] ℓ be a vector of bias thresholds.The pseudosnapshot PsSnap ∈ N ℓ ×ℓ of = ( , ) is given by: where is the th " -pseudobias" class, given by The restriction of PsSnap to ′ ⊆ is then given by:

Closeness to Snapshot
In this section we show that the snapshot and pseudosnapshot of a graph are close enough to each other for the purpose of approximating Max-DiCut.We will assume throughout that the snapshot and pseudosnapshot are de ned relative to the same vector of bias thresholds t.We will refer to the intervals ([t , t )) ∈ [ℓ −1] and [t ℓ , 1) as "bias intervals".
We start by showing that, with good enough probability, most of the edges incident to any vertex will give a pseudobias in the same interval, and that pseudobias will not be too far from the true bias.
Lemma 7.For each ∈ , with probability 1 − O 2 − − O( 6) over the hash functions ( ) and , is in the same bias interval for all but of the edges incident to , and all of these are within O( ) of .Moreover, these events depend only on ( ) and ( ) for edges with head .
Proof.As there are only constantly many bias intervals, we may without loss of generality assume that is smaller than half the distance between the boundaries of any bias interval.Then for every ∈ , with probability 1 − O 2 over ( ), + ( ) is at least 3 away from the boundary of any bias interval, for > 0 a constant to be chosen later.It will therefore su ce for | − − ( )| < 3 to hold for all but of the edges incident to .
First note that, by the de nition of the , ≤ ∈ ≤ 1+ 3 , ≤ for all .So we only need to bound out,≤ .
We will ignore the rst edges to arrive incident to .For the edges arriving after this, ≤ passes through only ).It will su ce to show that, for each such interval, out,≤ ∈ ((1 − 3 ) out,≤ , (1 + 3 ) out,≤ ) for the th to arrive incident to (as out,≤ only increases, and out,≤ only changes by a (1 + 3 ) multiplicative factor in this interval).
So x such an .Then out,≤ is 2 / times the number of edges ′ that arrive before (including ) and have and so by the Cherno bounds it is within 3 out,≤ of out,≤ with probability 6) and by taking a union bound over the O 1 3 log 1 intervals, we have that, with probability 1 − − O( 6) over ( ) , ≤ and out,≤ are (1 + O 3 ) multiplicative approximations of ≤ and out,≤ , respectively, and so for all incident to after the rst to arrive.The lemma therefore holds if we choose to be a large enough constant.□ This allows us to show that, with only small edits to , we can change the bias of vertices in in such a way that the pseudosnapshot becomes an approximately accurate snapshot.Proof.Let ′ be the set of all vertices for which the event described in Lemma 7 occurs.The vertex set of ′ will be ′ ∪ {⊥}, where ⊥ is a newly introduced dummy vertex.We will construct ′ by rst removing all vertices in \ ′ from , and replacing the edges between them and ′ with corresponding edges between ⊥ and ′ .
Then, for each vertex ∈ ′ , we will add O( ) edges between and ⊥, choosing the orientation of these edges so that the bias of in ′ is in the same bias interval as for all but of the edges incident to .
′ di ers from in at most edges.So by Markov's inequality, as each edge is in \ ′ with probability at most Moreover, by Lemma 7 all but of the edges counted in the pseudosnapshot of had endpoints whose pseudobiases were in the same bias intervals as the biases of the corresponding vertices in ′ .Furthermore, there are only ∈ \ ′ + ∈ ′ O( ) edges in ′ that were not counted in the pseudosnapshot of -those added to replace edges between ′ , and those added to correct the biases of edges in ′ .So again by Markov, the pseudosnapshot of is a O( )-accurate snapshot for ′ with probability at least 1 − O( ) − − O( 6 ) .□

Reduction from Max-DiCut
Now, we can show that the pseudosnapshot gives a good Max-DiCut estimate, by using the fact that the ′ constructed in the previous section has a similar Max-DiCut value to .
Lemma 9. Let , ℓ, t, r be as in Lemma 5. Then there exists a constant > 0 such that and .
Proof.Suppose the probability 1 − O( ) − − O( 6 ) event of Lemma 8 holds.Then there exists a graph ′ that di ers from in only edges such that and so which by Lemma 5 implies that As ′ only di ers from in O( ) edges, and so the result follows by setting to be a large enough constant that r † PsSnap (1 ℓ − r) − ≤ Max-DiCut( ).
Each entry of the estimate has bias at most the number of edges − → such that: The algorithm will maintain a superposition where ′ ≤ = 3 for some su ciently large constant .′ will start at and decrease as measurements remove states from the superposition.
A key primitive for maintaining this state will be "swapping", in which we execute the unitary that swaps two named basis states while leaving the rest of the Hilbert space unchanged.will be our "scratch states".It is equal to where starts at 1 and is incremented every time we use a scratch state (by swapping it with some other state we want), and the last register indicates that this is a scratch state.The algorithm will keep track of so that it knows which state to swap from.
The remaining vectors encode information about vertices and their degrees.For E = A, B, C, D, each takes the form where the sets = , , , are not explicitly stored by the algorithm but are updated by updating the superposition, and = , , , marks which of A , B , C , D a state belongs to, for ∈ [2 2 ].Note that the underlying set for each E does not depend on -the 2 2 copies are to allow us to perform a larger set of measurements, and the states will remain identical until the algorithm terminates.The four non-scratch components are broken into two pairs (as each vertex can be both a head and a tail, and the two cases need to be handled separately), with each pair having an element for checking whether degrees are high enough, and one for checking whether degrees are low enough (both will track whether vertices have had enough edges coming out of them that pass the hash functions).
• A are for tracking vertices with degree at least .• B are for tracking when those vertices have their degree exceed +1 .
• C are for tracking vertices with degree at least .
• D are for tracking when those vertices have their degree exceed +1 .
At the start of the execution of our algorithm, , , , = ∅.They will be updated with the following three operations: • inc(E, , ) replaces with { + : ∈ } ∪ [ ], and replaces with + 2 2 .Note that this can be accomplished with a single unitary transformation, by sending | ⟩ to | ( + ) ⟩ for each , , and then swapping the rst 2 2 remaining elements of S with =1 | ⟩ for each ∈ [2 2 ]. • measure( , ) measures the superposition with projectors onto the following vectors for each ( , ) ∈ [ ] 2 , and ∈ {0, 1}, along with a projection onto the complement of the space spanned by the projectors.
Where the , , , are chosen so that these vectors are all orthogonal to one another across all , , (note that this is possible because we have 2 possible values to choose from).If the result of this measurement is anything other than the complementary projection, the quantum part of the algorithm will terminate and the remaining execution will be entirely classical.], and = , , along with a projector onto the complement of the space they span.If anything other than the complementary projector is returned, the algorithm halts entirely and outputs a zero estimate for the pseudosnapshot.Together, the e ect of performing measure( , ) and then cleanup( , ), if they do not return something other than the complementary projectors, is to delete the following elements from , , , , for = , and for all ∈ [ ] (note that these elements may have not been present to begin with, or may be "removed" multiple times between the two operations-this does not cause any issues): We can now describe the algorithm.
(4) measure( , ).If the measurement returns | , , ⟩, pass it along with , to the classical stage and continue.( 5) cleanup( , ).If the measurement returns anything other than the projector onto the complement of the cleanup vectors, immediately terminate the algorithm, outputting an all-zeroes estimate.
If the quantum stage processes every edge without being terminated by a measurement outcome, output an all-zeroes estimate and skip the classical stage.
Classical Stage.For the remainder of the stream, track out,> , out,> , > , > (giving us exact values for these variables).Then estimate ≤ , ≤ by assuming that they are equal to , , respectively.Then estimate out,≤ , out,≤ , by assuming that the number of edges with head and ( ) = 1 is − 1, and the number with head and ( ) = 1 is − 1.

State Invariant.
Lemma 11.Consider any time after some number of edges have been (completely) processed in the quantum stage, and suppose the state has not yet terminated, and has not exceeded .Let ∈ , and let be the number of those edges that were incident to .Let be the number of those edges such that was the head of the edge, and ( ) = 1.
and if > 0, there exists ( ) =1 ∈ [ ] such that: The same relationship holds for and , except with instead of .
Proof.This proof is deferred to the full manuscript [15].□ 6.2.2 Measurement Outcomes.In this section we characterize the expected e ect on the pseudosnapshot estimate from all of the measurement outcomes that can terminate the quantum stage of the algorithm: those other than the residual projector in measure and cleanup.
Lemma 12.For all , , cleanup( , ) contributes 0 to the expectation of every individual entry of the pseudosnapshot estimate.
Proof.This follows immediately from the fact that we do not modify the estimate when the algorithm terminates due to cleanup.□ In order to analyze the expectation of the estimate output by the algorithm, we will need the following lemma about the probability of the algorithm terminating before a certain point.Note that for any stream of edges, the sequence of measurements performed by the algorithm is deterministic, except that the sequence may be terminated early depending on the measurement results.
Lemma 13.For any ∈ N, let be the probability that the algorithm terminates in the rst measurements performed by the algorithm.Then, if the algorithm does not terminate, the value of ′ after these measurements is (1 − ) .
Proof.We will analyze the expectation conditional on the algorithm not terminating before − → arrives.As the expected contribution is trivially 0 conditional on the algorithm terminating before − → arrives, this will su ce for the result.
We have that at least one of ≤ − → < for some ( , ) ∈ {( , ), ( , )} or ≤ − → ≥ +1 for some ( , ) ∈ {( , ), ( , )}.Therefore, by Lemma 11 The employee owns all right, title and interest in and to the article and is solely responsible for its contents.The United States Government retains and the publisher, by accepting the article for publication, acknowledges that the United States Government retains a non-exclusive, paid-up, irrevocable, world-wide license to publish or reproduce the published form of this article or allow others to do so, for United States Government purposes.The DOE will provide public access to these results of federally sponsored research in accordance with the DOE Public Access Plan https://www.energy.gov/downloads/doe-public-access-plan.
Bob's graph that has the degree of in Bob's graph at most / and the degree of in Bob's graph at most / .The notation − → denotes the index of edge − → in a xed ordering of outedges of , and − → denotes the index of edge − → in a xed ordering of in-edges of .Now the measurement operators are orthogonal again.Similarly to the previous case, | − → ⟩ + | − → ⟩ will be the measurement outcome with probability 2/(| | + | |) if ∈ and ∈ , and | − → ⟩ ± | − → ⟩ are equally likely otherwise.So Bob can use this measurement to estimate how many of his edges go from to , we will encode seeing an edge − → by sending | ℎ⟩ → | ( + ′ )ℎ⟩ and | ⟩ → | ( + ′ ) ⟩, and then swapping out ′ + ′ scratch states for | 1ℎ⟩ . . .| ′ ℎ⟩ and | 1 ⟩ . . .| ′ ⟩.

Lemma 8 .
With probability 1 − O( ) − − O( 6 ) over ( ) ⌊log 1+ 3 ⌋ =0 and , there exists a graph ′ di ering from in O( ) edges such that any O( )-accurate estimate of the pseudosnapshot of is a O( )-accurate estimate of the snapshot of ′ .