Introduction

Entanglement is widely recognized as playing a critical role in quantum computation, error correction, communication, and sensing. A family of entangled states that features prominently in these applications are graph (or cluster) states. They are key resources in one-way quantum computing paradigms1,2 and in quantum error correction3,4,5,6. In addition, many quantum repeater schemes7,8,9,10,11 and quantum sensing protocols12,13 rely on graph states. Photonic graph states are especially important because photons are the predominant platform for measurement- and fusion-based computing, and, as flying qubits, they are the only viable choice for quantum networks14 and quantum imaging15,16.

Unfortunately, creating photonic resource states is fundamentally difficult. Because photons do not interact with each other, most attempts have focused on probabilistic generation schemes using linear optics and postselection17, which are very resource-intensive, severely limiting the size of the resulting states18,19. This bottleneck can in principle be overcome by instead using a deterministic approach in which entangled photons are produced directly from quantum emitters (i.e., matter qubits). One possibility would be to prepare a graph state on emitters20,21 and transduce it to photons, but this requires a number of emitters equal to the size of the target photonic graph state. This daunting resource overhead can be avoided by instead using sequential generation schemes. References22,23 put forward such an approach that works well for one-dimensional (1D) graph states24 and has led to experimental demonstrations25,26. However, in the general case where the entanglement structure is more complicated, this method scales exponentially in the size of the target state and can lead to long generation circuits, motivating the search for more efficient approaches. References27,28 put forward protocols for 2D lattice graphs that leverage the principle that entangled emitters can emit entangled photons. This idea was extended further to develop protocols that deterministically generate resource states for quantum repeaters29,30,31,32—tailored to color centers in refs. 33,34—and one-way computing35,36. References32,35 allowed for the re-interference of photons with emitters to further enhance flexibility in entanglement creation.

Despite this progress and the intense interest this approach has generated among experimentalists, existing graph state generation protocols are limited to a small subset of graphs or require a number of emitters that scales linearly with the graph size36,37. This is extremely resource-intensive, especially in light of the schemes for generating repeater graph states presented in refs. 29,31, which require only two emitters regardless of the number of photons. The required resources (number of emitters and entangling gates) is a critical factor that determines the practical feasibility of the protocol. For a general graph state, finding resource-efficient generation protocols in polynomial time remains an open problem.

Here, we address this challenge by presenting a general approach to generating arbitrary photonic graph states from quantum emitters. Given a target graph state, we show how to determine in polynomial time both the minimal number of emitters required to create it and an explicit generation protocol. The latter consists of a sequence of gate operations and measurements performed on the emitters. Moreover, our protocol naturally takes into account the order in which photons should be emitted, which can be an important consideration for applications, as it is generally preferable to emit photons in the order they are measured to avoid photon storage. Our method provides a recipe for doing this. The broad applicability of our method, its practical relevance, and its efficient use of resources make it ideally suited to the generation of any photonic graph state from various types of quantum emitters.

Results and discussion

Overview of the algorithm

Determining how to efficiently generate an arbitrary photonic graph state from a set of quantum emitters is highly nontrivial and markedly distinct from the problem of finding an efficient quantum circuit that creates a target state on a register of qubits38. Several additional challenges arise in the former, including the fact that qubits are both created and removed, and that different types of qubits (photons vs. emitters), with different roles and allowed gates, are involved. Depending on the experimental setup, there may also be further restrictions, e.g., emitted photons cannot interact with any other qubits following their emission (although schemes that re-interfere photons with emitters have been proposed32,35). Our method addresses these challenges by leveraging three main ingredients: the notion of the height function (which is related to the entanglement entropy), the stabilizer formalism, and the concept of time-reversed emission events and measurements, which we introduce here.

The first insight is to utilize the so-called height function, which is the entanglement entropy of the system as a function of the partition point when the system is arranged in a 1D lattice and partitioned into two subsystems39,40. This function provides information about the entanglement structure of the target state as well as the number of emitters required to produce it. The latter is equal to the maximum value of the height function (see below), which depends on the photon emission order. Optimizing this order is NP-hard in general, although we show that heuristic approaches exist for more structured graphs. Moreover, the height function plays a crucial role in determining the sequence of operations (gates and measurements) needed to generate the target graph state from the emitters.

A second key ingredient is the use of gates from the Clifford group. Given that arbitrary graph states can be generated solely with Clifford gates41,42, which were also exclusively used in the protocols of refs. 24,25,27,28,29,30,31,36, restricting ourselves to this set does not affect the generality of our approach. Clifford gates enable the use of the stabilizer formalism, such that we can manipulate Pauli operators instead of keeping track of the whole state. This makes the problem of finding the emission operation sequence tractable, reducing it from exponential to polynomial scaling due to the Gottesman–Knill theorem43.

A final key element in our algorithm is that we time-reverse the emission sequence. That is, we start from a target multi-photon graph state and an appropriate number of decoupled emitters (obtained from the height function for the target state), and we determine a sequence of emitter gates, “time-reversed measurements", and “photon absorption" events such that the target state is converted to a product state. This is somewhat reminiscent of disentangling circuits used for quantum state tomography of 1D systems44. The final state is a product state because, without loss of generality, photons that have not yet been emitted can be described by qubits prepared in the computational basis state \(\left|0\right\rangle \). Photon emission is then modeled as a two-qubit photon-emitter gate that brings the photon from \(\left|0\right\rangle \) into an entangled state with the emitters24. Because the photon absorption steps are time-reversed versions of photon emission, these too are described by photon-emitter gates.

The run time of the protocol solver algorithm scales as \({{{\mathcal{O}}}}({n}_{p}^{4})\), where np is the number of photons in the target graph state. This is a direct consequence of the fact that the algorithm is based on the stabilizer formalism (see Methods section). This is in contrast to previous methods22,23, which scale exponentially in np due to the need to perform singular value decompositions repeatedly. We also show that the number of gates in the final emission sequence scales at most as \({{{\mathcal{O}}}}({n}_{p}^{2})\) (see “Methods”). However, this assumes two-qubit gates can be applied between any pair of emitters. If this is not the case, then additional SWAP operations are needed, bringing the gate count up to \({{{\mathcal{O}}}}({n}_{p}^{3})\). Therefore, both the protocol solver and the resulting gate sequence obtains scale polynomially in the size of the target graph state.

Now we provide a more detailed description of the protocol solver algorithm. We begin with a target graph state \(\left|{\psi }_{p}\right\rangle \) of np photons and ne decoupled emitters, so that the total state is \(\left|{{\Psi }}\right\rangle =\left|{\psi }_{p}\right\rangle \otimes {\left|0\right\rangle }^{\otimes {n}_{e}}\). An np = 4 photon example graph is shown in Fig. 1a. This is what the state of the total system should be at the end of the generation sequence. np is set by the size of the desired photonic graph state \(\left|{\psi }_{p}\right\rangle \), while ne remains to be determined. We assume the graph representing \(\left|{\psi }_{p}\right\rangle \) is connected; if this is not the case, then the algorithm can be run separately for each connected subgraph. The state \(\left|{{\Psi }}\right\rangle \) is fully described by a set of n = np + ne stabilizers gm, m = 1, …, n, defined such that \({g}_{m}\left|{{\Psi }}\right\rangle =\left|{{\Psi }}\right\rangle \). The full set of n qubits can be arranged in a 1D lattice with site index x {0, 1, 2, …, n} (see Fig. 1b). Sites x = 1, …, np correspond to the photons and are ordered according to the desired photon emission ordering, while the sites x = np + 1, …, n are the emitters. The additional x = 0 site is included as a matter of convention. We can now define the height function h(x) = SA to be the bipartite entanglement entropy when the 1D lattice is divided into the subregion A = {1, 2, …, x} and its complement. Note that \({S}_{A}=\frac{1}{1-\alpha }{{{\mathrm{log}}}\,}_{2}{{{\rm{Tr}}}}({\rho }_{A}^{\alpha })\) can be any of the Rényi entropies; for stabilizer states, they are all equal45. In ref. 22, it was shown that the state of the emitted photons, \(\left|{\psi }_{p}\right\rangle \), can be represented by a matrix product state (MPS) with bond dimension \({2}^{{n}_{e}}\). Because the entanglement entropy of a MPS is given by the base-2 logarithm of the bond dimension46, it follows that ne is equal to the maximum value of h(x). The height function for the graph in Fig. 1a is shown in Fig. 1c. In this example, its maximum is 2, implying 2 emitters are needed. In general, the maximum of the height function is in fact the minimal number of emitters capable of generating the target graph state, as fewer emitters would be insufficient to match the bond dimension of any exact MPS representation.

Fig. 1: Illustration of the protocol solver algorithm.
figure 1

a An example of a 4-photon graph state. b The graph is mapped to a 1D lattice. c The height function is computed and found to have maximum value 2, implying 2 emitters are needed. These are added to the 1D lattice. d Starting from the target state and decoupled emitters, a time-reversed sequence of emitter gates, photon absorption events, and time-reversed emitter measurements is constructed, until all qubits are disentangled. Further details about this example can be found in the Supplementary Information.

The height function can be computed efficiently from the stabilizers. Because products of stabilizers are also stabilizers, there are many equivalent choices for the set {gm}. Here, we focus on a particular choice of the stabilizers that we refer to as the echelon gauge47, in which the stabilizer matrix has a row-reduced echelon form (see Methods). When the gm are in this gauge, the height function can be expressed as47

$$h(x)=n-x-\#\left\{{g}_{m}| {\mathtt{l}}({g}_{m}) > x\right\},$$
(1)

where l(gm) is the index of the left-most (smallest index) site on which gm acts nontrivially. The last term in Eq. (1) counts the number of stabilizers that act nontrivially only on sites to the right of (i.e., larger than) x. Although Eq. (1) depends on ne, this dependence cancels out for states like \(\left|{{\Psi }}\right\rangle \) in which the emitters are decoupled. Therefore we can obtain ne from the maximum of h(x) on the photonic sites, using only the stabilizers of \(\left|{\psi }_{p}\right\rangle \).

Once we have the number of emitters ne, we can run the protocol solver algorithm to determine the sequence of gates, time-reversed measurements, and photon absorption events needed to transform the target state \(\left|{{\Psi }}\right\rangle \) into the initial state \({\left|0\right\rangle }^{\otimes n}\), which corresponds to decoupled emitters and no photons. We first introduce a photon index j and initialize it to j = np. The algorithm then consists of four steps:

  1. (i)

    Transform the stabilizers gm into echelon gauge if they are not already, then compute the height function h(x).

  2. (ii)

    If h(j) ≥ h(j − 1), skip to step (iii). Otherwise apply a time-reversed measurement and update the gm accordingly.

  3. (iii)

    Apply a photon absorption operation on the j-th photon and update the gm accordingly. If j > 1, then set j → j − 1 and go to step (i). Otherwise, go to step (iv).

  4. (iv)

    All photons are now in state \(\left|0\right\rangle \). Apply a series of gates on the emitters to disentangle them, bringing the total state to \({\left|0\right\rangle }^{\otimes n}\).

This algorithm involves repeated applications of two basic operational primitives: time-reversed measurement and photon absorption. During the algorithm, the height function of the current state tells us which of these we need to perform next to bring the state closer to \({\left|0\right\rangle }^{\otimes n}\). Each photon absorption step disentangles one photon qubit from the rest, starting with the last-emitted photon, j = np, and working down to the first photon, j = 1. For our 4-photon example, the graphs at intermediate steps of the algorithm are shown in Fig. 1d. A step by step explanation of this example is given in the Supplementary Information. When the algorithm concludes, we can reverse the entire sequence to obtain an operation sequence that generates \(\left|{\psi }_{p}\right\rangle \) starting from ne decoupled emitters. We now describe each of the two operational primitives in more detail, the precise gates they introduce into the generation sequence, and their connection to the height function.

Photon absorption of the jth photon refers to a time-reversed version of photon emission. For concreteness, we focus on the case where emission is described by a CNOT gate between the photon and its emitter (with the emitter as the control), as in Ref. 24, although our algorithm can be adapted to any Clifford gate describing photon emission. Mathematically, the task of absorbing photon j requires finding a stabilizer ga that can be transformed to \({\sigma }_{j}^{z}\) by applying CNOTij, where i is an emitter site. It is possible to find such a stabilizer when h(j) ≥ h(j − 1). From Eq. (1), we see that this condition implies there must be at least one stabilizer, ga, such that l(ga) = j. This stabilizer has the form

$${g}_{a}={\sigma }_{j}^{\alpha }{\sigma }_{{i}_{1}}^{{\beta }_{1}}\cdots {\sigma }_{{i}_{s}}^{{\beta }_{s}},$$
(2)

where α, βk {x, y, z} label the nontrivial Pauli operators, and 1 ≤ j ≤ np < i1 <  < is ≤ n. Note that we can assume ga acts trivially on all photons with index larger than j since these have already been decoupled at this point in the algorithm. We also assume that ga acts nontrivially on at least one emitter site; if this is not the case, then photon absorption is unnecessary since the j-th photon is then already disconnected. To transform ga into \({\sigma }_{j}^{z}\), we can first apply a local Clifford operation on the j-th site and general Clifford operations on the emitters to transform \({g}_{a}\to {\sigma }_{j}^{z}{\sigma }_{i}^{z}\), where i > np is an emitter site. This can be done for example by applying local Clifford operations to transform ga to \({\sigma }_{j}^{z}{\sigma }_{{i}_{1}}^{z}\cdots {\sigma }_{{i}_{s}}^{z}\), and then applying CNOT gates on pairs of emitters to transform this to \({\sigma }_{j}^{z}{\sigma }_{i}^{z}\). Applying CNOTij brings this to \({\sigma }_{j}^{z}\), completing the absorption of the j-th photon. Note that we can choose any emitter to absorb the photon; typically, the emitter that requires the shortest circuit to transform ga into \({\sigma }_{j}^{z}\) is preferred. The resulting circuit is included in the time-reversed generation sequence.

Time-reversed measurements are applied whenever h(j) < h(j − 1), in which case photon absorption is not possible. Indeed, in this case, Eq. (1) implies #{gml(gm) = j} = 0, or in other words, a suitable ga does not exist. In order to absorb the next photon, we must therefore first find a way to increase h(j) relative to h(j − 1). This can be accomplished with a time-reversed measurement on an emitter. To perform this operation, we first rotate the state to \(\left|{{\Phi }}\right\rangle \otimes {\left|0\right\rangle }_{i}\), where \(\left|{{\Phi }}\right\rangle \) is a stabilizer state involving photons 1, …, j and emitters other than i. This can always be done using \({{{\mathcal{O}}}}({n}_{e})\) Clifford gates on emitters when h(j) < h(j − 1) (see Methods). Now notice that this state is obtained from the pre-measurement state \({\rm{CNOT}}_{ij}\left|{{\Phi }}\right\rangle \otimes {\left|+\right\rangle }_{i}\) when emitter i is measured to be in the state \({\left|0\right\rangle }_{i}\). Therefore, starting from \(\left|{{\Phi }}\right\rangle \otimes {\left|0\right\rangle }_{i}\), if we perform a Hadamard gate on emitter i followed by the gate CNOTij, we effectively reverse the measurement on the emitter. These operations transform the stabilizers gm in such a way that h(j) now satisfies h(j) ≥ h(j − 1) (see Methods), and we can proceed with the next photon absorption. The emitter gates, Hadamard on i, and CNOTij are all included in the time-reversed generation sequence.

Examples

We demonstrate our algorithm with several examples. The first is the important case of repeater graph states10, where we use our algorithm to obtain generation protocols that are more efficient than previously known ones. As a second example, we consider random graphs containing up to hundreds of photons and demonstrate the polynomial scaling of the resulting generation circuits. Additional examples, including modified repeater graph states, error correcting codes, and a simple example that illustrates the algorithm in detail can be found in Supplementary Notes 14.

Next, we apply our algorithm to find operation sequences that produce repeater graph states10. In addition to its importance in quantum network applications, this example also illustrates how different photon emission orderings impact the required number of emitters. Reference29 presented a generation protocol for a particular ordering that was devised essentially through guesswork. Our algorithm can be used to systematically find protocols for any ordering. An example of a 12-photon repeater graph state is shown in Fig. 2a. The graph contains a fully connected core of 6 photons, each of which is connected to a single external photon. Bell measurements are performed on pairs of these external photons, where the two photons in each pair come from different graph states. If a Bell measurement succeeds, then the two corresponding core photons are linked by an edge, and entanglement extends across two nodes of the repeater network. Having multiple external photons provides built-in redundancy that increases the likelihood that at least one Bell measurement between two repeater graph states is successful. Upon success, core photons are then measured in the z or x basis to remove photons connected to failed measurements or to create entanglement links between successful measurements, respectively. Because the external photons are measured first, it may be advantageous to emit these first when generating the graph state to reduce photon storage requirements. This corresponds to the photon ordering shown in Fig. 2a. The height function for this graph and photon ordering is shown in Fig. 2d, where it is evident that 6 emitters are needed to produce the state. However, if efficient photon storage is available, then the ordering shown in Fig. 2b may be preferable, where now external and core photons are emitted in an alternating sequence. This ordering reduces the number of emitters down to only 2, as shown in Fig. 2e. As we discuss further below, this illustrates our general finding that “natural” orderings in which neighboring vertices are emitted around the same time reduce the requisite number of emitters. This reduction in quantum resources becomes still more dramatic as the size of the graph increases; for orderings as shown in Fig. 2a, the number of emitters scales linearly with photon number, while for the natural ordering of Fig. 2b, the number of emitters remains at 2 regardless of the number of photons. This is shown explicitly in the Supplemental Information.

Fig. 2: Results for repeater graph states.
figure 2

a 12-photon repeater graph state in which external photons are emitted first. b Same graph state as in (a), but with “natural" emission ordering. c Same graph state as in (b) but with some unnecessary edges deleted. (d), (e) and (f) show the height functions of the states in (a), (b), and (c), respectively. g Emission circuit for state shown in (c), where H is the Hadamard gate, P = diag(1, i) is the phase gate, and X ≡ σx.

As discussed in ref. 36, some of the edges in the repeater graph can be removed without affecting the functionality of the repeater. Figure 2c shows an example of this in which 4 of the core edges are deleted. As shown in Fig. 2f, the number of emitters is still 2. However, removing the redundant edges reduces the depth of the resulting generation circuit, which is shown in Fig. 2g. This circuit contains four CNOTs between emitters and 1 intermediate measurement on an emitter, whereas the original protocol presented in ref. 29 requires five two-qubit gates and five intermediate measurements.

To demonstrate how our algorithm scales with the number of photons in the target state, we run it for random graphs ranging in size from np = 16 to np = 256 photons. These graphs are produced randomly using the Erdös–Rényi model48. In this approach, each random graph is constructed by connecting np vertices randomly with fixed probability p. We discard any graphs that contain disconnected vertices when sampling these realizations. The likelihood that such graphs arise becomes very small if p is chosen sufficiently close to 1. In Fig. 3, we show the maximum value, hmax, of the height function averaged over 1024 realizations for each value of np. Averaged measurement and gate counts are also shown. It is evident that hmax, and hence the number of emitters, scales linearly with np as np becomes large. The same is also true of the number of measurements. On the other hand, the number of CNOTs and the total number of gates in the resulting generation circuits scale quadratically with the number of photons in the target state. These results confirm both the polynomial scaling of our algorithm, which allows us to easily find generation protocols for graph states containing hundreds of photons, and the polynomial scaling of the resulting protocols, which makes them practical for near-term experiments.

Fig. 3: Scaling of emitter number and generation circuit depth.
figure 3

The maximum value of the height function \({h}_{\max }\), measurement counts, and gate counts needed to produce random graphs of size np are all averaged over 1024 graph realizations for each value of np drawn from an Erdös–Rényi ensemble with edge probability p = 0.95. Dashed curves are included to show the scaling with np and \({n}_{p}^{2}\). The error bars stand for the standard deviation of these realizations.

Photon emission ordering

A powerful feature of our algorithm is that it readily incorporates a desired photon emission ordering. This is encoded when we arrange the photons and emitters in a 1D lattice to define the height function. If no specific ordering is preferred, then ideally we would want to choose the ordering that minimizes the number of emitters ne. However, the task of finding this optimal ordering is NP-hard, as we show in Methods. Nevertheless, one can still look for heuristic solutions to the problem. In fact, the expression for the height function in Eq. (1) makes it clear that this function is suppressed for orderings in which the stabilizers, when expressed in the echelon gauge, are supported predominantly on high-index sites on the right side of the 1D lattice. This tends to occur for “natural" orderings in which neighboring photons in the graph are emitted around the same time, because in this case the stabilizers are localized on the 1D lattice. This was illustrated with our repeater graph state example in the previous section. The extent to which the stabilizers can be localized in this way depends on the graph of course. For an N × M square lattice, it is inevitable that some neighboring vertices will be separated by M steps in the emission sequence (assuming M < N), and so the number of emitters is of order M. On the other hand, for other graph structures like those of the repeater graph states, far fewer emitters may be needed, provided a natural photon ordering is used. Note that in this example, as for many graphs, edges between remote vertices cannot be avoided (see Fig. 2b). Despite this, we showed that optimal orderings for which the height function remains small can still be found. Thus, emitting neighboring vertices around the same time is sufficient but not always necessary to keep the number of emitters small.

In summary, we presented an efficient algorithm to construct polynomial-depth operation sequences that produce arbitrary multi-photon graph states from a minimal number of quantum emitters. By reducing both the number of photon sources and the number of quantum operations that need to be performed on them, our method brings the wide range of quantum information applications that rely on entangled photon resource states closer to experimental reality.

Methods

Echelon gauge

The echelon gauge was first defined in ref. 47, where it was called row-reduced echelon form. In this gauge, the stabilizer tableau has a recursive row-reduced form based on the following three types of matrices:

where σ, σ1, and σ2 are nontrivial Pauli matrices, and σ1 ≠ σ2. In this work, we always choose σ2 = σz, and σ1 can be either σx or σy. The full tableau cannot have the first form shown above (with only identities in the first column), because this case does not apply to pure states. However, the submatrix M can follow any of the above three patterns, and the structure iterates recursively. The stabilizers can be transformed into this gauge starting from any other by performing a series of row reductions, as described in Ref. 47. In the echelon gauge, the independent stabilizers acting on \(\bar{A}=\{x+1,\ldots ,n\}\) appear at the bottom right of the tableau. Therefore, starting from the formula for the entanglement entropy for subregion \(\bar{A}\) of a stabilizer state49, \({S}_{\bar{A}}={n}_{\bar{A}}-| {{{{\mathcal{G}}}}}_{\bar{A}}| \), where \({n}_{\bar{A}}\) is the size of \(\bar{A}\) and \(| {{{{\mathcal{G}}}}}_{\bar{A}}| \) is the number of independent stabilizers acting on \(\bar{A}\), and using \(h(x)={S}_{A}={S}_{\bar{A}}\), we obtain Eq. (1).

Time-reversed measurements

Above, we saw that when the total state of the system has the form \(\left|{{\Phi }}\right\rangle \otimes {\left|0\right\rangle }_{i}\), where i is an emitter site, we can perform a time-reversed measurement to convert this to the pre-measurement state CNOT\({\rm{CNOT}}_{ij}\left|{{\Phi }}\right\rangle \otimes {\left|+\right\rangle }_{i}\). Here, we clarify two important questions regarding this process: (i) When and how can we bring the system into the state \(\left|{{\Phi }}\right\rangle \otimes {\left|0\right\rangle }_{i}\)? (ii) How can we see that a time-reversed measurement on this state increases h(j), as needed for a subsequent photon absorption process?

Regarding question (i), when h(j) < h(j − 1), we can always find a set of Clifford gates that act purely on the emitters that will transform the state of the system into \(\left|{{\Phi }}\right\rangle \otimes {\left|0\right\rangle }_{i}\). To see this, first note that h(j) = h(np), as follows from Eq. (1) when photons j + 1 through np are in state \(\left|0\right\rangle \). Using that the height function is bounded from above by ne, we then have h(np) = h(j) < h(j − 1)≤ne. On the other hand, from Eq. (1) we have h(np) = ne − #{gml(gm) > np}. Together, these results imply #{gml(gm) > np} > 0, or in other words, there is at least one stabilizer that is supported solely on the emitter sites. We can therefore transform this stabilizer into \({\sigma }_{i}^{z}\) using at most \({{{\mathcal{O}}}}({n}_{e})\) Clifford gates on the emitters, bringing the state to \(\left|{{\Phi }}\right\rangle \otimes {\left|0\right\rangle }_{i}\). We can then convert this stabilizer to \({\sigma }_{i}^{x}\) by applying a Hadamard gate on site i. This prepares the system for the second part of the time-reversed measurement process, which is the gate CNOTij.

We answer question (ii) by proving the following theorem:

Theorem 1: If h(j) < h(j − 1) and the i-th qubit (i > j) is stabilized by \({\sigma }_{i}^{x}\), then applying CNOTij will boost h(x) → h(x) + 1, x {j, j + 1,   , i − 1}.

Proof: We are assuming that h(j) < h(j − 1), which from Eq. (1) implies #{gml(gm) = j} = 0. Now consider how the stabilizers transform under CNOTij. If l(gm) < j before the gate, then l(gm) remains invariant, and the contributions of these stabilizers to h(x) remain the same after the gate. The only potential changes to h(x) come from stabilizers gm for which l(gm) > j. These stabilizers necessarily have \({\mathbb{1}}\) on the j-th site. Stabilizers among this set that have \({\mathbb{1}}\) or \({\sigma }_{i}^{z}\) on the i-th site will be unchanged by the CNOTij gate. However, if one or more of these stabilizers have \({\sigma }_{i}^{x}\) or \({\sigma }_{i}^{y}\) before the gate, then afterward, these stabilizers will contain \({\sigma }_{j}^{x}\). Consequently, h(j) increases, while h(j − 1) remains the same. In the echelon gauge, there can only be one stabilizer with \({\sigma }_{j}^{x}\) as the left-most nontrivial Pauli. Therefore, h(j) → h(j) + 1 when CNOTij is applied. Moreover, if the ith qubit is stabilized by \({\sigma }_{i}^{x}\), then this becomes \({\sigma }_{j}^{x}{\sigma }_{i}^{x}\) after the gate, and so the height function for all sites between j − 1 and i increases: h(x) → h(x) + 1 x {j, j + 1,   , i − 1}. □

Scaling analyses

Here, we determine the complexity of both the protocol solver algorithm itself and the resulting graph state generation circuit. Regarding the algorithm, the main factor that determines the complexity is the need to restore the stabilizers to the echelon gauge after each operation is applied. Transforming a n-qubit stabilizer state into the echelon gauge generally requires \({{{\mathcal{O}}}}({n}^{3})\) steps, which is the complexity of Gaussian elimination. Another important factor is the process of determining which gates need to be applied in preparation for photon absorption or time-reversed measurement. Solving for each set of gates takes no more than \({{{\mathcal{O}}}}({n}_{e}n)\) steps, which is the number of entries in the emitter part of the stabilizer tableau. Thus, the Gaussian eliminations needed to restore echelon gauge dominate the scaling. In the worst case where nen, our algorithm will then take \({{{\mathcal{O}}}}({n}^{4})\) steps, where the additional factor of n comes from the fact that the algorithm requires \({{{\mathcal{O}}}}({n}_{p}) \sim {{{\mathcal{O}}}}(n)\) iterations.

As for the complexity of the output generation circuit, there are at most \({{{\mathcal{O}}}}({n}_{e})\) operations between any two photon emissions. For example, \({{{\mathcal{O}}}}({n}_{e})\) gates are needed to transform ga into the appropriate form for photon absorption. Thus, the depth of the circuit acting on the emitter qubits is at most \({{{\mathcal{O}}}}({n}_{p}{n}_{e})\). In the worst case where ne ~ np, the scaling is then \({{{\mathcal{O}}}}({n}_{p}^{2})\), which is consistent with Fig. 3. Nevertheless, due to the fact that some long-range two-qubit gates may arise, and given that these are usually decomposed as \({{{\mathcal{O}}}}({n}_{e})\) short-ranged two-qubit gates in real devices, the overall circuit depth may become \({{{\mathcal{O}}}}({n}_{p}{n}_{e}^{2})\).

Complexity of finding optimal photon emission orderings

We can show that the task of finding optimal emission orderings is NP-hard by mapping this to a known graph theory problem. Define Γij to be the adjacency matrix of the graph representing the target state \(\left|{{\Psi }}\right\rangle \). References. 45 showed that we can obtain the height function from Γij using the formula \(h(x)={{{{\rm{rank}}}}}_{2}({{{\Gamma }}}_{A\bar{A}})\), where \({{{\Gamma }}}_{A\bar{A}}\) is the submatrix of Γij with row indices iA = {1, 2,   , x} and column indices \(j\in \bar{A}\). Note that this expression does not simplify the computation of h(x); it can take more steps to find the maximum compared to using Eq. (1) since the former performs Gaussian eliminations for \({{{\mathcal{O}}}}({n}_{p})\) rounds, while the latter only takes one round. However, the maximum value of this alternative expression for h(x) is precisely equal to a graph theoretic property known as linear rank-width (LRW)50. The task of finding an optimal photon emission ordering is therefore equivalent to finding the graph isomorphism that minimizes the LRW, which has long been studied in coding theory in the context of optimizing block code trellises51. Unfortunately, determining whether a simple connected graph has an LRW bounded from above by a positive integer k (i.e., \({\max }_{x}h(x)\le k\)) has been shown to be NP-hard52,53. Therefore, it is unlikely this problem can be solved efficiently for large, arbitrary photonic graph states unless P = NP. Nevertheless, if the parameter k is set to 1, this problem can be answered in polynomial time54. If the parameter k is set to larger values, a recent work55 showed that this problem can be reduced to a fixed parameter tractable problem. Specifically, its answer, along with the sequence solution (if it exists), can be determined in \({{{\mathcal{O}}}}(f(k){n}_{p}^{3})\) steps, where f(k) is an exponentially large function of k. However, the growth of f(k) is so rapid that this result is not likely to be of practical use for photonic graph state generation.