Quantum linear network coding for entanglement distribution in restricted architectures

In this paper we propose a technique for distributing entanglement in architectures in which interactions between pairs of qubits are constrained to a fixed network $G$. This allows for two-qubit operations to be performed between qubits which are remote from each other in $G$, through gate teleportation. We demonstrate how adapting \emph{quantum linear network coding} to this problem of entanglement distribution in a network of qubits can be used to solve the problem of distributing Bell states and GHZ states in parallel, when bottlenecks in $G$ would otherwise force such entangled states to be distributed sequentially. In particular, we show that by reduction to classical network coding protocols for the $k$-pairs problem or multiple multicast problem in a fixed network $G$, one can distribute entanglement between the transmitters and receivers with a Clifford circuit whose quantum depth is some (typically small and easily computed) constant, which does not depend on the size of $G$, how remote the transmitters and receivers are, or the number of transmitters and receivers. These results also generalise straightforwardly to qudits of any prime dimension. We demonstrate our results using a specialised formalism, distinct from and more efficient than the stabiliser formalism, which is likely to be helpful to reason about and prototype such quantum linear network coding circuits.


Introduction
One of the most important problems to solve, in the realisation of quantum algorithms in hardware, is how to map operations onto the architecture. Scalable architectures for quantum computers are not expected to have all-to-all qubit connectivity: if we describe the pairs of qubits which may interact directly by the edges of a graph (or "network") G whose nodes are qubit labels, then G will not contain all pairs of nodes. This raises the question of how best to realise two-qubit operations on data stored on pairs of qubits a, b ∈ G which are not adjacent in G.
One solution is to swap qubit states through the network until they are on adjacent nodes [7,20,21]. An alternative, which is possible when not all qubits in the hardware platform are used to store data, is to distribute entanglement between qubits a , b ∈ G which are adjacent to a and b respectively. This allows a gate between a and b to be (a) (b) ⊕ ⊕ ⊕ Figure 1: (a) Example of network coding over the Butterfly network for input bitstreams "A" and "B" -nodes either perform a modulo-2 sum of the incoming bitstreams (when labelled ⊕) or fanout the single incoming bitstream otherwise; (b) the Butterfly shown as a (topologically identical) 2 × 3 grid, with node order shown by the labelled indices -as the Butterfly network provides a useful illustrative example for many of the results presented in this paper this ordering is defined and used consistently throughout the paper (for example for qubit ordering). performed by teleportation [17]. Which approach is the more practical will depend on whether it is economical to leave some number of qubits free to use as auxiliary space, but also on how much noise the state is subject to as a result. The question of which approach will lead to more accumulated noise will be determined in part by how long it takes to realise the chosen approach, in total, over all operations to be performed in a given algorithm.
To reduce the time taken in distributing entanglement for two-qubit operations, we consider how entangled states may be distributed between multiple pairs in parallel. A direct approach may result in crossing paths in the network G, forcing the entangled pairs to be distributed in sequence rather than in parallel. The issue of crossing paths for transmissions across a network is also potentially an issue in conventional networks. In that setting, one solution to this problem is network coding, in which independent signals in a network may share bandwidth by allowing intermediate nodes to combine their signals in appropriate ways to distribute complete information about each signal across the network. (A simple illustrative example of this, the "butterfly network", is shown in Fig. 1.) This motivates the idea of using network coding to realise entanglement distribution between multiple pairs of qubits in parallel using similar concepts.
Previous work [25,26,29,38] has shown that when a classical binary linear network code exists for the "multiple unicast" problem (the problem of sending signals between k pairs of sources and targets) on a classical network, then there exists a quantum network code to distribute Bell states between each source-target pair in a quantum network of the same connectivity. However, these results suppose that each "node" is a small device, hosting multiple qubits and able to perform arbitrary transformations on them before transmitting onward "messages" through the network. This does not reflect the architecture of many hardware projects to realise quantum computers, in which the "nodes" are single qubits, and edges are pairs which may be acted on by a quantum operation (such as a CNOT) rather than a directed communications link [15,22,23,36,39].
In this article, we describe techniques to translate linear network coding protocols on a directed graph G, to circuits -called here "QLNC circuits" -which involve only preparation of |0 and |+ states, CNOT gates along edges of G, unitary Pauli gates (possibly conditioned on classical information, which is communicated without constraints), and measurements of the observables X and Z. Our techniques extend also to the multiple multicast problem, serving to distribute Bell and GHZ states across such a network G.
We show that QLNC circuits allow us to distribute entanglement in a circuit whose quantum depth can be bounded from above by simple properties of the architecture network G, leading to a modest sized constant for reasonable choices of G (e.g., 9 for a square lattice provided no receiver node has four in-coming links). In particular, the depth is independent of the number of qubit pairs to be entangled, the distance between the nodes in any of the pairs, or the total number of other qubits involved. In addition to this constant quantum depth, is a dependency on computing classical controls for some of the quantum operations, which is at worst logarithmic in the number of qubits involved. These are lower circuit depths than can be achieved by realising two-qubit operations by routing [7,24]. Furthermore, while our results are in some ways similar to what can be achieved with graph states (as described by Hahn et al. [18]), our techniques are somewhat more versatile and also easier to analyse. We make these comparisons more precise in Section 2.3.
As well as describing how network codes can be used to distribute entanglement, in a setting where the nodes in the network represent individual qubits which may interact in pairs along the network, we also note two features of QLNC circuits that make them more versatile than classical linear network coding protocols: • QLNC circuits can be used to simulate a classical linear network code "out of order".
(Indeed, this is required for our main result, which simulates a linear network code in a depth which may be smaller than the length of the longest transmitter-receiver path in the classical network.) • Entanglement swapping allows for QLNC circuits to perform entanglement distribution tasks, that do not correspond to classical linear network coding protocolsthat is, for networks G in which the corresponding linear network coding problem has no solution.
These results hold as a result of using the (unconstrained) classical control to allow a QLNC circuit to simulate a classical linear network code, on a network with more edges than G. Our analysis of QLNC circuits involves a simple computational formalism, which may be of independent interest. The formalism is similar to classical network coding in its representation of data with time, and allows the easy use of classical network coding results and intuitions to reason about entanglement distribution circuits. While QLNC circuits are stabiliser circuits, and can be efficiently simulated using the stabiliser formalism, QLNC circuits do not require the full power of the stabiliser formalism to simulate. This allows us to reason about them more efficiently than is possible even with the stabiliser formalism. This yields at least a factor 2 improvement in space and time requirements, and achieves O(n) complexity (without using sparse matrix techniques) to simulate protocols which only involve superpositions of O(1) standard basis states. These techniques can also be applied to network codes on qudits of prime dimension.
The remainder of the paper is organised as follows. In Section 2 we review existing literature on classical and quantum network coding. In Section 3 we introduce the QLNC formalism, and present the main results described above. In Section 4 we give the generalisation for prime d-level qudit systems. In Section 5 we discuss the computational complexity of simulating circuits using the QLNC formalism, as well as that of discovering linear network codes. Finally, in Section 6, we include a detailed proof of the Theorem 5, which demonstrates the way in which a QLNC circuit may be regarded as realising a linear network code on an extended network G ⊇ G. The network is a directed graph, consisting of transmitters on the left hand side, and receivers on the right-hand side. Each receiver is paired with the transmitter horizontally left (as shown by the indexed "t"s and "r"s). The network consists of two components, a bipartite graph between the transmitters and receivers, with direct links t i -r i missing, shown in (a); and all of the transmitters connected to all of the receivers through a single directed link, shown in (b). Clearly without network coding all of the transmitter-receiver pairs will have to share the link in (b), and the links in (a) will be useless, however with network coding each of the transmitters can broadcast its bitstream to each output, and the left-most of the central nodes in (b) can perform a modulo-2 sum of all its inputs and forward the result, and the right-most of the central nodes in (b) simply broadcasts this to each receiver. So it follows that each receiver receives 4 bitstreams -the modulo-2 sum of all the transmissions, via the central nodes, and the bitstreams from all transmitters other than its pair, thus can perform a modulo-2 sum to resolve the bitstream from its paired transmitter. That is, for example, r 1 receives B, C and D directly from t 2 , t 3 and t 4 respectively, as well as A⊕B⊕C⊕D from the central nodes in (b), and can thus perform the modulo-2 sum of all its inputs A⊕B⊕C⊕D⊕B⊕C⊕D=A, as required. It can easily be appreciated that this construction can extend to any number of transmitter-receiver pairs. respectively), and the multiple multicast problem (in which multiple transmitters send different information streams to different subsets of the other nodes). The advantage of network coding is most important in the case that the network G has edges which are all directed (as illustrated in the examples of Figs. 1 and 2). In the case of directed networks, it is always possible to contrive situations in which network coding can yield an unbounded increase in information throughput (for a k-pairs example see Fig. 3). However, in many practical contexts, the available communication channels are bidirectional. For such networks, it is often not clear that network coding will yield any benefits at all. For the broadcast setting, it has been proven that there is no benefit to the application of network coding over standard routing [34]. For tasks of transmitting long information streams in undirected networks, other techniques than network coding appear to be competitive. For instance, fractional routing involves dividing up a single bitstream and forwarding it along different routes, storing them locally in between rounds of use of the network. Fig. 4 illustrates how fractional routing can achieve the same asymptotic throughput as network coding in the Butterfly Network.
The multiple unicast conjecture posits that there is no benefit to the application of network coding over standard routing for multiple unicast channels, if fractional routing is possible [35]. While the multiple unicast conjecture remains unproven, the improvement possible by using network coding has been upper-bounded to typically low factors for various restricted multiple unicast settings [6]. This rather sets the tone for the other settings considered, with an upper bound equal to two on the factor improvement over  Figure 4: Demonstration of achieving the same throughout on the Butterfly as network as network coding by using fractional routing instead. This is achieved by splitting each of bitstreams "A" and "B" into halves, and forwarding half on each link, as shown in (a). That is (for example) let A consist of two bits a 1 and a 2 and likewise B two bits b 1 and b 2 . In the first time interval the two bits of A are forwarded on different routes, as shown in (b), and then likewise for the bits of B, shown in (c). Thus time-sharing is used to achieve the fractional routing, and A and B can each forward two bits in a total of two time intervals, which corresponds to the same bit-rate as is achieved using network coding, as shown in Fig. 1. routing achievable by applying network coding being proven for the multicast and multiple multicast settings [33]. Table 1 summarises the benefits of network coding in various settings.

Quantum network coding
The concept of network coding has been adapted to quantum state transmission [29], and then to entanglement swapping [25,26,38] in quantum communications networks. Because of the limitation imposed by the no-cloning theorem, the k-pairs problem (or for entanglement swapping, the problem of distributing entanglement between k different transmitter-receiver pairs) is typically the problem studied in the quantum case. It has been shown that any situation in which a classical network code for multiple unicast exists, then there is also a quantum network code for entanglement swapping [25,26,29]. These results include quantum generalisations of both linear and non-linear network codes. It is with the former that we are concerned in this article, and Satoh et al. provide a very good visual demonstration of the correspondence between classical and quantum linear network coding for the case of the Butterfly graph [38]. In the case of "classically assisted" quantum linear network coding, in which classical communication is less constrained than quantum communication, de Beaudrap and Roetteler [11] show how quantum network coding can be described as an instance of measurement-based quantum computation involving X observable measurements to remove correlations between the input states and the states of qubits (or qudits) at interior nodes. One feature which is common for these existing pieces of research is that they consider quantum networks which are in the same essential form as classical telecommunications networks: nodes which have more than one qubit of internal memory (with negligible latency operations), which are connected to each other by channels with significant latency. This model is appropriate for entanglement distribution in quantum communication networks, but for entanglement distribution in quantum computers it may be relevant to consider a finer scale model in which each node is itself a single qubit. Note that in this setting, fractional routing is made more complicated by the inability to store and transmit information without resetting the state of the qubit, making the multiple unicast less plausible. (In the case that the "information stream" consists of a single Bell state between each of the k transmitter/receiver pairs, fractional coding loses its meaning entirely.)

Other approaches to realise two-qubit operations in limited architectures
While we consider the problem of distributing entanglement in limited quantum architectures, this is not the only approach to the problem of realising two-qubit operations between remote qubit pairs. We consider below other approaches to this problem

Realising two-qubit operations via mapping/routing
One way in which two-qubit operations can be realised between qubits is simply by moving the data stored by these qubits to adjacent nodes, e.g., using logical SWAP operations to exchange the data held by adjacent qubits. We may then consider the way that such a circuit of SWAP gates (or several such exchanges of qubits) can be decomposed into more primitive gates [7,41]. More generally, we may consider how to decompose a single "long-distance" operation (such as a CNOT) between remote qubits, into primitive gates consisting of single-qubit gates on adjacent qubits [24].
These mapping/routing results are applicable to the NISQ setting, i.e., the near-term prospect of hardware platforms in which all or nearly all of the qubits will store data which ideally is not to be lost or disturbed owing to the scarcity of memory resources. They give rise to unitary circuits, whose depth must scale at least as the distance between the pair of qubits on which we want to perform a two-qubit operation. However, it seems plausible that the parity-map techniques of Ref. [24] may be interpreted in terms of linear network codes. This might allow their techniques for finding suitable CNOT circuits (in the NISQ setting), to be combined with our techniques for distributing entanglement (in a setting where memory is less scarce).

Sequential distribution of Bell pairs
Our approach is to consider how multiple Bell pairs may be distributed through a quantum hardware platform in spite of "bottlenecks" in the network of the architecture, in a way that is independent of the distance between the qubits to be entangled. Note that individual Bell pairs can be distributed in constant depth as well, by taking advantage of the concept of entanglement swapping (a concept which implicitly underlies our techniques as well).
In (otherwise idealised) quantum hardware with paralellisable two-qubit interactions limited to a connected, undirected network G, we may distribute entanglement between any pair of qubits q and q by first preparing a long chain of entangled qubits, and "measuring out" all intermediate qubits (essentially using what we call "qubit termination" below), in constant time. It suffices to consider a chain q 0 , q 1 , . . . , q of qubits with q and q as endpoints, and to perform the following: 1. Prepare each q j for j even in the state |+ , and the remaining qubits in the state |0 .
2. Perform a CNOT from qubit q j to qubit q j−1 for each even j > 0.
3. Perform a CNOT from qubit q j to qubit q j+1 for each even j < . 4. Measure the X observable on each q j for 0 < j < even (recording the outcome s j = ±1); and measure the Z observable on each q j for j < odd (discarding the outcome and assigning s j = +1).
5. If j s j = −1, perform a Z operation on either q 0 or q (not both).
The value of the product j s j can be evaluated by a simple (classical) circuit of depth O(log ), and only determines the final single-qubit operation which determines whether the prepared state is |Φ + or |Φ − on {q, q }; the rest of the procedure is evidently realisable by a quantum circuit with a small depth, independent of . To distribute Bell states between k pairs of qubits, it clearly suffices to perform the above procedure k times in sequence, independently of whether the chains involved cross one another. (Furthermore, any pairs of qubits whose chains do not cross in G can be processed in parallel.) As the final corrections can be performed in parallel, the total depth of this procedure is then at most 4k + 1, regardless of the distance between the nodes or the size of G.
One of our main results (Theorem 4 on page 19) is to demonstrate conditions under which we may use a QLNC circuit to simulate a classical linear network coding protocol, in "essentially constant" depth -that is, using a number of rounds of quantum operations which is independent of the size of the network, or the distance between transmitters and receivers. Thus, for sufficiently large k, our techniques will distribute the same entangled states in parallel, with a lower depth of quantum operations than distributing the same entanglement sequentially.

Distribution of entanglement via graph states
Our techniques yield results that are in some ways similar to results involving graph states [19]. We describe some of these here.
In the work by de Beaudrap and Roetteler [11], linear network codes give rise to measurement-based procedures involving graph states (which differ from, but are in some cases very similar to, the coding network itself). The connection to measurement-based quantum computing informed our results, and in particular our techniques feature both measurements and the depth-reduction for which measurement-based computing is known. However, as our results rest upon unitary operations performed on a network in which each node is a single qubit, the results of Ref. [11] do not directly apply.
More intriguingly, Hahn et al. [18] have shown how entanglement can be "routed" from an initial graph state using transformations of graph states by local complementations. Graph states can be prepared in depth equal to the edge-chromatic number of the graph (i.e., as with our results, with depth independent of the size of the distances between the qubits involved). In this sense they represent a better-known way to address the problem of shallow-depth multi-party entanglement distribution in restricted architectures. Our results differ from those of Hahn et al. [18] in that we are able to avoid using the sophisticated technique of local complementation of graph states, instead reducing the problem of entanglement distribution to the somewhat more easily grasped subject of linear network coding, which has also been well-studied in the context of information technologies. There are also entanglement distribution tasks which cannot be achieved by local transformations of graph states, which can be achieved through our techniques: see Section 3.1.3.

Quantum Linear Network Coding circuits
In this Section, we describe techniques to distribute entanglement in architectures where the pairs of qubits which can interact are restricted to some graph G. Our results involve stabiliser circuits which in a sense simulate a linear network coding protocol on G in order to distribute entanglement, given that the "nodes" are single qubits and the "channels" consist just of whether or not a CNOT operation is applied. For this reason, we call these circuits quantum linear network coding circuits -or henceforth, QLNC circuits.
We demonstrate below how to simulate a particular classical linear network code using a QLNC circuit, and how doing so can be used to distribute Bell states in parallel by reducing this task to the k-pairs problem. More generally, we show that the same techniques may be used to distribute GHZ states of various sizes by reducing this task to the multiple multicast problem. We also demonstrate the way in which QLNC circuits allow us to find solutions which somewhat extend what can be achieved by reduction to the k-pairs or multiple multicast problems. To help this exposition, we introduce a formalism to describe the effect of QLNC circuits as a class of quantum circuits, independent of the application of entanglement distribution.

A first sketch of QLNC circuits
Consider a network G with k transmitters T = {t 1 , . . . , t k } and k receivers R = {r 1 , . . . , r k }, where we wish to distribute a Bell pair |Φ + between each pair (t j , r j ), 1 ≤ j ≤ k. The simplest application of our techniques is to reduce this problem to the existence of a linear network coding solution to the corresponding k pairs problem on G, which we may describe by a subgraph G (omitting edges not required by the protocol) whose edges are given directions by the coding protocol. 1 In particular, our results apply to linear network codes in which, specifically, all nodes with output channels send the same message (consisting of the sum modulo 2 of its inputs) on each of its output channels.
We suppose that classical information may be transmitted freely, without being constrained to the network. While there will be non-trivial costs associated with communicating and computing with classical information, it is reasonable to suppose that the control system(s) governing the quantum architecture can perform such tasks, without being subject to the restrictions involved in the interactions between qubits.

Directly simulating classical linear network codes
Given a linear network code as above, to send a standard basis state from each transmitter to their respective receiver would be straightforward, using a circuit of CNOT gates to simulate the network code. It would suffice to simply initialise all qubits to |0 , and at each node, compute the message that the node should transmit by using CNOT gates (oriented along the directed edge) to compute the parity of its incoming message(s) at the corresponding qubit. Fig. 5 illustrates this in the case of the Butterfly network.
To transmit Bell pairs, requires additional operations: if the qubits at the transmitter nodes do not initially start in the standard basis, the procedure described above will yield states in which the transmitters and receivers are entangled with the intermediate nodes. This elaborated procedure is illustrated in Fig. 6. Following Refs. [11,25,26], we adapt classical network coding protocols by preparing the transmitter states in the |+ state (conceived of as a uniform superposition over standard basis states), and performing X observable measurements (i.e., measurements in the |± or "Fourier" basis) to disentangle the intermediary qubits while leaving them in (joint) superpositions of the standard basis. These measurements yield outcomes ±1. The +1 outcome represents a successful disentangling operation, erasing any local distinctions between possible standard basis states without introducing any relative phases. The −1 outcome represents a disentangling operation requiring further work, as a relative phase has been introduced between the possible standard basis states locally. By conceiving of the state of the qubit as being the parity of some (undetermined) bit-values originating at the transmitters, one may show that it is possible to correct the induced phase by performing Z operations on an (easily determined) subset of the transmitters or receivers. We refer to this procedure, of measuring a qubit with the X observable and performing appropriate Z corrections, as termination of the qubit. By considering the state of the qubits in Fig. 6(b) after the Hadamard gates simply as a superposition 1 2 a,b |a, 0, b, 0, 0, 0 for a, b ∈ {0, 1}, it is easy to show that the final state after the measurements and classically controlled Z operations is 1 2 a,b |a, · , b, b, · , a = |Φ + 1,6 |Φ + 3,4 , using dots as place-holders for the measured qubits 2 and 5.

Simulating classical linear network codes "out of order"
For the application of distributing entanglement, QLNC circuits may simulate linear network coding protocols in other ways than sequential evaluation. As a fixed entangled state represents a non-local correlation rather than information as such, it suffices to perform operations which establish the necessary correlations between the involved parties. This principle applies to the simulation of the network coding protocol itself, as well as to the eventual outcome of the entanglement distribution procedure. For instance: the role of a node with exactly one output channel in our setting is to establish (for each possible standard basis state) a specific correlation between the parities of the qubits of the nodes which are adjacent to it: specifically, that the total parity should be zero. These correlations may be established without simulating the transmissions of the classical network code in their usual order. Fig. 7 illustrates a mild example of how a QLNC circuit may simulate a classical network protocol (again on the Butterfly network), performing the operations "out of order". In this case, the correlation between the values of the qubits 1, 3, and 5 (that their projections onto the standard basis should have even total parity, before the disentangling measurement on 5) is established by attempting to project the qubit 2 onto the state |0 , via a Z observable measurement. In the case that the outcome is instead |1 , we must correct any receiver nodes which would be affected by this, by performing (classically conditioned) X operations (represented by the doubled operations, and performed at the sixth time-step). Again, by considering the state of the qubits in Fig. 7(b) after the Hadamard gates simply as a superposition 1 , it is easy to show that the state immediately prior to the measurement of qubit 2 is , and that projecting qubit 2 onto the state |0 projects onto those terms for which z = a ⊕ b. (Projection onto 1 projects onto those terms for which z ⊕ 1 = a ⊕ b, and we may correct for this simply by performing an X operation on each receiver whose state depends on the index z.) It is then easy to verify, as with Fig. 6, that the resulting circuit prepares the state |Φ + 1,6 |Φ + 3,4 . One insight is that the freedom to communicate classical information outside of the network allows QLNC circuits to represent a linear network code on a larger network than the network G which governs the two-qubit interactions -with the qubits as nodes, and both the CNOT gates / classically controlled X gates as directed edges. We will formalise this insight in Section 3.2. Figure 8: An example of an entanglement distribution task separating QLNC circuits from local transformations of graph states. The qubits are numbered 1,2,3,4 (left to right) along the top row, and 5, 6 (left to right) along the bottom row. Qubit 2 is terminated and qubit 3 is measured (followed by the required classical correction), leaving a four-qubit GHZ state.

A separation between QLNC circuits and local transformations of graph states
There are entanglement distribution tasks which can be achieved using QLNC circuits, which cannot be achieved using local transformations of graph states. Fig. 8 demonstrates a QLNC circuit on a simple network, whose effect is to prepare a four-qubit GHZ state on the nodes of degree 1. An exhaustive search of the local complementation orbit, including measurements, revealed that the four-qubit GHZ state could not be reached by local Clifford operations and measurements if a graph-state was prepared over the same graph.
(We provide the code for this exhaustive search [9], which was written specifically for this example but could in principle be adapted for any single network). While we do not make any formal claim to this effect, the existence of this example leads us to believe that our techniques may yield solutions for entanglement distribution in larger-scale networks and for a variety of entanglement distribution tasks, where it may be difficult or impossible to find a procedure to do so by manipulation of graph states.

The QLNC formalism
Our main objective is to demonstrate how to simulate a classical linear network code to solve a multiple multicast problem on a network G, using a QLNC circuit of constant depth, to distribute Bell states and GHZ states between disjoint subsets of qubits located at the nodes of an network G describing the interaction graph of some hardware platform. To do so, it will be helpful to introduce a simulation technique (which we call the "QLNC formalism") to describe the evolution of a set of qubits in a QLNC circuit.
QLNC circuits are stabiliser circuits, by construction. Indeed, as the only operations which they involve are preparations of |0 and |+ states, CNOT gates, X and Z observable measurements, and unitary X and Z gates conditioned on measurement outcomes, they do not even generate the Clifford group. For this reason, one might consider using the stabiliser formalism to simulate a QLNC circuit. (Indeed, the QLNC formalism described below uses operations similar to those of the simulating stabiliser formalism, in that they involve transformations and row-reduction of matrices over Z 2 .) The QLNC formalism differs from the stabiliser formalism by expressing states implicitly as superpositions over standard basis states, essentially as a special case of that of Dehaene and de Moor [12, Theorem

Parity formula states
In the QLNC formalism, the global state is represented by an assignment of Boolean formulae f j (a), where a = (a 1 , a 2 , . . . , a N ) to each qubit 1 ≤ j ≤ n in the network G. We call each formula f j (a) a node formula or a qubit formula. Here, for some explicit coefficients c j,0 , c j,1 , . . . , c j,N ∈ {0, 1}, and where addition is taken modulo 2 (i.e., each function f j (a) computes the parity of c j,0 and some given subset of its arguments). These arguments consist of some number of formal indeterminates a 1 , . . . , a N , which we may interpret as variables which may take Boolean values but where those values are as yet undetermined. We require that, together the the vector T span a set of 2 N +1 vectors. In particular, each indeterminate a h must occur in some qubit formula f j (a). The state also has an associated phase formula φ(a) of the form for some coefficients p 0 , . . . , p N ∈ Z 2 . Given such a phase formula ς and node-formulas . . , f n for a network G of n nodes, the global state of the system is given by That is: the phase formula φ(a) and node-formulae f j (a) stand for an explicit superposition over the standard basis, ranging over all possible substitutions of Boolean strings x ∈ {0, 1} N to the indeterminates a 1 , . . . , a N , and where in particular φ(a) determines the relative phases.

Definition 1.
A parity formula state is a n-qubit state for n ≥ 1 as expressed in (3), where φ and f j for 1 ≤ j ≤ n are (not necessarily homogeneous) linear functions of N ≥ 0 indeterminates, and where the functions f j (a) together with the constant function e 0 (a) = 1 span a set of 2 N +1 functions.
It will be convenient to consider a representation of parity function states in terms of an (N +1)×(n+1) matrix C and a separate column vector p, where p = [p 0 p 1 · · · p N ] T , and where the columns of C (indexed from 0 to n) consist of the vector e 0 and the columns c 1 , . . . , c n .

Definition 2.
A parity function matrix C for a n-qubit state is an (N +1) × (n+1) matrix for some N ≥ 0, of the form C = e 0 c 1 · · · c n+1 of rank N + 1. A parity function tableau is a matrix T = C p consisting of a parity function matrix C and a phase vector p.
Two distinct parity function tableaus T = C p and T = C p may represent the same state, if T = QT for some (N +1)×(N +1) invertible matrix Q. Such a transformation Q represents a change of variables, in the summation expression of the state as described in (3), leaving the overall sum invariant. Note that such a matrix must satisfy Qe 0 = e 0 : this corresponds to the fact that no change of variables can affect the value of constants. Conversely, any invertible (N +1)×(N +1) matrix Q which preserves the vector e 0 ∈ Z N +1 nodes corresponding to each qubit j in the diagram of G. For instance, the state illustrated in Fig. 9 is the state |+ 1 |+ 3 |GHZ 4 2,4,5,6 (with a phase function of zero). This will prove practical when the objective is to demonstrate the effect of operations within a particular network G.

QLNC operations on parity formula states
We now consider how each of the transformations which are admitted in QLNC circuits may be simulated through transformations of parity function tableaus.
Simulating unitary gates. The effect of the unitary transformations CNOT, X, and Z on parity formula states are easy to describe as transformations of their representations, by simply reasoning about the representation of the state as a superposition over the standard basis: (iii) The effect of a CNOT operation with control k and target , is It is easy to verify that these transformations correspond to elementary column transformations of the parity function tableau C p . Specifically -indexing the columns of C from 0 -these operations may be realised respectively by adding the zeroth column of C to the k th column, adding the k th column of C to p, and adding the k th column of C to the th column. Note that these operations all preserve the rank of C.
Simulating projective measurements. The way in which we may represent measurements by transformations of a parity formula tableau is somewhat more complex, due to the possibility of state collapse. To simplify the description of an X or Z observable measurement on a qubit k, we first perform a change of variables -specifically, by putting the block matrix T = C p in a reduced row-echelon form in which either column k is a pivot column, or column k is co-linear with e 0 (so that f k (a) is a constant). Suppose (without loss of generality) that C p is already in such a reduced row echelon form, in which case either f k (a) = c k,0 is a constant function, or f k (a) = a g for a single indeterminate indexed by 1 ≤ g ≤ N ; in the latter case, exactly one row of C contains a 1 in the k th column.
Having put the parity function tableau into reduced row-echelon form of this kind, we may then describe an X or Z observable measurement on qubit k, as follows.
(iv ) For an X measurement: (a) If f k (a) = a g for an indeterminate which does not occur in any other qubit formula f j (a)i.e., if there is a single 1 in the g th row of C -then the state is unchanged by the measurement, and the measurement outcome is s = (−1) pg .
(b) Otherwise, let z N+1 be a new indeterminate (represented in C by adding a new row at the bottom), and choose a measurement outcome s = ±1 uniformly at random. If f k (a) is constant prior to the measurement, then let ∆ be the (N +2)-dimensional vector with a single 1 in the final row; otherwise, let ∆ be the (N +2)-dimensional column-vector with exactly two 1s, in row g and N +1 (counting from 0). We then add ∆ to the k th column of C, and (in the case that s = −1) to p as well.
• Analysis of the state transformation.
In case (a), the state of qubit k can be factored out of the sum, so that the state is either |+ (if φ lacks any a g term) or |− (if φ contains a z g term), so that the measurement does not affect the state and the outcome is predetermined. Otherwise, in case (b), qubit k is maximally entangled with the rest of the system: the state has a Schmidt decomposition 1 each case is the state-vector on the qubits apart from k in the case that a g := b (possibly including a phase factor that depends on a g ). It follows that the outcome of the X observable measurement is uniformly random, and that the state |A ± of all of the other qubits will be in tensor product with k after measurement. A straightforward calculation shows that |A + = 1 xg (−1) xg |A xg ; these are the states described by simply omitting the k th column of C, and (in the case of |A − ) adding an extra a g term to the phase function. To represent the post-measurement state, it suffices to introduce a new indeterminate a N +1 to represent the independent superposition on qubit k; for the post-measurement state |− k , we also must add a N +1 to the phase function.
• On the rank of the resulting parity function matrix. Note, above, that in case (a) there is no change in the tableau, and thus no change in the rank of C. In case (b), we must consider two sub-cases: one where f k (a) = c k,0 before the measurement, and one where f k (a) = a g before the measurement. In either case, we add one row, in which the only non-zero entry is in column k. In the former case, we add one row and add a coefficient 1 in column k in that bottom row. This increases both the number of rows and the rank. In the latter case, we consider the operations performed at column k in two steps: first setting the coefficient at row g to zero, then setting the coefficient in the new row N + 1 to one. Setting the coefficient at row g to zero does not decrease the rank: the column k cannot any longer be a pivot column. Prior to the first step, the k th column is a pivot column; but we may alternatively select any other column in which the g th row is set to 1, as (by construction) these columns do not contain a pivot position for any other row. Thus, setting the g th coefficient of the k th row does not decrease the rank; and again, adding a row in which only the k th column has a 1 increases both the rank and the number of columns. Thus, this operation maintains the property of C having a rank equal to the number of its rows.
(v ) For a Z measurement: (a) If f k (a) = c is a constant function, then the measurement leaves the state unchanged, and the measurement outcome is (−1) c .
chosen uniformly at random. Let ∆ = be 0 + c k . Add ∆ to all columns of T = C p which contain a 1 in the g th row (including the k th column itself), and remove the row g entirely from the tableau.
• Analysis of the state transformation. In case (a), it is obvious that qubit k is in a fixed state: the outcome will be +1 if it is in the state |0 , and −1 if it is in the state |1 . Otherwise, in case (b), the state of the system can again be described as a superposition 1 where it is possible in principle that |A 0 = ± |A 1 . We may simulate the assignment of the k th qubit to b by quotienting out all of the functions f j (a) and the phase function φ(a) by the relation a g + b = 0. We may do this in effect by adding the column vector ∆ defined above to all columns with a non-zero coefficient in the row g, thereby obtaining a tableau in which the g th row is empty. This corresponds to a state in which the variable a g no longer plays any role; together with the updated normalisation after measurement, we may represent this by removing row g.
• On the rank of the resulting parity function matrix. Note, above, that in case (a) there is no change in the tableau, and thus no change in the rank of C. In case (b), we may without loss of generality suppose that the k th column is the last column to which we add ∆. In each case, the vector is added to a non-pivot column, in which case this cannot decrease the rank; nor will it increase the rank, as it only sets coefficients to 0 in rows which already have pivot positions. These column additions preserve the property of being a reduced row-echelon form. The final addition of ∆ does decrease the rank by 1, as it turns the g th row from a non-zero row-vector (in a reduced echelon form) to a zero row. Thus the rank of the parity function matrix C decreases by 1; as removing row g from the tableau reduces the number of columns by 1, this operation maintains the property of C having a rank equal to the number of its rows.
From the above, we see that we may represent QLNC operations by simple transformations of a parity function tableau T = C p , which in particular preserves an invariant that the rank of the parity function matrix C is equal to the number of its rows.
Simulating destructive measurements and qubit preparations. One might reasonably wish to regard some measurements as being destructive, i.e., in not leaving any post-measurement state. We may simulate this by simply removing from C the column corresponding to the destructively measured qubit, and removing from the entire tableau any row for which (after the column removal) the matrix C is entirely zero. Conversely, one may simulate the preparation of a fresh qubit in a standard basis state |b for b ∈ {0, 1}, by inserting a new column into C with the value be 0 . To instead simulate the introduction of a fresh qubit in the state 1 √ 2 x (−1) bx |x for b ∈ {0, 1}, one may insert a new row into the tableau (at the bottom of both C and p) which is entirely zero, then setting the new coefficient of p in this row to b if this is different from 0, and then inserting a new column into C which has only a single 1 in the final row.
Terminology. For the sake of definiteness, "the QLNC formalism" will refer below to the techniques described above to describe transformations of parity function tableaus (or some some equivalent representation), as a means to simulate stabiliser circuits composed of this limited set of operations.

Depicting and simulating QLNC circuits
Having defined the QLNC formalism, we now demonstrate how it may be used to simulate QLNC circuits. In this context, we will prefer to represent the parity function states diagrammatically rather than as a matrix -and to represent it together with a visual representation of the transformations to be performed.
1. Each vertex is a qubit j, with an associated formula f j (a), for some symbols a 1 , . . . , a N .
The initial formulae for each qubit is generally very simple: each qubit prepared in the |+ state is assigned the formula f j (a) = a j for a unique formal symbol a j , and each qubit initialised in the |0 state is assigned the formula f j (a) = 0.
2. Pauli X gates on a qubit k, which are classically conditioned by the outcome of a Z-observable measurement of a different qubit j, are represented as doubled lines with an orientation from j to k. Coherently controlled CNOT gates are drawn along edges of the network G.
3. One or more qubits may also be simultaneously "terminated", in which case they are measured with the X observable. The outcome may then be used to control Pauli Z operations to cancel out the relative phases which arise as a result of any −1 measurement outcomes.
4. There is a time-ordering of the operations represented by the edges are performed.
In simple QLNC circuits, this is represented by a single integer at each edge, and an integer inside each node to be terminated. (Two edges which meet at a common vertex, and which are not both classically controlled X gates, must be performed at different times, and thus must be assigned different numbers. Also, no edge can have the same number as the termination of a node to which it is incident. Otherwise, there are no constraints.) More generally, it will be reasonable to consider QLNC circuits in which edges are used some constant number of times, e.g. up to two times; we would then label edges by a list (or set) of those times in which it is used, and the operations involving a common vertex must be disjoint (again, unless those operations are all classically controlled X gates).

Remarks on termination.
It may not be immediately obvious that the claim made about termination -that any relative phases induced by obtaining measurement outcomes of −1 from X observable measurements -can be "undone", leaving a state which is a uniform superposition over some set of standard basis states (i.e., with no relative phases at all). In the case of a QLNC circuit which (successfully) simulates a classical linear network code, this may be more plausible to the reader. In fact, we make a stronger claim: We prove this result here, to demonstrate that "termination" is a well-defined operation in principle.
Proof. Let Q be an invertible linear transformation for which QT = e 0c1c2 · · ·c np is in reduced row-echelon form, and letf j be the qubit function corresponding to columñ c j . Then, for every formal indeterminate z g , there is a qubit k g ∈ {1, . . . , n} for which f kg = z g . Let J be the set of rows for whichp j = 1, and let S = {k j | j ∈ J}. Then the effect of Z ⊗S is to mapp → 0. This may be represented by a transformation R for which QT R = e 0c1c2 · · ·c n 0 , which is a parity function tableau for a state without relative phases over the standard basis. (Indeed, it follows that the final column of T R is also 0, so that simulating Z ⊗S on the original tableau removes all relative phases without committing to the change of variables described by Q.) As a corollary, it follows that for a parity function state, we can induce whatever relative phase we like, of the form (−1) φ(x) for any linear function φ of the indeterminates. We may use this to justify the notion of "terminating" one qubit independently of any others, and "undoing" any change to the phase function which occurs as a result of obtaining a −1 outcome. The specific choice of qubits on which to perform the Z operations may not be unique, but it suffices for our purposes that such a set can always be found efficiently.  Figure 9: Example of the out of order Butterfly: (a) the order of edges, slightly different, but with equivalent quantum circuit to that given in Fig. 7; (b) the initial labelling of the qubits; (c) the labels after edges "1"; (d) the labels after edges "2"; (e) the labels after edges "3"; (f) the labels after the classical control (edges "4") and the terminations (the fifth layer of operations, denoted by the nodes labelled "5").
The way one might use the QLNC formalism to simulate a particular QLNC circuit is illustrated in Fig. 9. This example distributes two Bell states across a rectangular grid, by simulating the classical Butterfly network protocol with some "out-of-order" evaluations.
To compensate for the out-of-order evaluation, classically controlled X operations are required upon the measurement of one of the qubits: this is in effect a coding operation using a link outside of G, relying on our architectural assumption that classical information can be communicated more freely than quantum information.

Using the QLNC formalism to design entanglement distribution circuits
As already noted, the purpose of developing the QLNC formalism is to enable the use of classical linear network codes as a basis to design entanglement distribution quantum circuits. We begin by noting that there are situations in which QLNC circuits can distribute entanglement which do not correspond to linear network codes.

Shallow QLNC circuits for entanglement distribution
The classical-quantum linear network code result suggests a number of ways in which QLNC circuits can be used to distribute entanglement. In this section we detail one such application, prompted by our desire to use classical linear network coding results and intuitions to distribute entanglement efficiently (i.e., with as few layers of quantum operations as possible).
We consider the following scenario. Let there be a classical binary linear network code over a network, connecting k transmitter-receiver pairs; and let that network consist of three types of nodes: • Transmitter nodes -for which each incident edge is outbound (i.e., a directed edge with direction away from the transmitter), and the transmitter broadcasts its bitsteam on all incident edges.
• Relay nodes -that have an arbitrary number of input and output edges, and whose operation is to broadcast the modulo-2 sum of all incoming bitstreams on all of the output edges.
• Receiver nodes -for which each incident edge is inbound, and whose operation is to perform the modulo-2 sum of all of the incoming bitstreams, which yields the desired bitsream (i.e., that transmitted by the corresponding paired transmitter).
With the three types of nodes (graph vertices) defined thusly, we can prove an important result about the required depth of layers of quantum operations, when the qubit interaction graph is again G = {V, E}.
Theorem 4. If a multiple multicast (including multiple unicast as a special case) classical binary linear network code exists over a network G, from a set of transmitter nodes T = {t 1 , · · · , t N } with in-degree 0 to a corresponding set of receiver nodes R j = {r j,1 , · · · , r j,n j } with out-degree 0, then there is a QLNC circuit whose CNOT operations are located along the edges of G and distributes |Φ + and |GHZ states between corresponding transmitter/receiver node sets. Moreover, this circuit has quantum depth ≤ 2(χ−1)(δ+2) + 1, where δ is the largest in/out degree of any vertex in G, and χ is the chromatic number of G.
Remark. It is in general NP-complete to compute the vertex-chromatic number χ of a network. However, in many realistic cases it will be easy to compute χ. For instance, bipartite networks (such as tilings by squares or hexagons, or connected subgraphs of these) have χ = 2 by definition. In any more complex network G, we may alternatively substitute χ with the number of colours of any proper vertex-colouring that one may find. For instance, any graph has a deg(G) + 1 vertex-colouring which can be found in polynomial time [5]. Furthermore, we have χ ≤ 4 in planar architectures (i.e., for which G is a planar graph) by the Four Colour Theorem [3], and an explicit four-colouring can also be found in polynomial time [37].
Remark. The role of δ in Theorem 4 is in relation to the number of colours of an edgecolouring γ of G, such that no two edges with the same colour label leave a common vertex or enter a common vertex. (We call such a colouring a "proper directed-edge colouring".) If we transform G into a graphG, in which each vertex q is replaced with a vertex q i (inheriting only the in-bound edges of q) and a vertex q o (inheriting only the out-bound edges of q), then δ is the maximum degree ofG, and γ corresponds to a proper edge-colouring ofG. By Vizing's theorem [40], the edge-chromatic number ofG is at most δ + 1, and an edge-colouring with δ + 1 colours can be found efficiently. (An edge-colouring ofG must have at least δ colours; and it may be easy to find an edge-colouring of this kind, e.g., if G arises from a lattice in the plane. If one may find such a colouring, the bound above improves to 2(χ−1)(δ+1) + 1. For the square lattice, with χ = 2 and with δ = 3 if no vertex has four in-edges, this yields the bound of 9 described on page 3.) Proof. Let c : (V ∪ E) → N be a colouring of the nodes and edges, such that c provides a proper colouring 1, 2, . . . , A to the nodes of G, and also a proper directed-edge colouring 1, 2, . . . , B ≤ δ + 1 to the edges of G. Consider the following procedure: 1. Initialise all of the qubits, where each qubit q is initialised either in the state |0 if it has no outgoing edges, or if it has some neighbour p by an in-bound edge (that is, there is a directed edge from p to q) for which c(p) < c(q), and is initialised in the state |+ otherwise. (In the QLNC formalism, we associate a formal indeterminate a q with each qubit q initialised in the |+ state.) 2. For each non-receiver node q with c(q) = 1 in parallel, perform the following procedure: • For each 1 ≤ j ≤ B, perform a CNOT operation on any edge e with c(e) = j leaving q. (In the QLNC formalism, this adds a q to the formula f v (a) for the node v at the end of e.) 3. For each 2 ≤ h ≤ A−1, perform the following operations in parallel on non-receiver nodes q with c(q) = h: a. For each 1 ≤ j ≤ B, perform a CNOT operation on any edge e with c(e) = j leaving q.
b. If f q (a) = a q (i.e., q was a target of some CNOT or Pauli X operation before this round): (i) Terminate the qubit q, by performing an X observable measurement. 4. For each non-receiver node q with c(q) = A in parallel, perform the following procedure: • For each 1 ≤ j ≤ B, perform a CNOT operation on any edge e with c(e) = j leaving q.

For each relay qubit q: if c(q) < A, perform a Z-observable measurement on q,
obtaining an outcome y q ∈ {0, 1}. Otherwise, terminate q (i.e., measure q with the X observable and perform appropriate Z corrections).
6. For receiver nodes q and for the relay qubits q for which c(q) < A, recursively define the delayed signal correction w q as the sum mod 2 of (y r ⊕ w r ), for r ranging over all neighbours of q via incoming links for which c(r) < A (or zero, if there are no such nodes r). 2 Defining w q in this way, perform a Pauli-X gate on each receiver node q for which w q = 1. (If such a qubit is subject to a Z correction as a part of Step 5, we perform a Y operation instead of the X and Z operations.) We compute the quantum depth of this procedure as follows. The operations of Step 1 has depth 1. Both steps 2 and 4 have depth at most B.
Step 3 is a loop with A−2 iterations, in which part (a) has depth at most B, and part (b) has depth at most B +2. Steps 5 and 6 together have depth at most 2. Together, the depth is then 1+B +(A−2)(2B+2)+B +2 = 2(A−1)(B +1) + 1 ≤ 2(χ−1)(δ+2) + 1.  Figure 10: Example of a relay node, whose operation in the linear network code is to forward a ⊕ b ⊕ c ⊕ d to all three outgoing edges. If the vertex colouring is such that the turn of this vertex is after incoming symbols a and b have arrived, but before c and d have, then the procedure continues as follows: in (a) a ⊕ b (i.e., the current label of the vertex) is forwarded to all outgoing edges; (b) the qubit is terminated and set to zero; (c) the qubit is set to the |+ state, and given the new label γ, which is then forwarded to all of the outgoing edges, therefore meaning that over the two rounds of forwarding a ⊕ b ⊕ γ has been forwarded; the qubit then waits for the remainder of the process to complete, after which all edges will have been performed, so its label will now be c ⊕ d ⊕ γ, which can then be measured and corrected such that c ⊕ d = γ, which then means that a ⊕ b ⊕ c ⊕ d has been forwarded as required. Fig. 10 shows a sketch of why this procedure works. In effect, we wish for "information" (more precisely: correlation of values of a qubit in the standard basis, when taken in superposition) to be transmitted through each relay node, from each of its sources (summing the signals from these sources modulo 2) to the qubits on each of its outward links. Some of this information may accumulate at a given relay node q before round c(q), in which case it is explicitly passed on through a CNOT. The rest accumulates at q after round c(q), and also after the node c(q) has communicated a formal indeterminate a q on each of its outgoing links. If we may collapse the state in such a way to assign to a q the modulo 2 sum of the remaining signals from its incoming links (accumulated after round c(q)), this collapse will complete the transmission of the information from the inbound links of q through to the outbound links.
More formally, consider the node formulae which result from this procedure.
• For each relay node, let Z p (a) denote the boolean formula which is transmitted to it on an incoming link from a node p for which c(p) < c(q). We will then have Z p (a) = a p ⊕ E p (a), where E p (a) is the modulo 2 sum of the corresponding functions Z r (a) for nodes with edges towards p such that c(r) < c(p).
• The formula which is stored at qubit p just prior to its measurement in Step 4 is the formula Y p (a) = a p + L p (a), where L p (a) is the modulo 2 sum of Y r (a) for nodes r with links inwards to p such that c(r) > c(p). (An outcome y p represents the value of Y p (a) which is produced by a standard basis measurement of p.)

If in
Step 4 we measure qubit p and collapse it to the state |0 , we in effect condition on the situation that a p = L p (a). (In the event that we obtain |1 , we perform corrections which allow us to simulate having obtained |0 instead.) This produces an acyclic graph of formula substitutions, from the node-formulae of the transmitters to the node-formulae of the receivers. By induction on the substitution depth (i.e., the distance of relay nodes from any receiver node), we may show that performing the necessary substitutions in the formula for Z p (a) yields the information which, in the classical linear protocol, p would transmit on its outgoing links. It follows that the parity function computed at each receiver node is the function a t (for its corresponding transmitter node t) that is computed in the classical linear network code.
In the protocol above, each relay is measured twice (i.e., for the termination, and then at the end to resolve the extra formal label introduced). For this reason, it is necessary to strictly separate transmitters, receivers and relays. However, this setting is not too restrictive, and corresponds to examples of classical linear network codes such as we see in Figs. 1 and 2.
Note that while Steps 2, 3a, 3b(iii), and 4 of our protocol iterate through all edge colours 1 ≤ j ≤ B, the only edge-colours that contribute to the depth are those associated to edges which leave some vertex of the colour 1 ≤ h ≤ A being considered in the given step. Thus the bound above will often be loose, and in fact it may be possible to find better realisations using a suitably tuned directed edge-colouring of G. However, our result obtains regardless which edge-colouring one uses, so long as it uses at most δ + 1 edge-colours, which again may easily be found [40].

Example of QLNC solution involving entanglement swapping, for which no classical linear network coding solution exists
When using linear network codes to design QLNCs, in which we distribute entangled pairs, we are free to assign which half of each desired Bell state corresponds to the transmitter in the linear network code and which half represents the receiver. However, while we have the freedom to decide which is the transmitter and which is the receiver, it may be the case that deciding the transmitter / receiver assignment for one Bell state fixes that for the rest. For example, if we consider the corresponding QLNC to the linear network code shown in Fig. 3, we can see that, even if we allow the links to be bi-directional, we must have one column of receivers and one column of receivers. That is, we cannot find a linear network code for the case where some of the left-hand nodes are receivers and some are transmitters. This principle allows us to construct composite networks, in which some data must flow through multiple networks such that there is no linear network code. This is the case shown in Fig. 11(a), composed of three copies of the network shown in Fig. 3 with some extra links, in which each pair of letters is to be connected. Even if we are free to assign which of each pair of letters is the transmitter and the receiver, and also the direction of each link, we still cannot find a linear network code. This can be seen by considering the non-circular coloured nodes, which correspond to data which must flow through two of the component networks. Using the linear network code of Fig. 3, we can connect the pairs "cc" and "dd", as well as propagating the left-hand occurrences of "a" and "b" forward from the left-hand column of vertices to the second from left. The left hand occurrence of a can now be forwarded via the intermediate blue square node, and the same left-to-right linear network code can be performed on the middle of the three component graphs, and then again forwarding "e" through the intermediate red hexagonal node to the right-hand of the three component graphs. Once again, we perform the same left-to-right linear network code on the right-hand of the three graphs, which means that we have now connected all of the pairs of letters, with the exception of b. In the case of b, each of the two bs has been forwarded as if it were at a transmitter, and they are connected by a common receiverthe top-most node, which is a green diamond with a thick black ring.  Figure 11: An example of a composite network with a QLNC circuit but no (classical) linear network code. Note that this composite network corresponds to three connected copies of the network in Fig. 3, here we draw the part of the graph in Fig. 3(b) as the two bottom-most nodes of each component.
Obviously, this is not a linear network code, as we have not connected pairs of letters as if one were a transmitter and the other a receiver (i.e., by a continuous data-flow from transmitter to receiver), however we can find a QLNC circuit, as routing each letter towards a common receiver (the black-ringed green diamond node) can yield the desired Bell state by entanglement swapping in the black-ringed node, as shown in Fig. 11(b).
A similar argument can be made for there not being a linear network code even if the component linear network codes are run right-to-left, in which case the black-ringed node would look like a single transmitter forwarding data to two receivers (the nodes marked b). A situation which can also be implemented as a QLNC circuit (i.e., if the black ringed node is terminated at the end) that does not correspond to any linear network code with the transmitter-receiver pairs as designated by the symbols in Fig. 11.

Classical-quantum linear network codes
In Section 3.1.2 we saw how the network codes in QLNC circuits can be performed "out of order" in some cases, and in Section 3.3.2 we gave an example of the use of entanglement swapping to implement a linear network code as if two transmitters are routing towards a common receiver. These are two instances of a general principle we notice that together the CNOT operations and classical control must form a linear network code. That is, if we consider the following situation: 1. We have n qubits connected in a network G = {V, E}, in which each edge means that a single CNOT (in either direction) is allowed.
2. We allow classically-controlled X gates (conditioned on measurement outcomes). It is convenient to consider this possibility of a classical control conditioned on the measurement outcome of a different vertex as a completely connected graph K n on the same set of vertices (where n = |V (G)|). That is, each edge represents the possibility of performing a classically controlled Pauli-X gate.
These coherently-and classically-controlled operations represent two of four primitives that we allow, the others being: 3. Initialisation of qubits in the |+ or |0 state.
4. Termination of the qubits according to the process described in the Section 3.2.3.

Theorem 5.
Consider a multiple multicast (including multiple unicast as a special case) classical binary linear network code exists over any subgraph of the graph G = G ∪ K n sending a unit rate bitstream, where each edge of the graph is a unit rate bi-directional edge (but not allowing fractional routing). Suppose that this code has a set of transmitting source vertices T = {t 1 , . . . , t N } for some N > 0, where the first N < N of these have corresponding recevier sets R j = {r j,1 , · · · , r j,n j } for 1 ≤ j ≤ N (with the remaining transmitters t N +1 , . . . , t N having signals which are not necessarily actually received by any "receiver" nodes). Suppose further that (a) the information transmitted on the edges of K n from any single node, and (b) the information transmitted by the nodes t 1 through t N , are linearly independent of each other. Then by simulating this linear network code by a QLNC circuit, with CNOT operations restricted to the same graph G and classicallycontrolled Pauli operations oriented along the other edges, the resulting protocol generates a product of |Φ + and |GHZ states, where each |Φ + or |GHZ is over each of the sets {t j , r j,1 , · · · , r j,n j } for all 1 ≤ j ≤ N .
Proof (sketch). The core of the proof is showing that the QLNC formalism described correctly keeps track of the quantum state, which follows from the formalism description in Section 3.2. We provide an explicit proof of the Theorem in Section 6, which explains why general QLNC circuits of this form achieve the desired result, and also serves to give a detailed walk through illustrating precisely how the QLNC formalism (including terminations) correctly simulates QLNC circuits in practise.
An important special case occurs when the linear network code only requires edges in the graph G. Corollary 6. Consider a multiple multicast (including multiple unicast as a special case) classical binary linear network code exists over any subgraph of the graph G sending a unit rate bitstream, where each edge of the graph is a unit rate bi-directional edge (but not allowing fractional routing). Suppose that this code has a set of transmitting source vertices T = {t 1 , . . . , t N } for some N > 0, where the first N < N of these have corresponding receiver sets R j = {r j,1 , · · · , r j,n j } for 1 ≤ j ≤ N (with the remaining transmitters t N +1 , . . . , t N having signals which are not necessarily actually received by any "receiver" nodes). Then by simulating this linear network code by a QLNC circuit, with CNOT operations restricted to the same graph G, the resulting protocol generates a product of |Φ + and |GHZ states, where each |Φ + or |GHZ is over each of the sets {t j , r j,1 , · · · , r j,n j } for all 1 ≤ j ≤ N . Moreover, this can be achieved using only three of the primitives: initialisation, CNOT and termination.
Proof. This corollary simply selects the QLNC solutions which have no classical control (apart from in the terminations).

Generalisation to qudits of prime dimension
Classical network coding is not restricted to information streams consisting of individual bits. Indeed, it is common in the literature to consider signals consisting of elements from finite fields in general, including the fields Z d for d a prime [8,27]. As most proposed quantum hardware platforms involve operations on qubits, our work has focused mainly on linear network codes over Z 2 . However, our techniques work equally well over qudits of any prime dimension d, using generalisations of Clifford group operations.

Generalising the QLNC formalism
On a Hilbert space of dimension d, label the standard basis states by |0 , |1 , . . . , |d−1 . Let X d and Z d be unitary operators satisfying X |a = |a+1 (mod d) and Z |a = ω a |a for a ∈ {0, 1, . . . , d−1}, where ω = exp(2πi/d). These operators are the basis of a definition of the generalised Pauli group on qudits of dimension d [4,16]. The set of unitaries which preserves this extended Pauli group under conjugation corresponds to the Clifford group, and the effects of those operators on eigenstates of the X and Z operators can be simulated using an extension of the stabiliser formalism [10,16].
For the special case of d ≥ 2 a prime, we may define an extension of the QLNC formalism to qudits of dimension d by identifying the operations of the generalised Clifford group which correspond to the operations of the qubit QLNC formalism: • Preparation of the states |0 and |+ d = 1 √ d |0 + |1 + · · · + |d−1 ); • Performing (possibly classically controlled) X d and Z d operations on any qudit; • Measuring qudits in the eigenbasis of the Z d operator or the X d operator; • Addition operations Add d on pairs of qudits which are connected in the network G, whose effect on standard basis states are Add d |x |y = |x |y + x (mod d) .
We call circuits composed of these operations for a fixed d ≥ 2, "qudit QLNC circuits". These operations allow one to prepare states which are the analogue of parity function states, which one might call "linear function states", which have the form for linear functions f k (a) and φ(a), and where 0 ≤ N ≤ n. We may represent n-qubit linear function states states by (N +1) × (n+2) "linear function tableaus" T = C p , which represent the linear function state by specifying the coefficients of the functions f k and φ in the same way as in the qubit case. It is easy to show that preparation of the states |0 and |+ d may be represented by the same column/row insertion steps, and the effects of the unitaries X d , Z d , and Add d may be simulated in the same way through elementary column operations. (Indeed, one may use the same {0, 1}-matrices in each case, albeit with coefficients modulo d.) The procedures to simulate measurements are similar to the case d = 2, but must be described without relying (for instance) on 1 being the only non-zero element. It also becomes more helpful to describe the measurement outcomes as some element s ∈ Z d , representing a measurement of the ω s eigenstate either of X or of Z. As before, we put the tableau into reduced row echelon form, making the k th column (counting from 0) a pivot column if possible, where k is the qubit to be measured.
• For an X d -eigenbasis measurement: (a) If f k (a) = a g for an indeterminate which does not occur in any other qubit formula f j (a)i.e., if there is a single 1 in the g th row of C -then the state is unchanged by the measurement, and the measurement outcome is s = p g .
(b) Otherwise, let z N+1 be a new indeterminate (represented in C by adding a new row at the bottom), and choose a measurement outcome s ∈ Z d uniformly at random. If f k (a) is constant prior to measurement, let ∆ be the (N +2)dimensional column vector with 1 in the final row, and zero elsewhere; otherwise, if f k (a) = a g , let ∆ be the (N +2)-dimensional column-vector with −1 in row g and 1 in row N +1 (counting from 0), and zero elsewhere. We then add ∆ to the k th column of C, and subtract s∆ from p.
• For a Z d -eigenbasis measurement: (a) If f k (a) = c is a constant function, then the measurement leaves the state unchanged, and the measurement outcome is c.
(b) Otherwise, we select a measurement outcome s ∈ Z d uniformly at random. Let ∆ = se 0 − c k . For any column j of T = C p which contains a non-zero coefficient r j = 0 in the g th row (including the k th column itself), add r j ∆ to column j; then remove the row g entirely from the tableau.
The analysis for these operations is similar to that of the case d = 2. This allows us to simulate qudit QLNC circuits. Finally, note that the property of parity function tableaus, that their "parity function matrix" C has full rank, also holds for linear function tableaus for any d prime, as these properties only depend on the fact that these matrices are defined over a field (which is a property on which we have also relied to consider reduced row echelons when simulating measurements). As a result, those results (such as "termination" of qubits being welldefined) which rely on such rank properties are also true in the QLNC formalism on qudits of prime dimension.
It seems to us likely that, with some elaboration, the QLNC formalism may be extended to arbitrary dimensions d ≥ 2. However, such an elaboration must carefully accommodate the fact that not all non-zero coefficients are invertible modulo d.

Entanglement distribution using the qudit QLNC formalism
For qudits of prime dimension d, the natural analogues of Bell states and GHZ states are the states |x |x · · · |x n tensor factors .
These are evidently linear function states on qudits of dimension d. As all of the QLNC formalism for qubits (including the notion of qubit termination) generalises in an appropriate way to qudits -albeit possibly with a constant factor d−1 overhead, to realise some power of the Add d , Z d , or X d operations -we obtain the following results: Corollary 7 (to Theorem 4). Let d be prime. If a multiple multicast (including multiple unicast as a special case) classical Z d linear network code exists over a network G, from a set of transmitter nodes T = {t 1 , · · · , t N } with in-degree 0 to a corresponding set of receiver nodes R j = {r j,1 , · · · , r j,n j } with out-degree 0, then there is a QLNC circuit whose CNOT operations are located along the edges of G and distributes |Φ + d and |GHZ d,n j states between corresponding transmitter/receiver node sets. Moreover, this circuit has depth at most 2(d−1) (δ+2)(χ−1) + 1 time-steps, where δ is the largest in/out degree of any vertex in G, and χ is the chromatic number of G.
Corollary 8 (to Theorem 5). Let d be prime. Consider a multiple multicast (including multiple unicast as a special case) classical Z d linear network code exists over any subgraph of the graph G = G∪K n sending a unit rate stream, where each edge of the graph is a unit rate bi-directional edge (but not allowing fractional routing). Suppose that this code has a set of transmitting source vertices T = {t 1 , . . . , t N } for some N > 0, where the first N < N of these have corresponding receiver sets R j = {r j,1 , · · · , r j,n j } for 1 ≤ j ≤ N (with the remaining transmitters t N +1 , . . . , t N having signals which are not necessarily actually received by any "receiver" nodes). Suppose further that (a) the information transmitted on the edges of K n from any single node, and (b) the information transmitted by the nodes t 1 through t N , are linearly independent of each other. Then by simulating this linear network code by a QLNC circuit, with CNOT operations restricted to the same graph G and classically-controlled Pauli operations oriented along the other edges, the resulting protocol generates a product of |Φ + d and |GHZ d,n j states, where each |Φ + d or |GHZ d,n j is over each of the sets {t j , r j,1 , · · · , r j,n j } for all 1 ≤ j ≤ N .
The proofs of these statements are identical to the case d = 2, applying the extension of the QLNC formalism to d > 2 dimensional qudits.

Remarks on computational complexity
We now consider the computational complexity of the QLNC formalism, and also remark on the complexity of finding linear network codes.

Comparison of the QLNC formalism to the stabiliser formalism
Recall that a parity function tableau on n qubits is a matrix of size (N +1) × (n+2), where 0 ≤ N ≤ n is some number of indeterminates involved in the expression of the state. As every parity function tableau has the same first column, the amount of information can be bounded above by (N +1) × (n+1) bits. By allocating enough space for an (n+1) × (n+1) matrix, and by maintaining lists to record which rows and columns in this space are actually occupied, we suppose that the data structure used for the matrix allows for O(1) time row and column insertion and removal, apart from the time required to actually initialise the entries of new rows or columns.
Several of the QLNC circuit operations may be represented by very simple operations or transformations on the tableau: Others of the operations are somewhat more involved: • Performing measurements -destructive or otherwise -involves first putting the parity function tableau into a reduced row echelon form, which requires O(N 2 n) time. This dominates the run-time required for the remaining operations: -For an X measurement, the subsequent operations may involve adding a new row, which takes O(n + N ) time; and adding a vector of size O(N ) to two columns, which takes O(N ) time.
-For a Z measurement, the subsequent operations may involve adding a column vector of size O(N ) to O(n) columns, and removing a row and a column, which all together takes O(N n) time.
• Terminating a qubit requires a measurement, and also an appropriate set of qubits on which to perform Z operations. Finding the latter also involves putting the tableau in reduced row echelon form, and O(N ) further work to determine an appropriate correction set; thus this also takes time O (N 2 n).
A natural comparison to make is with the stabiliser formalism [1]. This also requires O(n 2 ) space, with little room for improvement beyond techniques to represent sparse matrices. Preparation of a fresh qubit in the stabiliser formalism similarly involves extending the matrix, and takes O(n) time; realising a CNOT, X, or Z operation takes time O(n). Using naïve techniques, simulating a measurement in the Stabiliser formalism may take time O(n 3 ), involving Gaussian elimination; this may be avoided using "destabiliser" methods [1] at the cost of doubling the size of the tableau to take O(n 2 ) time. In the worst case where N ∈ Θ(n), the run-time bounds for the QLNC formalism are then worse than those involving "destabiliser" methods; but for any circuit in which there is a bound N ∈ o(n 1/2 ), we obtain a better than constant factor improvement in the complexity of measurement, and a better than quadratic improvement in the complexity of simulating CNOT, X, and Z gates.
In summary, the computational advantage of the QLNC formalism, when simulating QLNC circuits, is the ability to take advantage of the potential for the parity function tableau to occupy space n 2 , in which case the operations required to transform it are less computationally costly. Even in the worst case, the fact that parity function tableaus have size n 2 + O(n), rather than size 2n 2 + O(n), will also yield a mild improvement in performance for unitary operations (while incurring a performance hit for measurements).

On the complexity of finding QLNC circuits for entanglement distribution problems
Here, we consider the complexity of finding a QLNC to perform a particular entanglement distribution task in a given network G.
It is clear that when a linear network code for the classical k-pairs (or multiple multicast) problem exists in a particular network G, we may easily convert this to a constant depth QLNC circuit to solve the corresponding entanglement distribution problem on a quantum platform with the same interaction topology G (with the mild restriction that nodes are either transmitters or receivers or relays, as previously discussed). However, it is not always easy to find such a linear network code. Lehman and Lehman [28] show that deciding whether a network code exists is NP-hard in general. As Kobayashi et al [26] note, the k-pair problem is thus itself NP-hard, as all network coding can be reduced to an instance of the k-pair problem [13].
Given that finding network codes is a hard problem in general, it is reasonable to ask whether reducing the problem of entanglement distribution to the problem of finding linear network codes is of any practical advantage. One answer to this is that the problem of classical network coding has already received significant attention (e.g., [13,14,[30][31][32]), and thus such a reduction enables existing results and understanding to be transferred to the problem of entanglement distribution. Furthermore, the existing proof of NP-hardness appears to require a somewhat specialised network architecture in principle. (To us, this seems to mirror the situation with the bounds on the depth of the "constant-depth" QLNC circuits described in Theorem 4: while the bound depends on parameters such as vertexchromatic number which are NP-hard to compute in general, in many practical examples they may be computed very easily.) Finally, as we allow unconstrained classical control in QLNCs (i.e., the classical control could be thought of as being transmitted through a completely connected graph, as in Section 3.3.2), we should expect it to be easier to find a QLNC for a network G, and perhaps to sometimes find a QLNC for entanglement distribution where there is no solution to the corresponding classical linear network coding problem.
In any case, as our results more generally allow an edge to be used more than once, it is not clear whether we should expect the problem of finding QLNC solutions to entanglement distribution to be similar to that of solving the k pairs problem. The complexity of this problem is open; though from our results, it is clear that it cannot be worse than NP-hard. We conjecture that it should be possible to do so in polynomial time.

Proof of Theorem 5
Finally, we present here a more thorough presentation of the proof of Theorem 5. In particular, we adopt a more concrete presentation in the hopes of describing in some detail what transformations of the states involved.
Let there be n qubits, ordered such that the first n 1 are prepared in the |+ state and the remaining n 2 = n − n 1 are prepared in the |0 state. The QLNC circuits described consist of four primitives: initialisation (i.e., preparation of qubits in the |+ or |0 state, as stated directly above); CNOT gates; measurements which can classically control Pauli-X gates on other qubits; and termination operations. Firstly, we note that the principle of deferred measurement can be used to express an equivalent circuit with the classically controlled X gates replaced by CNOT gates and deferred measurement on the control qubit, as shown in Fig. 12(a) and (b), and secondly, we address a generalised version of the circuit in question, as shown in Fig. 12(c). The remainder of the proof proceeds as follows: firstly, we relate the state of this generalised circuit after the network of CNOT gates to the actual circuit we want to express; secondly, we prove by induction that the state is correctly simulated by the QLNC formalism as the individual CNOT gates are executed; thirdly we show that the termination process does indeed remove qubits as required, without disturbing the rest of the state; and finally we show that the desired product of |Φ + and |GHZ states is only realised if and only if the measurements do not reveal information thereabout, and that the Gaussian elimination procedure described is necessary and sufficient to verify this. Fig. 12 illustrates a general instance of the circuit, in which U , in Fig. 12(a), is a block consisting of CNOT gates and classically controlled Pauli-X gates, in Fig. 12(b) the principle of deferred measurement is used to draw an equivalent circuit, with CNOT gates replacing Pauli-X in a block now labelledŨ , with measurements deferred until the end of the circuit. This allows us to write down the state directly afterŨ : Figure 12: Illustration of equivalent circuits used in the proof of Theorem 5, the three parallel vertical lines of descending size (i.e., a rotated 'earth' symbol, as used in electrical engineering) denotes termination: (a) shows the actual quantum circuit, consisting of qubits initialised in the |+ and |0 states, a network of CN OT gates, and measurements classically controlling Pauli-X gates, and some terminations; (b) shows the same circuit, but now with deferred measurement (such that the classically controlled Pauli-X gates can be represented as CN OT gates; and (c) shows the circuit with additional ancilla qubits entangled with the qubits initialised in the |+ state, as is required in the proof.
where i is binary number, later in the analysis we use i as the binary vector corresponding to the binary number i (i.e., the j th element of i is the j th digit of i) and we use each of |i and |i to denote the corresponding n q -qubit quantum state, where n q is the number of digits in i (and therefore the number of elements in i). In the analysis, it is helpful to consider the circuit in Fig. 12(c), in which n 1 ancilla qubits are prepended to the state. Each ancilla is initialised in the |0 state, and then is the target of a CNOT by one of the qubits initialised in the |+ states (that is, a different one of these qubits controls the CNOT for each of the ancillas). This allows the state beforeŨ to be expressed: which in turn allows us to express the state afterŨ : These extra ancillas have been introduced to make it easier to keep track of the state, and we later rely on the correspondence between (6) and (8) to show that these additional ancillas are indeed just an analytical device and do not affect the validity of the simulation of the actual circuit in the formalism.
We can now introduce the QLNC formalism in vectorised form. We order the vector such that the first n 1 elements correspond to the qubits initialised in the |+ state, and are therefore labelled with a unique symbol in the initialisation process. Furthermore, the effect of each of these performing a CNOT on (a distinct) one of the ancillas is to copy the label to the ancilla, therefore it is convenient to think of the ancillas as having been labelled. Let these labels be a 1 · · · a n 1 , and the actual qubits be labelled q 1 ...q n (which in general will be sums over the terms a 1 · · · a n 1 ). Stacking these up into vectors, we have that a = [a 1 , · · · , a n 1 ] T and q = [q 1 , · · · , q n ] T , such that: where L is a n × n 1 binary matrix which keeps track of how the labels of the various qubits are related to the ancilla labels, i.e., initially L = [1|0] T . In the QLNC formalism, the operation of a CNOT with the j th qubit controlling the k th qubit, is that the j th row of L is added to the k th row (modulo-2), that is L k, * ← L k, * + L j, * (here ' * ' means the entirety of that row). Moving on to the network of CNOT gates (including those which have been included by the deferred measurement equivalence), we prove by induction that the quantum state is in the form: where |ψ BC is the quantum state at an arbitrary point between |ψ B and |ψ C (i.e., within the block of CNOT gates,Ũ ). For the inductive proof, we observe that the initial definition of L (i.e., in the text below (9) is of a format that corresponds to this definition, i.e., for the initial state in (8). Turning to how the quantum state is changed by a CNOT gate, to simplify the notation (and without loss of generality) we re-order the qubits (and therefore the rows of L and q) such that the first qubit is the control, and the second the target, before the CNOT we have: where s.t. means 'such that', and |ψ i , |ψ i , |ψ i and |ψ i represent the remainder of the quantum state in each term, which is not required for this analysis. After the performing a CNOT gate on the first two qubits we have: which we can see is consistent with the operation of a CNOT where the first qubit controls the second in the QLNC formalism, i.e., the assignment L 2, * ← L 2, * + L 1, * , thereby completing the inductive proof. It is worth observing that, while our proposed formalism was conceptualised from the starting point of classical network codes (as emphasised in Corollary 6), the manner in which the state is tracked bears some resemblance to the quadratic representation of the Stabliser formalism as described by Dehaene and de Moor [12]. |ψ C is simply |ψ BC after all of the CNOT gates inŨ have been executed, and using the correspondence between (6) and (8) allows us to express |ψ C from (10): The next step in the circuit is the termination of any qubit which is left such that its label is the sum of two or more symbols, and indeed any other qubits with a single symbol label if desired. In the termination process the goal is, for any given post measurement state, that the corresponding qubits should be measured out in such a way that the superposition of quantum states is the same for the rest of the qubits, whichever state was measured. That is, if the state is |0 |φ + |1 |φ , termination and removal of the first qubit should leave the state |φ + |φ . This can be achieved in one of three ways: firstly, if the qubit to be terminated has a label which can be expressed exactly as a sum of qubits that are measured, then it can be measured out directly, as no additional information will be learned by doing so (in reality this measurement will have already taken place, although for the analysis this is treated as a deferred measurement, but this does not affect the validity of measuring it out directly). Conversely, in the case where the label of the qubit to be terminated is linearly independent of all of the other qubit labels, then it can also be measured out, as this will not reveal any information about the entangled superposition of interest. To see this, WLoG we re-order the qubits (including the ancilla qubits) such that the first qubit is to be terminated, from which we can express the state: |L 1, * i |L 2:n, * i , and thus we can see that because L 1, * is linearly independent of all of the other rows of L, measuring it out will not collapse any other terms in the superposition.
So we move onto the third option for termination, where the qubit to be terminated can be expressed as a sum of qubit labels, of which at least some haven't been measured. Once again, for simplicity of exposition and without loss of generality, we consider that it is the first qubit, labelled q 1 , that is to be terminated. To see how the termination process works, first let us write the linear expression of q 1 in terms of the other qubit labels: q 1 = r T q 2:n , where r is a binary vector that selects the other qubits whose labels sum to q 1 . We now express r = r a + r b , such that r a corresponds to qubits that are measured, and r b corresponds to qubits that are not measured. Thus we can re-express (13), noting that q 2:n = L 2:n 1 , * a, from (9): Next, we treat the X observable measurement in the equivalent form of a Hadamard gate, followed by a Z observable (computational basis) measurement. Thus, the Hadamard gate transforms (16) to: (17) After which the state is measured, and so we must address each of the cases where we measure each of 0 or 1. In the former we can see that the state collapses to: with the terminated qubit still included. Whereas if we measure 1, we get: However, by definition, zero is measured when there are an even number of ones in r b (L 2:n 1 , * i) and one is measured when there are an odd number of ones therein (where means element-wise multiplication). Therefore, applying a Pauli-Z (phase) gate to each qubit which corresponds to a one in r guarantees the correct adjustment, and this is exactly what is prescribed in the termination process. Thus, after the correction (19) becomes: Turning now to the alternative situation, where the existing measurements are such that r T a L 2:n 1 , * = 1, (15) becomes: (22) After which the state is measured, and so we must address each of the cases where we measure each of 0 or 1. In the former we can see that the state again collapses to: with the terminated qubit still included. Whereas if we measure 1, we get: However, applying the same correction as before, we get: So we can see that, regardless of the previous measurement outcomes, and the outcome of the X-basis measurement of the qubit being terminated, we get the same quantum state up to an unobservable global phase. Following the layer of terminations, we can express the state as: where we have omitted any qubits that have been measured out and any labels that are no longer present in any qubit label. Thus rows in L will have either exactly one, or more than one element equal to one (and the rest equal to zero, as it is a binary matrix). We know that all rows of L with multiple elements equal to one are measured (i.e., otherwise they would have been terminated), and in general some rows with exactly one element equal to 1 may be measured too. To verify that none of these measurements imparts information that would collapse the superposition of interest, we follow the same rationale as that described around (14). Specifically, we construct a n × n M matrix (where n M is the number of measurements), M such that each row corresponds to one measurement. For example, if we have five symbols in total, a 1 · · · a 5 , and we measure a qubit labelled a 1 ⊕ a 4 , the corresponding row of M would be [1, 0, 0, 1, 0]. We now re-order the columns of M such that the first n r correspond to symbols that aren't present in the final entangled state, and perform Gaussian elimination such that the matrix is in upper-echelon form, let this transformed version of M be denoted M . A necessary and sufficient condition for the measurements not to have imparted any information that collapses the final entangled state is that each row which is not all zeros should have at least one element equal to one in the first n r columns. An example of M is shown in (27), and the necessary and sufficient condition essentially means that the label of each measured qubit includes at least one unique symbol, not present in any other label (either those of other measured qubits, or in the labels of the qubits that compose the final state), and thus, by the same reasoning given in and around (14) means that the final state will not be collapsed by this measurement.

M =
Having performed these measurements, and verified the condition of not imparting information that collapses the superposition, we have the final state: where each row of L has exactly one element equal to one. Rows of L whose element equal to 1 is in the same column will be labelled with the same single symbol (i.e., according to the definition in (9)), and thus we can see that this will correspond to the product of |Φ + and |GHZ states as specified, thus completing the proof.

Summary
In this article, we consider the problem of entanglement distribution in quantum architectures with constraints on the interactions between pairs of qubits, described by a network G. We describe how this problem may be fruitfully reduced to solving the k pairs problem through linear network coding, on the same network G; and we describe how such codes may be simulated to achieve entanglement distribution using a shallow circuit, independent of the size of G or the distance over which the entanglement is to be distributed. We also present several novel observations about realising linear network codes through stabiliser circuits.
For the purposes of practically realising operations on practical quantum architectures, it will be of interest both to reduce the depth of circuits to distribute entanglement, and to efficiently discover protocols to do so. However, it will also be important to address issues which we have not considered here, such as the fidelity of the entanglement which is distributed to some known Bell state. We do not expect the quality of such Bell states to be independent of the distance over which such entangled states are distributed, or the number of Bell states which are distributed in parallel using QLNC circuits. Nevertheless, it may be feasible to consider techniques to mitigate what noise may be present. We hope that it may be possible to do so while incorporating the apparent benefits that QLNC circuits theoretically provide in the noiseless case.