{'fraction_non_alphanumeric': 0.03151227007204047, 'fraction_numerical': 0.007682384148197539, 'mean_word_length': 4.320428780751137, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Parallelizing Quantum Circuits

We present a novel automated technique for parallelizing quantum circuits via forward and backward translation to measurement-based quantum computing patterns and analyze the trade off in terms of depth and space complexity. As a result we distinguish a class of polynomial depth circuits that can be parallelized to logarithmic depth while adding only polynomial many auxiliary qubits. In particular, we provide for the first time a full characterization of patterns with flow of arbitrary depth, based on the notion of influencing paths and a simple rewriting system on the angles of the measurement. Our method leads to insightful knowledge for constructing parallel circuits and as applications, we demonstrate several constant and logarithmic depth circuits. Furthermore, we prove a logarithmic separation in terms of quantum depth between the quantum circuit model and the measurement-based model.


Introduction and summary of results
We present a construction for the parallelization of quantum circuits. Our method gives a formula that computes the exact decrease in depth that the construction can achieve. This yields precious insight for the construction of lower-depth quantum circuits.
The development of parallel quantum circuits seems almost essential if we wish to implement quantum algorithms in the near future with the available technology. Due to decoherence, qubits have a tendency to spontaneously change their state, hence we can only operate on them for a very short period of time. Parallel circuits could maximize the use of these fragile qubits. Note that to obtain parallelism in the quantum circuit model, we need the ability of interaction with further apart qubits. Different implementations might put physical limitations on how far we can apply this ability. However, in some recent proposals for quantum computing [1,2,3,4,5,6,7] due to the construction of the models, the far apart interaction between qubits have been successfully demonstrated.
As for theoretical motivation, the study of parallel quantum algorithms could lead to new results in complexity theory. For instance, one interesting open question is whether the class of decision problems solvable in polynomial time, P, is included in the class of decision problems solvable in polylogarithmic depth, NC. Let QNC be the class of decision problems solvable in polylogarithmic depth with a quantum computer, one can ask similarly whether P is included in QNC. Finally, Richard Jozsa conjectured that: Jozsa Conjecture. [

8] Any polynomial-time quantum algorithm can be implemented with only O(log(n)) quantum layers interspersed with polynomial-time classical computations.
Previous results on parallel quantum circuits include the parallelization of circuits for the semiclassical quantum Fourier transform [9], approximate quantum Fourier transform [10], as well as for encoding and decoding quantum error-correcting codes [11]. These constructions usually require the use of auxiliary qubits. The depth complexity of quantum circuits has also been studied in [12,13].
Our results on parallelizing quantum circuits (Theorem 8.7) are obtained using the recently proposed formalism of the measurement-based model for quantum computation (MBQC) [8,14,15,16], an approach to quantum computing that uses measurement as its main ingredient. A computation in MBQC is usually referred to as a pattern and consists of a round of global operations (two-qubit gates) to create the required initial multi-qubit entanglement, followed by a sequence of classically controlled local operators (single qubit measurements and unitaries). A more formal definition is given later. We will work in particular within an algebraic framework for MBQC called the measurement calculus [17]. This novel framework is universal and equivalent in computational power to the quantum circuit model. 1 Previous results on the parallelization in the MBQC include constant-depth patterns for Clifford unitaries [18] and diagonal unitaries [16].
The measurement calculus framework clearly distinguishes between the quantum and classical depths of a pattern. Informally speaking, the quantum depth of a pattern is the length of the longest sequence of dependent commands. The classical depth is the depth of the classical computation required for the evaluation of the dependency function of each dependent command. We consider two transformations that we can apply to patterns without changing their meaning (the underlying operator that they implement) while never increasing their depth (and possibly decreasing it): standardization (Theorem 4.1) and signal shifting (Theorem 5.1). Standardization is a rewriting system for MBQC patterns that pushes all the entanglement operators to the beginning of the computation, followed by a sequence of the single-qubit measurements and a final round of local unitaries. Signal shifting is another rewriting system that translates some of the quantum depth between measurement operators to classical depth between the final local unitaries and hence decreases the quantum depth.
We then develop a method to compute an upper bound on the quantum depth of a pattern. In order to do so, we use the notion of flow [19], a graph theoretical tool defined over the underlying geometry of the initial entanglement state of a pattern. We further define a construction called an influencing path, that allows us to characterize the dependency structure of the pattern. It is known that a particular set of measurements called Pauli measurements can be performed independently as the first layer of measurements [14]. Combining this fact about the angles of the measurement with influencing paths and the signal shifting procedure, we present an upper bound result on the quantum depth (Proposition 6.4). As for the classical depth, it is known to be at most logarithmic in the size of the pattern [8]. We give some tighter upper bounds based on the underlying geometry in Section 6.1.
Our ultimate goal is to decrease the depth of a given circuit, to this end we present an automated procedure for the translation of a circuit (with g gates) to an MBQC pattern by adding only up to g extra auxiliary qubits. Performing standardization and signal shifting over the obtained pattern might decrease the depth, and we then translate back the obtained low depth pattern to another circuit, equivalent to the original circuit but with lower quantum depth and more auxiliary qubits. This final translation is based on performing coherent measurements, and therefore the new circuit will have a depth equal to the combined quantum and classical depths of the pattern. Note that since classical computation is cheaper than quantum computation, one might consider MBQC as a favourable ultimate architecture for a quantum computer as it keeps the quantum and classical depth separate. However, this translation forward and backward to MBQC is interesting from the theoretical point of view as one can parallelize a circuit automatically and moreover due to the simplicity of the translation procedure the pattern depth characterization of Theorem 8.3 leads to a general parallelization result for circuits, Theorem 8.7.
As already noted, the depth of a pattern is due to the adaptive measurements and corrections: any given qubit has a fixed set of measurement outcomes that must be known before a measurement or a correction command can be performed at that qubit. This set of measurement dependencies is sometimes called the backward cone [18]. One way of interpreting our main result given by Theorem 8.3 is that we characterize the backward cone of any qubit; thus for patterns with flow, we are able to give a method to easily compute the depth. Moreover our characterization result is constructive and leads to a novel technique for constructing parallel patterns and parallel circuits.
In order to demonstrate the power of Theorems 8.3 and 8.7, we present some special cases: depth 2 patterns (Proposition 8.4) and depth 2 circuits (Proposition 8.8). Another application of our results is Proposition 8.9, where we show that any polynomial-size circuit with only Clifford gates can be parallelized to a logarithmic depth circuit, using a polynomial number of auxiliary qubits. Using the example of parity, we also show a logarithmic separation in terms of quantum depth between the circuit model and the MBQC. Finally, we show how our method can be used to parallelize a family of polynomial-depth circuits to equivalent logarithmic depth circuits.
The paper is organized as follows. In Section 2, we briefly review the MBQC in order to fix the relevant notation (a more thorough introduction to quantum computing and MBQC are available in appendices A and B). In Section 3, we define the notion of depth for a pattern in the MBQC, carefully distinguishing between the preparation, quantum and classical computation depths. In Section 4, we show that standardization decreases depth and in Section 5, we show that signal shifting also decreases depth. In Section 6, we give upper bounds on the depth of a pattern based on its geometry. In Section 7, we give a translation from the quantum circuit model to the measurement-based model and back. Our main results on characterization of depth for MBQC patterns and quantum circuits are given in Section 8, where we also present several applications.

Quantum circuit model
Historically, Richard Feynman was one of the first to suggest that a computer based on the principles of quantum mechanics could efficiently simulate other quantum systems [20]. David Deutsch then developed the idea that the quantum computer could offer a computational advantage compared to the classical computer; he also defined the quantum Turing machine [21], before defining the quantum circuit model [22] to represent quantum computations (Deutsch refers to a quantum circuit as a quantum network ). It is readily seen that the quantum circuit model is a generalization of the classical circuit model. Any unitary operation U can be approximated with a circuit C, using gates in a fixed universal set of gates (see Appendix A or [23] for an introduction to quantum computing). The size of a circuit is the number of gates and its depth is the largest number of gates on any input-output path. Equivalently, the depth is the number of layers that are required for the parallel execution of the circuit, where a qubit can be involved in at most one interaction per layer. In this paper, we adopt the model according to which at any given timestep, a single qubit can be involved in at most one interaction. This differs from the concurrency viewpoint, according to which all interactions for commuting operations can be done simultaneously.
where, S t i is the signal shifting command (adding t to s i ) and s[t/s i ] denotes the substitution of s i with t in s.
Dependent commands are essential for universality and the control of the non-determinism induced by measurements. The following notions are beneficial for the study of dependency structures of patterns. A geometry (G, I, O) consists of an undirected graph G together with two subsets of nodes I and O, called inputs and outputs. We write V for the set of nodes in G, I c , and O c for the complements of I and O in V and E G := (i,j)∈G E ij for the global entanglement operator associated to G (the graph G is also called the entanglement graph [24]). Trivially, any pattern has a unique underlying geometry, obtained by forgetting measurements and corrections commands.
We now give a condition on geometries under which it is possible to synthesize a set of dependent corrections such that the obtained pattern is uniformly and strongly deterministic, i.e. all the branches of the computation are equal, independent of the angles of the measurements (see Appendix B for more precise definitions). Hence we obtain the dependency structure of measurement commands directly from the geometry, from which we will get a unified treatment of depth complexity for measurement patterns. In what follows, x ∼ y denotes that x is adjacent to y in G, N I c denotes the sequence of preparation commands i∈I c N i .
(ii) x f (x); (iii) for all y ∼ f (x), x y . Figure 1 shows a geometry together with a flow, where f is represented by arcs from O c (measured qubits, black vertices) to I c (prepared qubits, non boxed vertices). The associated partial order is given by the labelled sets of vertices. The coarsest order for which (f, ) is a flow is called the dependency order induced by f and its depth (4 in Figure 1) is called flow depth. 19]). Suppose the geometry (G, I, O) has flow f , then the pattern: where the product follows the dependency order of f , is uniformly and strongly deterministic, and realizes the unitary embedding: The Flow Theorem (Theorem 2.2) plays an important role in our discussion of depth complexity in the following sections. If the underlying geometry of a pattern has flow and pattern commands sequence is constructed as given by the Flow Theorem, we call this pattern a pattern with flow. Note that the Flow Theorem tells us how to perform dependent corrections according to the flow function f : when qubit i is measured, its neighbour according to the flow, f (i), receives the X s i f (i) correction, while all the neighbours k of f (i) (independently of the flow and except i), receive a Z s i k correction. We can apply the rewrite rules of equations (3) and (4) to propagate these dependent corrections to the end and obtain a standard form for the pattern with flow: where f −1 (i) is well defined since by construction f is an one-to-one function. If f −1 (i) is empty we ignore the term s f −1 (i) , that means the measurement at qubit i has no X-dependency. Given a geometry on n vertices with |I| = |O|, one can efficiently i.e. in O(poly(n))) time, find its unique flow if it exists [25,26] and the obtained pattern implements a unitary operator.

Depth complexity for measurement patterns
In this section, we give a definition for the preparation depth and give its exact value. We also give a definition for the quantum computation depth of a pattern. Another type of depth exists for a pattern, this is the classical depth and will be addressed in Section 6.1.
First, we focus on the notion of depth complexity for a standard pattern, which we then extend to wild patterns. There are two parts of a standard pattern computation that contribute to its depth: the preparation phase, which is the work required to prepare the entangled state (the N and E commands), and the quantum computation phase, which is the work required to perform the measurements and corrections (the adaptive M and C parts). The total depth of a pattern in standard form is the sum of the depths of the preparation and computation parts, which we address now separately.

Preparation depth
As already mentioned, for any pattern P with computational space (V, I, O) one can associate an underlying geometry (G, I, O) defined by forgetting the measurement and correction commands. The entangled state corresponding to this geometry is defined by preparing the input qubits in the given arbitrary states and all other qubits in the |+ state and applying a ∧Z on all qubits i and j that are adjacent in the entanglement graph G. We give below an exact value for this depth, in terms of ∆(G), the maximum degree of G. A similar result also appeared in [27].
Lemma 3.1. The preparation depth for a given entanglement graph G, is either ∆(G) or ∆(G)+1.
Proof. At each timestep, a given qubit can interact with at most one other qubit. In terms of the entanglement graph, this means that at each timestep, a given node can interact with at most one of its neighbours. Assign a colour to each timestep and colour the edge in the entanglement graph G accordingly. With this view, the entire preparation corresponds to an edge colouring of the entanglement graph. By Vizing's theorem [28], the edge-chromatic number of G, χ ′ (G) satisfies It is known that a special type of entanglement graph, the two-dimensional grid (called cluster state), is universal for the measurement-based model. The cluster state is a bipartite graph and hence by König's theorem [28], its edge-chromatic number is ∆(G), hence from the above Lemma we conclude that any unitary can be implemented with a cluster state that can be prepared in depth 4. This however, might force the use of extra auxiliary qubits. The precise tradeoff will be given in Section 7 where we deal with the translation between the circuit model and measurement-based model to reduce depth.

Quantum computation depth
The quantum computation depth of a pattern, or just quantum depth for short is the depth in the execution of the pattern that is due to the dependencies of measurement and correction commands on previous measurement results (this is also called the causality depth). Given a pattern in standard form, it is easy to calculate its quantum computation depth from its execution digraph given below. 2. Draw an arc from i to j whenever X s j or Z s j appears in the pattern, with i in the domain of s.
We refer to the nodes of in-degree zero in R as start nodes. Similarly, the nodes of out-degree zero in R are called end nodes. If there is an arc from i to j in the execution digraph, we say that j depends (or has a dependency) on i. As a consequence of the definiteness condition (see Appendix B), the graph of any pattern is acyclic and hence we can give the following definition for the quantum computation depth:  Figure 2: The execution digraph for the standard pattern of Equation (10). A white double arrowed arc represents an X-dependency, and a black arrowed arc a Z-dependency. The X-dependency arcs correspond to edges of the underlying geometry, however this is not the case for the Z-dependency arcs.
Definition 3.3. Let P be a pattern in standard form. The quantum computation depth for P is the number of vertices on the longest directed path between a start and end node in the execution digraph. We call such a longest path a critical path.
As an example, consider again the geometry given in Figure 1, one can write a uniformly and strongly deterministic pattern on this geometry using the Flow Theorem that can be rewritten in the following standard form: where G is the entanglement graph corresponding to the geometry of Figure 1. Following Definition 3.2, the execution digraph for the above pattern is given in Figure 2. As said before (see also Appendix B, equations (19) and (20)), there are two types of dependent measurements defined by X and Z-dependencies, that are represented with different arrows in Figure 2. The longest path in the execution graph is abdg, hence from Definition 3.3, the pattern depth is 4. It is trivial that for standard patterns with flow, the quantum computation depth is the same as the flow depth. However for wild patterns, the quantum computation depth cannot be dissociated from the preparation depth (the E commands being interspersed within the pattern). In order to define this combined preparation and quantum depth, we define the execution digraph in a similar way as Definition 3.2, but we add the E commands to the execution digraph. Then the depth of a wild pattern is the longest path in the execution digraph except that we allow a sequence of E commands to be parallelized, the depth of such a sequence being given by the results of Section 3.1.

Standardization reduces depth
In this Section, we refer to the combined preparation and quantum depth of a pattern as its depth. Intuitively, we would expect that standardization could only potentially decrease this depth. This is because by standardizing, we benefit from the fact that there is a single entanglement graph to consider. Also, corrections are propagated to the end and applied only on output qubits, hence potentially fewer operations are needed. On the other hand, standardization creates dependent measurements. The following theorem (which is general and independent of the flow construction) confirms all these observations. Let P ⇒ ⋆ P ′ denote the fact that P ′ is obtained from P by applying a finite sequence of rewrite rules given by equations (1)-(4). Theorem 4.1. Whenever P ⇒ ⋆ P ′ where P ′ is in standard form, the depth of P ′ is less than or equal to the depth of P.
Proof. First, we apply the free commutation rules on those commands operating on disjoint sets of qubits (see Appendix B) to P to obtain P * as a sequence of standard patterns. The depth as defined by the execution digraph is not affected by this procedure, and P * depth is actually the sum of the depths of its standard parts. Thus it is sufficient to show that standardization of a wild pattern P, containing two parts in standard form, say P = C 2 M 2 E 2 C 1 M 1 E 1 (where some or all of the parts may be empty), does not increase its depth. The theorem then follows by induction.
Step 1. (The E's) We show how the re-writing rules are used to bring the pattern and that by doing so, the depth of P ′ is no greater than that of P. The result holds trivially, if E 2 is empty. Otherwise, for every command E ij ∈ E 2 , commute it to the right-hand side of the pattern by doing the following: 1. If C 1 contains Z i or Z j corrections, but no X i or X j corrections, we apply the rewriting rule E ij Z s i ⇒ Z s i E ij and hence the depth does not increase. We then complete the commutation by applying the free commutation rules.
Here, the command X s i has an s dependency, which obviously cannot contain i or j, since these qubits haven't been measured yet. Since X s i and Z s i do not depend on each other, the addition of the extra correction does not contribute to the depth.We then complete the commutation by applying the free commutation rules.
Finally, consider the entanglement graph for , clearly, the preparation depth for E 1 ∪ E 1 cannot be any greater than the depth of preparation for E 1 plus E 2 . Also, as an extra bonus, since E ij is self-inverse, if E 1 and E 2 happen to have common commands, they will cancel out.
Step 2. (The M 's) We will show how the free commutation rules and the re-writing rules are used to bring the pattern and that doing so, the depth of P ′′ is no greater than that of P ′ .

Consider a command t [M α
i ] s ∈ M 2 . If C 1 ′ does not contain any commands acting on qubit i, s to the right-hand side of C 1 ′ , and clearly the sum of the depths of the patterns C 2 M 2 and C 1 ′ M 1 E 2 E 1 is greater than or equal to the depth of the pattern 2. Otherwise, we apply the rewrite rules of equations (3) and (4). In the execution digraph, both of these rules correspond to an edge contraction 2 . The depth of the execution digraph obviously does not increase by contracting any of its edges. Hence, after the applicable edge contractions, we can commute the commands as above, yielding a pattern of smaller or equal depth. Theorem 4.1 shows us that in order to improve the parallel run-time of the pattern, we should implement the standard form of the pattern. We also know that standardization can be performed in polynomial time [17]. Thus in the remainder of the paper, we will only consider standard patterns, which also allows us to consider the preparation depth separately from the quantum computation depth. Combined with Theorem 5.1 of the next section, we note that the most efficient form for the implementation of a pattern is also the signal-shifted form.

Signal shifting reduces depth
The signal shifting rules (Equations (5)-(8)) tell us how we can push the Z dependencies of a pattern all the way to the end, which can then decrease the quantum depth of a pattern in standard form. We first present an example and then prove the result, which is also general and independent of the flow construction.
Example. Consider the standard pattern given in Equation (10). After, signal shifting, we obtain the following equivalent pattern: where boxes represent terms to be rewritten. Now in the new execution digraph ( Figure 3) the longest path has only three vertices, hence signal shifting has decreased the depth by one.
The following theorem states that, in general, signal shifting does not increase the depth of a standard pattern. As we have seen above, it can sometimes decrease it. Proof. Let P be a pattern in standard form and suppose that P includes a command t [M α i ] s which generates the signal shifting command S t i . Let P ′ be the pattern that corresponds to the pattern after the signal S t i has been shifted. Let D be the execution digraph for P and let D ′ be the execution digraph for P ′ . We want to show that the length of a critical path of D ′ is no greater than the length of a critical path of D.
Suppose that the domain of s in t [M α i ] s is s 1 , s 2 , . . . , s n and that the domain of t is t 1 , t 2 , . . . , t m . Consider all the commands that appear after t [M α i ] s in P and that have an i dependency; denote these commands C i a 1 , C i a 2 , . . . , C i a k (these are either corrections or measurements). We will show that the depth does not increase when we shift the signal S t i passed all the C i a 's. Consider the arcs in D that represent the dependencies between the measurement t [M α i ] s and measurements of qubits t 1 , t 2 , . . . , t m ; these are the arcs t j i (for j = 1 . . . m) and we will call these the old arcs. So the old arcs represent Z-dependencies for the t [M α i ] s measurement. These are precisely those that create signal shifting commands, . Now consider the arcs in D ′ that represent the dependencies between the measurement of qubit t j , M t j (j = 1 . . . m) and the measurements and corrections that have an i dependency, C i ax (x = 1 . . . k). We call these arcs new arcs since they represent the new dependencies created by S t 1 i , S t 2 i , . . . , S tn i by the signal shifting rules given in equations (5)-(8). Indeed, when we apply signal shifting to P, we get rid of all the dependencies represented by old arcs, yet we add all the dependencies represented by new arcs. These are the only differences between the execution digraphs D and D ′ .
If all new arcs are already in D (this could be the case if all the dependencies were present before signal shifting), the graph D ′ cannot have a longer critical path than D and we are done. Otherwise, suppose for a contradiction that the length of a critical path in D ′ is greater than the length of a critical path in D. Since D ′ differs from D only by the removal of all the old arcs and the addition of all the new arcs, the only way for D ′ to have a longer critical path than D would be for this critical path to include a new arc, say t j a k (obviously, the removal of the old arcs in D ′ cannot contribute to a longer critical path.) But if such a critical path exists in D ′ , then D admits a longer critical path, namely the same critical path in D ′ , but with arcs t j i and ia k instead of arc t j a k . This contradiction proves our claim.
There is a tradeoff when we perform signal shifting, as it can increase the classical depth. However, as we will show later, the classical depth is at most O(log(n)) at each layer, where n is the number of measured qubits (Proposition 6.6) and hence the tradeoff is beneficial, especially from the point of view that classical computation is cheap and reliable, compared to quantum computation that is expensive, error-prone and subject to decoherence.

Flow and pattern depth
While the results of Sections 4 and 5 deal with the depth of any pattern, we now focus our attention on the depth of patterns with flow. The flow condition is sufficient but not necessary for determinism [29], however the class of patterns with flow is still an interesting class of patterns, as it is universal for quantum computing, closed under composition and more importantly our translation from circuits to patterns in Section 7 always yields a pattern with flow. For the rest of the paper we consider only patterns with flow.
It is known that for patterns with flow and equal input and output number of qubits, i.e. those implementing a unitary operator, the flow, if it exists, is unique [25]. From this, we obtain an upper bound on the quantum computation depth directly from the underlying geometry. We first define an important notion of influencing paths for geometries. Proof. This is a consequence of the Flow Theorem. Recall that before signal shifting, a measurement at a qubit j is X-dependent on the result of a measurement at another qubit i if and only if j = f (i) that is, a flow edge between qubits i and j. Also a measurement at a qubit k is Z-dependent on the result of a measurement at another qubit i if and only if j = f (i) and k is connected to j, that is a non-flow edge between qubits j and k connected to a flow edge between qubits i and j. Therefore signal shifting creates new dependencies only through influencing paths. Hence if qubit b depends on qubit a, it is either via a direct X or Z dependency or due to a sequence of dependencies after signal shifting, in all the cases a and b must be on a common influencing path.
Proposition 6.2 tells us that in order to compute the quantum depth of a standard pattern with flow (to which we either have or haven't applied signal shifting), it suffices to consider the depth along influencing paths. Note that after signal shifting, Z-dependencies coming from the non-flow edges on an influencing path no longer contribute to the pattern depth, as the dependencies that they represent are pushed to the final correction on an output qubit. On the other hand, signal shifting can create new X-dependencies. The following proposition presents an upper bound on the effect of signal shifting on the pattern depth. Proof. We show that for any influencing path, its number of flow edges minus the non-flow edges gives an upper bound on its depth. Then, by Proposition 6.2, it suffices to find the largest number of flow edges along any influencing path in order to have an upper bound on the depth. We add 1 to this depth since the depth is the number of vertices of such path, and not the number of edges.
Consider an influencing path I. The flow edges represent X-dependencies hence each flow edge in a sequence of consecutive flow edges contributes to the depth along I. Now, consider a configuration with a non-flow edge as shown in Figure 4. Before signal shifting, the dependent measurements on qubits i,j, k and ℓ are given as follows (see Equation (9)) where A, B and C stand for general signals not including s i , s j , s k and s ℓ and after signal shifting we have Therefore qubits j and ℓ are in the same layer. In other words, after signal shifting, the first flow edge after every non-flow edge does not contribute to the depth of the pattern. Also, any new Xdependency created with signal shifting will not increase the depth. Hence from the total number of the flow edges on an influencing path we need to subtract the number of non-flow edges.
So far we have not taken into account the information about the angles, which is why our bounds are not tight. We first describe the effect of the Pauli measurements on depth. The following identities are useful According to Equation (11), when a qubit i is measured with angle π 2 (Pauli Y measurement), then any X-dependency on this qubit is the same as a Z-dependency. But after signal shifting, this Z-dependency does not directly contribute to the depth and hence we might obtain a smaller depth. Furthermore, there exists a special case where if qubit i is not an input qubit and also not the flow image of any other vertex (∀j : i = f (j)) and qubit i is measured with π 2 , then one can permit in the Flow Theorem, to have f (i) = i and hence we will have one less flow edge [19]. This allows an influencing path to have a loop edge on this particular vertex measured with Pauli Y and hence the influencing path will not start with an input qubit. In the rest of the paper, we consider only this extended notion of influencing path that takes into account the angles of measurement. When we want to emphasize this extended definition, we will refer to Pauli influencing paths.
According to Equation (12), another special case is when qubit i is measured with angle 0 (Pauli X measurement), then any X-correction on qubit i can be ignored and in fact qubit i can be put at the first level of measurement. Consequently, again the flow depth can become smaller. By adding equations (11) and (12) to the Flow Theorem, the proof still works [19] and we get a potential improvement on the depth complexity. We refer to this procedure as Pauli simplification. Another way of realizing these special cases is that after signal shifting, the Pauli measurements become independent measurements and hence can all be performed at the first level of the partial order. Hence in computing the depth of a pattern with flow after signal shifting is performed, one should disregard the Pauli measurements: Then the depth of the pattern, call it D P satisfies the following formula: Proof. Along any Pauli influencing path, any flow edge pointing to a qubit to be measured by a Pauli X will not require a separate layer (Equation (12)) and for the Pauli Y case, such a flow edge is converted to a Z-dependency (Equation (11)), to be signal shifted as in Corollary 6.3. Also if the influencing path starts with a Y measurement followed by a non-Pauli measurement, we have a loop edge and hence the immediate following non-Pauli measurement can also be put in the first layer and hence we subtract the loop edge from the total depth for this influencing path.

Classical depth
One issue that has often been overlooked in the literature on MBQC is that computation of the correction exponents as well as the measurement angles contributes to a classical depth [8]. Consider, for example, the case where we have a correction of the form X s 1 +s 2 +···+sn i . An efficient implementation would start by classically calculating the parity of the exponent, and then applying the correction if the parity is 1. This is also the case for a measurement angle such as [M α i ] s 1 +s 2 +···+sn , where one needs to delay the quantum computation to classically compute the measurement angle. Luckily all these classical delays are of at most O(log(n)) depth, since the parity of n bits can be computed by a divide-and-conquer method in depth O(log(n)) (any polynomial-size parity circuit has depth in Ω(log * n) [30]). Such a classical computation cost between quantum layers is negligible, but it still exists. Actually, depending on the underlying geometry of a pattern, this classical processing sometimes requires only constant depth. This can be easily seen for a pattern with flow. Lemma 6.5. Let P be a standard pattern with flow and geometry G, before signal shifting has been performed. The depth of the classical processing required between quantum layers is in O(log ∆(G)).
Proof. From the Flow Theorem, we know that each measurement at qubit i has at most one Xdependency from one of its neighbours in G and the rest of the neighbours of i contribute at most one Z-dependency. Hence the depth for the classical computation required for calculating the measurement angles at qubit i is in O(log(deg(i))). Therefore, at each qubit, the classical depth is in O(log ∆(G)).
Therefore, for a simple geometry such as the cluster state with maximum degree 4, all classical computation is constant. On the other hand, signal shifting which is essential for decreasing the quantum depth, will increase the classical depth. We now present an explicit quantum-classical tradeoff for patterns with flow. But first, we need to define a partial influencing path: let v be a node in geometry G. Then an Iv partial influencing path is a path in G that starts with a flow edge at an input node in I, ends with a flow edge at node v, and contains no consecutive non-flow edges.   Figure 5: A full cluster state geometry where the pyramid shape presents the backward cone, the set of all influencing paths that lead to a qubit. Only vertices on the pyramid contribute to the classical depth complexity of the command to be performed at that qubit.
Proof. In the proof of Lemma 6.5, we saw how the Flow Theorem tells us which dependencies are applied to a qubit v. Once signal shifting has been done, the dependencies are modified, but they still propagate only through influencing paths. In fact for the case of v being a measured qubit, after signal shifting only the X-dependencies remain and therefore we need to consider only the partial influencing paths. Hence there are at most |N v | dependencies at v; the parity of these dependencies can be computed in classical depth O(log|N v |).
Note that N v is upper bounded by the total number of qubits in the pattern. However for a particular geometry and angles of measurement, it can be smaller. For example, consider a pattern with n input qubits and a geometry of a full cluster state of size n times width equal to D, as shown in Figure 5. Then from the above proposition, we conclude that the classical depth is in O(log(D): for any given qubit i only the O(D 2 ) qubits siting on the pyramid with qubit i as the top of the pyramid, will contribute to the depth complexity of the command to be performed at qubit i (see Figure 5). Therefore, for D ∈ O(log(n)), we obtain small classical depth of size O(log(log(n))), whereas the total number of the qubits in the pattern is in O(n log(n)).

Circuits and measurement patterns
Having built all the required tools, we can now turn our attention to the main focus of the paper on parallelizing quantum circuits. To this end we give a method to translate a quantum circuit to a pattern (Section 7.1) and vice-versa (Section 7.2), where standardization, signal shifting and Pauli simplifications on the obtained pattern leads to a more parallel circuit. We also present the exact tradeoff for the transformations. Furthermore, our construction allows us to see influencing paths directly in the quantum circuit so that the pattern depth characterization results given in Section 8 can be directly applied to circuits. We fix the universal family of gates to be U = {∧Z, J(α)}: In [31,32] it was shown that this family is universal for the circuit model since every single qubit unitary operator can be written in terms of J(α): In addition, they lead to simple generating patterns: Hence this family of unitaries is a good choice for translation between circuits and patterns and any other universal family can be replaced by this one with constant overhead. In the rest of the paper, whenever the angle α is not important, we simply refer to a J(α) gate as a J gate.

From circuits to patterns
The original universality proof for MBQC already contained a method to translate a quantum circuit containing arbitrary 1-qubit rotations and control-not gates to a pattern [14]. Here, we give an alternate method for the translation of a given circuit to a standard pattern in the MBQC to attempt to reduce the quantum depth. We give the exact tradeoff in terms of the number of auxiliary qubits and depth.
Recall that ∧Z is self-inverse and symmetric, hence any circuit that contains consecutive ∧Z gates acting on the same qubits can be simplified. In what follows, we suppose that this simplification has been performed. Definition 7.1. Let C be a circuit of ∧Z and J gates on n logical qubits. The corresponding standard pattern P is obtained by replacing each gate in C with its corresponding pattern given by equations (13) and (14), and then performing standardization and signal shifting.
To present the exact tradeoff for the above translation, in particular to prove that the quantum depth cannot increase, we construct directly the underlying geometry of a given circuit. Following the literature, we refer to the circuit qubits as logical qubits. Other qubits that are added during construction of the entanglement graph will be referred to as auxiliary qubits.
Definition 7.2. Let C be a circuit of ∧Z and J gates on n logical qubits. The labelled entanglement graph G C is constructed as a layer that is initially built on top of the circuit C by the following steps (see also the example of Figure 6).  It is easy to verify the following proposition that justifies the above construction. Proof. Standardization does not change the underlying entanglement graph, hence it follows that G C is indeed the entanglement graph for the measurement pattern. By Theorem 10 of [25], for the case that |I| = |O|, a collection of vertex-disjoint I − O paths in G C define its flows. Therefore, input-output paths of vertices sitting on the same wire define the flow of G C .
In order to obtain a full pattern corresponding to the circuit C, one needs to add measurement commands with angles being the same angles of the J(α) gates. These angles are assigned to the qubits labelled Input in Step (1) of the construction of Definition 7.2. The dependency structure is the one obtained from the Flow Theorem.
Proposition 7.4. Let C be a quantum circuit on n logical qubits with only ∧Z and J gates. Let G 2 be the number of J gates and D(n) the circuit depth. The corresponding pattern P given by Definition 7.1 has n + G 2 qubits, G 2 measurement commands, n corrections commands, and depth smaller than or equal to D(n).
Proof. The proof is based on construction of Definition 7.2, which is obtained from replacing the patterns from equations (13) and (14) for J and ∧Z gates and then performing the standardization procedure. It is clear from the construction that we start with n qubits corresponding to each wire, then any ∧Z connects the existing qubits (wires) and hence will not add to the total number of qubits. On the other hand any J gate extends the wire by adding a new qubit. This leads to the total number of n + G 2 qubits for the pattern. There are G 2 measurement commands since all but n qubits are measured. Since C has depth D(n), any influencing path in P has at most D(n) flow edges. Hence the theorem is obtained from Proposition 6.3 after performing signal shifting on the corresponding pattern.
Alternatively, for a given circuit, one can use another construction to obtain a corresponding pattern with cluster geometry, hence to achieve constant depth for the graph preparation stage.
In Out Figure 7: The geometry of the teleportation pattern given in Equation (15) with one input, one auxiliary and one output qubit.
Naturally, the price is to have more qubits. First note that the following pattern implements teleportation from input qubit i to output qubit k that is simply the identity map (see Figure 7): Now, if before Step (2) of the construction of Definition 7.2, we insert the teleportation pattern between any two consecutive ∧Z acting on a common wire, then the degree of each vertex remains less than 4 as desired. We will refer to this graph as the cluster graph, GC C . In order to compute the number of qubits for the pattern obtained from this new construction, consider the positions in the circuit where two ∧Z appear after each other. These are the places where we need to apply the above teleportation pattern to keep the degree less than 4. With this construction, the depth of the pattern does not increase by more than a multiplicative constant. Therefore we have: In what follows, we always assume the cluster geometry for patterns corresponding to a circuit and hence the preparation depth is 4 (Section 3.1).

From patterns to circuits
The construction of Definition 7.2 can be also used in reverse order to transfer a pattern with flow to a corresponding circuit, where all the auxiliary qubits will be removed and hence by doing so the quantum depth might increase. However, we now show how to obtain another transformation from patterns to circuits where one keeps all the auxiliary qubits. This new construction is simply based on the well-known method of coherently implementing a measurement. Recall that a controlledunitary operator where the control qubit is measured in the computational basis {|0 , |1 } can be written as a classical controlled unitary by pushing the measurement before the controlled-unitary operator [9], see Figure 8.
Given a pattern in the standard form, we use the above scheme in the reverse order to convert the classically dependent measurements and corrections, and then push all the independent measurements to the end of the pattern. However since the scheme works only for the computational basis measurement, we have to first simplify all the arbitrary measurements M α . Let Z(α) be the phase gate and H the Hadamard gate (see Appendix B), and let M Z be the computational basis measurement (i.e. Pauli Z measurement). Then we have Additionally, we replace any classical Xand Z-dependencies of measurements and any dependent corrections with a sequence of ∧X and ∧Z, which might creates a quantum depth linear in the number of the dependencies, as shown in Figure 9. However to reduce this linear depth, we can use the following result on parallelizing a circuit with only controlled-Pauli gates to logarithmic depth: Proposition 7.6. ( [11]) Circuits on n qubits consisting of controlled-Pauli gates and the Hadamard gate can be parallelized to a circuit with O(log n) depth and O(n 2 ) auxiliary qubits.
We can now formalize the above translation of patterns to circuits.
is the set of qubits that the measurement of qubit i depends on, and C j is the set of qubits that the correction of qubit j depends on. Note that due to the signal shifting, we only have X dependencies. The corresponding coherent circuit C with |I| logical qubits and |V I| auxiliary qubits, is constructed in the following steps (see also Figure 9):

Apply individual Hadamard gates on all the auxiliary qubits.
2. Apply a sequence of ∧Z gates according to the edges of G.

Replace any dependent measurement
X is a sequence of controlled-not with control qubits in A and target qubit i. Note that since the M Z is independent and can be pushed to the end of the corresponding wire it can be discarded.   Figure 9: Implementing coherently the sequence of dependent measurements in a pattern. An arbitrary measurement M α is represented by a half circle labelled with its angle. The Hadamard and phase gates are shown with square boxes with the labels being H or the angle of the phase gate. The dotted arcs represent X-dependencies. Equation (16) is used to simplify the measurements. After replacing the X-dependencies by ∧X gates, we obtain a quantum depth linear in the number of dependencies.

Replace any dependent correction
Proof. We examine the cost at each step of the construction of Definition 7.7. Steps 1 and 2 add a constant to the depth of C. At step 3, each measurement has as most t dependencies, which, in step 5 translates to O(log t) depth with O(t 2 ) auxiliary qubits. At step 4, each output qubit has at most t dependencies, which again in step 5 translates to O(log t) depth with O(t 2 ) auxiliary qubits. Since the depth of P is d, the total depth of C is in O(d log t), with O(t 3 ) auxiliary qubits.
Note that the logarithmic increase in the depth of C is due to the fact that the circuit model does not exploit any classical dependencies. Thus the classical computation of the measurement angles and corrections in P contributes to the quantum depth in C.
One can combine the forward and backward construction from circuit to patterns to obtain an automated rewriting system for the circuit which can decrease the depth by adding auxiliary qubits. The following theorem gives the tradeoff. Theorem 7.9. Let C be a quantum circuit on n qubits with only ∧Z and J gates. Suppose C has size s and depth D. Assume further that P is the corresponding pattern obtained from the forward translation as in Lemma 7.5 and that P has quantum depth D ′ (we know that D ′ ≤ D). Then circuit C ′ constructed from P by Definition 7.7 has O(s 3 + n) qubits, and depth in O(D ′ log s).
Proof. The first step is to translate C to a pattern P using Lemma 7.5. The resulting pattern P has O(s + n) qubits, and quantum depth in O(D). Then we translate the pattern back to a circuit C ′ using Definition 7.7. By Lemma 7.8, the new circuit has O(s 3 ) auxiliary qubits and depth in O(D ′ log s).
At first glance it seems like applying Theorem 7.9 to a quantum circuit would not necessary be beneficial, since the number of auxiliary qubits and the depth seem to increase. But note that we have given only upper bounds. As we showed in Section 6, taking into account Pauli simplification and signal shifting can give a significant improvement. In the next section, we give a complete depth characterization for patterns with flow, and then show in Section 8.1 a characterization of those circuits to which applying Theorem 7.9 will necessarily decrease the depth. Figure 10: Two non-Pauli measurements separated with the sequence of Pauli measurements of the form (X) odd (Y (X) odd ) * . There is no Z-dependency between the last Pauli X measurement and the first non-Pauli measurement and therefore, after signal shifting, there will be no X-dependency between the non-Pauli measurements.

Depth Characterization
We saw in Section 6 that the main ingredients to obtain a reduced pattern depth are influencing paths, Pauli measurements and signal shifting. In fact, Pauli measurements not only can be performed in the first layer but also they can "reset" the pattern depth along an influencing path. This intuition is formalized in the following lemmas that are essential for our characterization result.
In what follows, we deal with sequences of measurements angles, where N i , N j , . . . represent non-Pauli measurements, X a Pauli X measurement, Y a Pauli Y measurement and P is either X or Y . Furthermore (ω) * and (ω) odd represents respectively, a non-negative and odd number of repetitions of ω.
Lemma 8.1. Let N i and N j denote two non-Pauli measurements on a common influencing path I of a standard pattern with flow. Suppose that N i and N j are separated along I with only flow edges, and that the sequence of measurements between N i and N j along I is a sequence of Pauli measurements of the form: Then after signal shifting, there will be no X-dependency between N i and N j .
Proof. Assume such an X-dependency between N i and N j exists, then it is necessarily due to the fact that during signal shifting, the last Pauli X measurement in the sequence acquires a Zdependency from N i ; this Z-dependency would then be signal shifted to an X-dependency between N i and N j , since N j has an X-dependency on the last Pauli X measurement. We use a parity argument to show that this never occurs. First, note that the sequence of Pauli measurements, (X) odd (Y (X) odd ) * is odd. Second, note that through signal shifting, the Z-dependency that originates from N i is shifted only through every even position in the Pauli measurement sequence. Due to the placement of the Y measurements which never occur in an odd position, the special case of the Pauli Y rule (Equation (11)) cannot be applied to change the parity. Hence, the final X measurement in the sequence (which is at an odd position) never sees a Z-dependency from N i (Figure 10). Lemma 8.2. Let N i and N j denote two non-Pauli measurements on a common influencing path I of a standard pattern with flow. Suppose that N i and N j are separated along I with only Pauli measurements, i.e. we have the following sequence along I: N i P 1 α 1 β 1 P 2 α 2 β 2 · · · P k N j , Ni Nj Figure 11: An even number of Pauli measurements between two non-Pauli measurement leads to an X-dependency after signal shifting.
where P i is a (possible empty) finite sequence of Pauli measurements and α i β i represents the endpoints of a non-flow edge. After signal shifting, there will be no X-dependency due to I between N i and N j if and only if at least one of the P i sequence is equal to (X) odd (Y (X) odd ) * . This will be also true even if one of the N i or N j are an endpoint of a non-flow edge.
Proof. First, assume N i and N j are connected with only flow edges (we have the sequence N i PN j ) and consider the following possible cases for the sequence P: (I). It consists of an even number of Pauli angles. Then there is an X-dependency between N i and N j .
(II). It consists of an odd number of Pauli angles with at least one Y at an odd position from left to right. Then there is an X-dependency between N i and N j .
(III). It consists of an odd number of Pauli angles with no Y at any odd position: Then there is no X-dependency between N i and N j . Figure 11 shows how in Case (I), one obtains an X-dependency after signal shifting between N i and N j . Case (II) is also similar, by Pauli simplification, the X-dependency at a Y measurement of an odd position is considered as an Z-dependency and hence we obtain the same scenario as Case (I). Finally, Case (III) is proved in Lemma 8.1. Now consider the case where there exists a non-flow edge between the non-Pauli angles and neither N i nor N j are an endpoint of a non-flow edge: According to the Flow Theorem, there is a Z-dependency from the qubit that precedes the qubit assigned to α angle to the qubit with angle β. In order to have a sequence of Z dependencies between N i and β, P 1 must satisfy the conditions of cases (I) or (II) and then similar to the above argument, in order to obtain an X-dependency between N i and N j , P 2 must also satisfy the conditions of cases (I) or (II) and hence we obtain the statement of the Lemma. The same argument is valid if either of N i or N j is an endpoint of a non-flow edge.
We can now present our main result on characterization of patterns with a given depth. Theorem 8.3. Let P be a standard pattern with flow and let I be an influencing path of P. We apply the following simplification rule to the commands along I: where P i represents a (possible empty) finite sequence of Pauli measurements and α i β i represents the endpoints of a non-flow edge. Define the depth of I to be d + 2 if after the simplification we obtain P N d P and to be d + 1 if we obtain either Y N d P or N d P. Then the quantum depth of P after Pauli simplification and signal shifting is given by the maximum depth over all influencing paths of P.
Proof. Lemma 8.2 justifies the given simplification rule. It is trivial that after applying the rule one will obtain a unique final sequence of the form P N i P on any influencing path and hence the longest sequence of dependent of non-Pauli measurements will have length i and since there is a first layer of Pauli and one final layer of corrections the depth along this path will be i + 2. However if the final form is Y N i P then there will be no dependency between the Pauli Y and the first non-Pauli N (Equation (11)) and depth is i + 1 which is also the case for the final form N i P. According to Proposition 6.2 the pattern depth is the maximum number of the dependent non-Pauli measurements along all the influencing paths and hence it is enough to compute the maximum value of i over all influencing paths.
The above theorem gives a constructive method to obtain a depth d pattern. The main tool being the sequence (X) odd (Y (X) odd ) * , which if it is inserted between two non-Pauli measurements make them independent of each other. On the other hand, any other sequence inserted between non-Pauli angles contributes to the depth and makes the two non-Pauli measurements X-dependent on each other and hence in two different layers of measurement.
We now show as a special case the characterization of patterns with depth 2. Note that this proposition extends the previously know result that patterns with only Pauli measurements have depth 2 [8,33].

Parallelizing Circuits
In order to present the pattern depth characterization result directly in terms of the circuit language, we first define the notion of circuit influencing paths. Recall that for patterns with equal number of input and output qubits, the flow, if it exists, is unique. Hence it is easy to verify that circuit influencing paths defined above are exactly influencing paths of the corresponding pattern via the direct translation given in Section 7. Similar to the pattern case, the circuit depth is characterized in terms of the sequence of J gates appearing on the influencing paths defined below.
Definition 8.6. Let I be a circuit influencing path of circuit C. The set of J gates over I is defined to be all the consecutive J gates over the wires of the path including the J gates just after a ∧Z gate of a jump, as shown in Figure 12.
Note that, again the above definition is a direct consequence of our transformation between circuits and patterns. Further, define H i to be the single unitary gate Similar to the pattern case, the above theorem gives a constructive method to obtain a depth d circuit. The main tool is the gate sequence which if it is inserted between two J gates over a circuit influencing path will make them to appear in the same layer of the final parallelized circuit.
As an application, consider the quantum circuit in Figure 13 with size in O(n 2 ) and depth in O(n). Theorem 8.7 tell us how to parallelize it to depth in O(log(n)), while adding O(n 6 ) auxiliary qubits. First note that on any circuit influencing path, any two J gates are separated by an R gate (Equation (17)) and hence after the simplification rule, we will have no two consecutive J gates. In other words, the parameter D ′ in Theorem 8.7 is equal to 1 which implies the depth of the parallelized circuit will be in O(log(n)). Figure 13: A polynomial-depth circuit where each J ij gate has an angle ∈ [0, 2π) and the R gate stands for a sequence of Clifford gates of the form (H) odd (H i (H) odd ) * . Theorem 8.7 implies that this circuit can be parallelized to a logarithmic depth circuit.
It is easy to extend the circuit of Figure 13 and still apply Theorem 8.7 to parallelize it to a circuit with depth in O(poly(log(n))). On each wire, replace O(log(n)) many J ij gates with the following sequence of gates: where P i is a sequence of H and H i gates of polynomial length. Now the parameter D ′ of Theorem 8.7 is in O(log(n)) and the parallel circuit will have depth in O(log 2 (n)).
These set of examples, although somewhat artificially constructed, demonstrate how one might use Theorem 8.7 to construct parallel circuit for a given problem in hand. We finish this section with several other results on circuit parallelization. Proposition 8.8. A circuit on n qubits can be parallelized to a pattern of depth 2 via the construction given in Section 7 if and only if it is of the form: a possible sequence of individual phase gates, Z 1 (α 1 ) ⊗ · · · ⊗ Z n (α n ), followed by an arbitrary poly-size Clifford circuit.
Proof. It is known that any Clifford gate can be implemented by a pattern with only Pauli X and Y measurements [17,18]. Hence in one direction, the proof is simply obtained by replacing the phase gates with qubits measured with a non-Pauli angles, that are input qubits. Then by Proposition 8.4, the corresponding pattern has depth 2. Figure 14: A logarithmic-depth circuit for parity unitary transformation, where To prove the other direction, let C be a circuit that can be parallelized to a pattern P with depth 2. Hence from Proposition 8.4 by adding appropriate (Z(α)) † gates to the beginning of C, we obtain another circuit C ′ that translates to a pattern P ′ with only Pauli measurements. Now Theorem 4 in [17] implies that C ′ is in the Clifford group and hence C has the desired form.
A simple case of the above proposition is a Clifford circuit, that was known already by [8,17,18,33]. On the other hand, the best known result in terms of depth complexity for the circuit implementing a subgroup of the Clifford group is Proposition 7.6 due to [11]. Using our forward and backward construction of Section 7, we improve this and obtain a general result on circuit depth complexity for the whole Clifford group. Proposition 8.9. Any quantum circuit on n qubits of size s ∈ poly(n) consisting of Clifford gates can be parallelized to a circuit with O(log n) depth and O(s 3 + n) auxiliary qubits.
Hence from Propositions 8.8 and 8.9, we see a logarithmic improvement in depth for implementations in the MBQC compared to the circuit model. What we achieve actually is a translation of quantum logarithmic depth in a circuit to constant quantum depth plus classical logarithmic depth in a pattern. We now show that this separation is tight by giving an example of a unitary that can be implemented as a pattern with constant quantum depth, but that must have logarithmic depth in the quantum circuit model. Assume C to be any circuit consisting of 1-and 2-qubit gates that implements this unitary. Then the depth of C is in Ω(log n).
Proof. Since the state of the last output qubit depends on every input qubit, and the circuit has only 1-and 2-qubit gates, the depth of the circuit must be in Ω(log n). Figure 14 gives a logarithmic depth circuit for U p . This circuit uses only Clifford gates and hence by Proposition 8.8, we can implement it as a pattern with depth 2. Note however that the pattern has a classical logarithmic depth, which reconciles the depths in the two models: the sum of the classical and quantum depths in the pattern is equal to the total quantum depth in the circuit.

Discussions and future directions
The design of parallel algorithms is one of the main challenges in both classical and quantum computing and has significant impact on theory and implementations. The advantage of quantum computing models over classical counterparts has been extensively studied in the context of computational complexity, whereas relatively little is known in terms of depth complexity. In addition, the comparison of models of quantum computing has been mainly explored from the computational aspect although other measures of comparison such as parallelism might lead to new directions in our understanding of the power and limitations of quantum computing.
In this paper, we considered two well-known models of quantum computing, the circuit model and the measurement-based quantum computing, and presented a logarithmic separation between them in terms of quantum depth complexity. We further demonstrated how a simple forward and backward transformation between circuits and measurement patterns leads to an automated procedure of parallelization. More importantly, the set of tools that we developed to study the depth complexity, such as the notion of the influencing paths, result in a simple construction for parallel patterns and circuits, this being the insertion of some particular type of Clifford operation among the non-Clifford ones.
A simple way of observing the advantages of the MBQC over the quantum circuit can be seen via the tradeoff between space and depth complexity as the transformation from a circuit to MBQC adds some auxiliary qubits and hence decreases the depth. On the other hand, one can also argue that the advantage is due to a clear separation of the types of depths that are involved in a computation: the preparation, quantum computation and classical depths. In other words, in the circuit model, all operations are done "quantumly" whereas in a pattern, some part of the computation can be performed via classical processing. This intuition seems to be also responsible for some of the previously known results on circuit parallelization such as the work of Robert Griffiths and Chi-Sheng Niu on the parallel semi-classical quantum Fourier transform [9]. Hence it would be interesting to see if our tools can indeed reproduce the same results for these or other classes of circuits where the output qubits are always measured.
Although it is encouraging that we obtain a generic method for circuit parallelization by exploiting the classical control structure in MBQC, it is not clear at this stage how our set of tools might be put in use to design parallel algorithms for a given classical problem and further work in this direction is necessary.
Another direction to investigate is the extension of the characterization results to the patterns with generalized flow [29], a recently developed notion for MBQC computing that provides both a necessary and sufficient condition for determinism that might lead to a more parallel structure than patterns with flow.

A Introduction to quantum computing
Let H denote a 2-dimensional complex vector space, equipped with the standard inner product. We pick an orthonormal basis for this space, label the two basis vectors |0 and |1 , and for simplicity identify them with the vectors 1 0 and 0 1 , respectively. A qubit is a unit length vector in this space, and so can be expressed as a linear combination of the basis states: Here α 0 , α 1 are complex amplitudes, and |α 0 | 2 + |α 1 | 2 = 1. An m-qubit state is a unit vector in the m-fold tensor space H ⊗ · · · ⊗ H. The 2 m basis states of this space are the m-fold tensor products of the states |0 and |1 . We abbreviate |1 ⊗ |0 to |1 |0 or |10 . With these basis states, an m-qubit state |φ is a 2 m -dimensional complex unit vector |φ = i∈{0,1} m α i |i .
There exists quantum states that cannot be written as the tensor product of other quantum states, e.g. |00 + |11 . This means that given a general element of H ⊗ H ′ one cannot produce elements of H and H ′ ; such states are called entangled states.
A quantum state can evolve by a unitary operation or by a measurement. A unitary transformation is a linear mapping that preserves the norm of the states. If we apply a unitary U to a state |φ , it evolves to U |φ .
The Pauli operators are a well-known set of unitary transformations for quantum computing: and the Pauli group on n qubits is generated by Pauli operators. Other well-known unitary transformations are the identity I, the Hadamard gate H, the phase gate Z(α), of which Z(π/4) and Z(π/2) are a special cases, and the Controlled-Z gate ∧Z: imposing some uniformity conditions, we require that the patterns for different input lengths have something in common concerning their structure. This, in turn, ensures that a pattern family has a finite description. These uniformity conditions are similar to those that are usually imposed on uniform families of circuits [35]. The execution of a pattern consists in performing each command in sequence, from right to left. If n is the number of measurements (i.e. the number of non-output qubits), then this may follow 2 n different computational branches. Each branch is associated with a unique binary string s of length n, representing the classical outcomes of the measurements along that branch, and a unique branch map A s representing the linear transformation from the input Hilbert space to the output Hilbert space, along that branch.
A pattern is said to be deterministic if all the branch maps are proportional, it is said to be strongly deterministic when branch maps are equal (up to a global phase), and it is said to be uniformly deterministic if it is deterministic for any choice of measurement angles. A pattern is said to be in standard form if all the preparation N i and entanglement operators E ij appear first in its command sequence, followed by measurements and finally corrections. A pattern that is not in standard form is called a wild pattern. Any wild pattern can be put in its unique standard form [17]; this form can reveal implicit parallelism in the computation, and is well-suited for certain implementations (see Section 4).
The procedure of rewriting a pattern to its standard form is called standardization. This can be done by applying the rewrite rules (1)-(4). The rewrite rules also contain the free commutation rules (Equations (23)- (25)) which tell us that, if we are dealing with disjoint sets of target qubits, measurement, corrections and entanglement commands commute pairwise [17].
where k represent the qubits acted upon by command A, and are distinct from i and j. Clearly these rules could be reversed since they hold as equations but we are orienting them this way in order to obtain termination for the standardization procedure. Under rewriting, the computation space, inputs and outputs remain the same, and so do the entanglement commands. Measurements might be modified, but we still measure exactly the same qubits. The only major modifications concern local corrections and dependencies. If there were no dependencies at the start, none will be created in the rewriting process.
We can extend the rewrite rules to include a command called signal shifting (equations (5)- (8)). This allows us to dispose of dependencies induced by the Z-action, and obtain sometimes standard patterns with smaller depth complexity (see Section 5).