Introduction

Photonic qubits are a promising candidate for quantum computing with advantages such as long decoherence time even at room temperature. Among different encoding schemes, those of dual-rail allow one to detect photon losses by counting the total photon number and manipulate and measure single qubits via linear optical elements and photodetectors1. A representative way to achieve universal quantum computing in linear optical systems is measurement-based quantum computing (MBQC)2,3 processed by single-qubit measurements on a multi-qubit graph state. In particular, a family of graph states called Raussendorf-Harrington-Goyal (RHG) lattices4,5,6 permits universal fault-tolerant quantum computing7,8,9.

The generation of RHG lattices, which is a significant challenge for realizing fault-tolerant optical MBQC, can be done by entangling multiple small resource states with fusions of types I and/or II10. Both types of fusions are not ideal in linear optics because of theoretical limitations and environmental factors such as photon losses. Fusion success rates cannot exceed 50% without additional resources11 for single-photon qubits, which is far too insufficient to implement MBQC12. There exist several types of approaches to overcome this shortcoming. Some examples include (i) different types of encoding strategies with coherent states13,14, hybrid qubits15,16, and multiphoton qubits17,18 that significantly improve error thresholds and resource overheads18, (ii) adding ancillary photons to boost the success rate of a type-II fusion to 75%19,20, which enables MBQC with the renormalization method21, (iii) redundant structures added to resource states to replace a single fusion by multiple fusion attempts22,23,24, and (iv) the use of squeezing for teleportation channels25 or inline-processes26,27.

Previous studies frequently treated fusion failures with bond disconnection28,29,30 or qubit removals12,15,18,21. However, to accurately evaluate the performance of computing protocols, the detrimental effects of nonideal fusions affecting nearby qubits should be analyzed more rigorously. In this work, we study how nonideal fusions corrupt stabilizers and how errors arising from such corruption can be tracked during the generation of graph states. Using a Bayesian approach and the stabilizer formalism, we can now assign error rates with strong posterior evidence from measurement data on certain qubits in the final lattice, thereby enabling much more realistic error simulations and adaptive decoding of syndromes.

We then propose a linear-optical fault-tolerant MBQC protocol termed a “parity-encoding-based topological quantum computing (PTQC),” which employs the parity encoding31 and concatenated Bell-state measurement (CBSM)32. The protocol requires on-off or single-photon resolving detectors, optical switches, delay lines, and three-photon Greenberger-Horne-Zeilinger (GHZ-3) states that can be generated deterministically using current technology33. (A single-photon resolving detector discriminates between zero, one, and more than one photons entering the detector.) We analyze the loss-tolerance of the protocol while exhaustively tracking the detrimental effects of nonideal fusions. The resource overhead in terms of the number of required GHZ-3 states is also investigated. To minimize it, we introduce a graph-theoretical method for optimizing the process of constructing resource states, which is generalizable for other MBQC schemes. By comparing PTQC with three other known approaches using simple repetition codes, redundant tree graphs, and single-photon qubits with boosted fusions assisted by ancillary photons, we show that our protocol is advantageous over these protocols in terms of the photon loss threshold per component and the resource overhead.

We denote the four Bell states by \(\left\vert {\phi }^{\pm }\right\rangle := \left\vert 0\right\rangle \left\vert 0\right\rangle \pm \left\vert 1\right\rangle \left\vert 1\right\rangle\) and \(\left\vert {\psi }^{\pm }\right\rangle := \left\vert 0\right\rangle \left\vert 1\right\rangle \pm \left\vert 1\right\rangle \left\vert 0\right\rangle\) (normalization coefficients are omitted) and call “±” its sign and “ϕ” or “ψ” its letter. An ideal Bell-state measurement (BSM) entails the measurements of XX and ZZ on two qubits, whose outcomes are addressed as its sign and letter outcomes, respectively. We use the polarization of photons as the degree of freedom to encode quantum information and denote the horizontally (vertically) polarized single-photon state by \(\left\vert {{{\rm{H}}}}\right\rangle\) (\(\left\vert {{{\rm{V}}}}\right\rangle\)).

For a given graph G of qubits, a graph state \(\left\vert G\right\rangle\) is defined as the state stabilized by \({S}_{v}:= {X}_{v}{\prod }_{{v}^{{\prime} }\in N(v)}{Z}_{{v}^{{\prime} }}\) (that is, \({S}_{v}\left\vert G\right\rangle =\left\vert G\right\rangle\)) for each vertex v, where Xv and Zv are respectively Pauli-X and Z operators on the qubit v and N(v) is the set of the vertices connected with v. \(\left\vert G\right\rangle\) can be generated by placing a qubit initialized as \(\left\vert +\right\rangle := \left\vert {{{\rm{H}}}}\right\rangle +\left\vert {{{\rm{V}}}}\right\rangle\) on each vertex of G and applying a controlled-Z gate on every pair of qubits connected by an edge in G. However, since the direct implementation of a controlled-Z gate for photonic qubits demands multi-photon interaction, linear optical MBQC typically takes an approach to construct a graph state by merging multiple small resource graph states via fusion operations10,15,18,21,22,23,24,28,29,30,34.

Among the two types of fusions10, we only consider type II because of two reasons: (i) A type-I fusion may convert photon losses into unknown Pauli errors24, which is not desirable since Pauli errors are generally harder to overcome than photon losses. (ii) There are known fault-tolerant type-II fusion schemes for encoded logical qubits, such as the one in Ref. 32. A type-II fusion is done by measuring XZ and ZX on two qubits. In practice, it is realized by applying the Hadamard gate on one of the qubits and then performing a BSM on them. For two qubits (v1,v2), if {v1}N(v1) and {v2}N(v2) are disjoint, the effect of a fusion on the qubits is to connect (disconnect) every possible pair of disconnected (connected) qubits, one from N(v1) and the other from N(v2), up to several Pauli-Z operators determined by the BSM outcome. These Pauli-Z operators are compensated by updating the Pauli frame35 classically. This effect can be checked by tracking stabilizers, as shown in the example of Fig. 1a. Here, the stabilizer \({X}_{1}{Z}_{0}{X}_{{0}^{{\prime} }}{Z}_{{1}^{{\prime} }}{Z}_{{2}^{{\prime} }}\) (colored in green) before the fusion is transformed into \({m}_{{{{\rm{sign}}}}}{X}_{1}{Z}_{{1}^{{\prime} }}{Z}_{{2}^{{\prime} }}\) after the fusion, where msign{±1} is the sign outcome of the BSM if the Hadamard gate is applied on qubit 0. The other two stabilizers \({Z}_{1}{X}_{0}{Z}_{{0}^{{\prime} }}{X}_{{1}^{{\prime} }}\) (colored in purple) and \({Z}_{1}{X}_{0}{Z}_{{0}^{{\prime} }}{X}_{{2}^{{\prime} }}\) that commute with the fusion can be transformed in similar ways. Consequently, the marginal state on the unmeasured qubits is equal to the merged graph state up to several Pauli-Z operators, as presented in Fig. 1b.

Fig. 1: Example of a type-II fusion.
figure 1

A type-II fusion is done by measuring \({Z}_{0}{X}_{{0}^{{\prime} }}\) and \({X}_{0}{Z}_{{0}^{{\prime} }}\) on the two graph states. a Two stabilizers (green and purple operators) become those of the resulting graph state up to sign factors (the sign or letter outcome msign, mlett of the BSM) after the fusion. b The final state is the depicted graph state, where the presented Pauli-Z operators are applied.

We consider errors of qubits in the “vacuum” measured in the X-basis, which occupies most of the area in the RHG lattice4; thus, X-errors do not affect the results. Henceforth, every error mentioned is a Z-error.

Results

Bayesian error tracking for nonideal fusions

We now introduce the methodology to track the errors caused by nonideal fusions. Let us revisit the example in Fig. 1, supposing that the qubits are single-photon polarization ones and there are no photon losses. Then a BSM can discriminate between only two Bell states (say, \(\left\vert {\psi }^{\pm }\right\rangle\)) among the four without additional resources36; see Fig. 2 for the scheme. The intact final state \(\left\vert {C}_{{{{\rm{f}}}}}\right\rangle\) is obtained only when the BSM succeeds. When the BSM fails (which is heralded), mlett is determined while msign is left completely ambiguous. In other words, the respective posterior probabilities that the input states are \(\left\vert {\phi }^{+}\right\rangle \,{\text{and}}\, \left\vert {\phi }^{-}\right\rangle\) for the obtained photodetector outcomes are equal, assuming that the four Bell states have the same prior probability. This assumption can be justified by the fact that the marginal state on qubits 0 and \({0}^{{\prime} }\) before the fusion is maximally mixed; see Supplementary Note 1 for the proof. Therefore, we fix the value of mlett and randomly assign that of msign. Then, the operator \({m}_{{{{\rm{sign}}}}}{X}_{1}{Z}_{{1}^{{\prime} }}{Z}_{{2}^{{\prime} }}\), which is originally a stabilizer of \(\left\vert {C}_{{{{\rm{f}}}}}\right\rangle\), gives ±1 randomly when it is measured after the failed BSM. Whereas, the other two stabilizers \({m}_{{{{\rm{lett}}}}}{Z}_{1}{X}_{{1}^{{\prime} }}\) and \({m}_{{{{\rm{lett}}}}}{Z}_{1}{X}_{{2}^{{\prime} }}\) are left unperturbed. The key point is that this situation is equivalent to a 50% chance of an erroneous qubit 1 in \(\left\vert {C}_{{{{\rm{f}}}}}\right\rangle\) in terms of stabilizer statistics. In other words, both situations give the same statistics if the stabilizers of \(\left\vert {C}_{{{{\rm{f}}}}}\right\rangle\) are measured; thus, every process in MBQC described with the stabilizer formalism works in the same way.

Fig. 2: BSM scheme for single-photon polarization qubits.
figure 2

A BSM uses three polarizing beam splitters (PBSs), 90 and 45 wave plates, and four (A--D) photodetectors (single-photon resolving or on-off detectors). A PBS transmits (reflects) photons polarized horizontally (vertically). The scheme distinguishes \(\left\vert {\psi }^{\pm }\right\rangle\): \(\left\vert {\psi }^{+}\right\rangle\) if detectors (A, C) or (B, D) detect one photon respectively and \(\left\vert {\psi }^{-}\right\rangle\) if detectors (A, D) or (B, C) detect one photon respectively. If otherwise, it fails or detects a loss, which can be distinguished by the total number of detected photons provided that single-photon resolving detectors are used. Two distinguishable Bell states can be chosen by putting or removing wave plates appropriately before the first PBS.

Generally, a nonideal BSM gives one of the possible outcomes and the posterior probability of each Bell state for the outcome can be calculated with the Bayesian theorem, assuming equal prior probabilities for all four Bell states. Accordingly, the Bell state with the highest posterior probability is selected as the result of the BSM, and the probability qsign (qlett) that the selected sign (letter) is wrong can be obtained as well. These error probabilities are “propagated” into nearby qubits in a way that the stabilizer statistics are preserved. For example, if the fusion in Fig. 1 is nonideal in such a way, it is equivalent to qubit 1 having an error with probability qsign and qubits \({1}^{{\prime} }\) and \({2}^{{\prime} }\) having correlated errors with probability qlett. We term a qubit with a nonzero error rate “deficient.”

Additionally, if a qubit participating in a fusion is erroneous, this error is propagated to the qubits on the opposite side. For example, an erroneous qubit 0 in Fig. 1 induces an error in the \({X}_{0}{Z}_{{0}^{{\prime} }}\) measurement, which is equivalent to erroneous qubits \({1}^{{\prime} }\) and \({2}^{{\prime} }\).

The above error tracking methodology can be utilized for accurate and effective error simulations. The method can precisely locate qubits affected by unsuccessful fusions, which is closer to reality than simple bond disconnection or qubit removal. Since unsuccessful fusions are now regarded as Pauli error sources, we no longer need lattice deformation and the construction of supercheck operators12,37. Instead, the error probabilities on individual qubits are employed for decoding syndromes in an adaptive manner (with decoders such as the weighted minimum-weight perfect matching one), which may be particularly effective if the probabilities are between 0 and 1/2 since regarding such errors as just removal of qubits is a loss of information.

Building an RHG lattice

An RHG lattice can be built with two types of linear three-qubit graph states called central and side “microclusters”21,28. The process is composed of two steps (see Fig. 3): In step 1, a central microcluster and two side microclusters are merged by two fusions to form a five-qubit graph state named a “star cluster” composed of one central qubit and four side qubits. In step 2, the side qubits of star clusters are fused to form an RHG lattice. Eventually, the lattice includes only the central qubits, which are measured in appropriate bases for MBQC. For step 2, we consider two options: (i) Star clusters with successful step-1 fusions may be post-selected, or (ii) all generated star clusters are used regardless of the fusion results. The locations of the Hadamard gates during fusions (called “H-configuration”) may be chosen arbitrarily. Here, we define two specific H-configurations: “Hadamard-in-center (HIC)” and “Hadamard-in-side (HIS).” In the HIC (HIS) configuration, the Hadamard gates in step 1 are applied on qubits in the central (side) microclusters, as shown in Fig. 3. Whereas the Hadamard gates in step 2 are arranged in the same pattern for both configurations.

Fig. 3: Lattice building process with microclusters.
figure 3

The orange boxes indicate fusions. In step 1, side and central microclusters are fused to form a star cluster. The locations of the Hadamard gates are marked as “C” ("S'') for the HIC (HIS) configuration. In step 2, multiple star clusters are fused to form an RHG lattice. The macroscopic picture of step 2 in a unit cell of the lattice is depicted in the lower right. The locations of the Hadamard gates are marked as orange dots. The error probabilities of qubits assigned by one fusion in each step for the HIC configuration are written in red, where qsign (qlett) is the sign (letter) error probability of the BSM. Errors in the side qubits remaining after step 1 (purple dashed squares) are propagated to central qubits during step 2 (purple dashed arrows).

Nonideal fusions during lattice building render some central qubits in the final lattice deficient, as shown in Fig. 3 when the HIC configuration is used. When the HIS configuration is used, the positions of qsign and qlett in the figure are swapped. Note that errors in the side qubits are propagated to the nearest central qubits after step 2. Correlation between the sign and letter errors of a fusion, if any, can be neglected if the primal and dual lattices are considered separately, since these errors respectively affect primal and dual4 qubits (or vice versa).

Noise model

For analyzing the following linear optical quantum computing protocols, we consider a noise model where each photon suffers an independent loss with probability η, which arises from imperfections throughout the protocol: GHZ-3 states (which are initial resource states), delay lines, beam splitters, optical switches, and photodetectors. We assume that noise that cannot be modeled with photon losses such as dark counts is negligible. Note that not only nonideal fusions but also photon losses in central qubits, which are detectable by on-off detectors, may incur deficiency. If the measurement outcome of a central qubit cannot be determined due to photon losses, we select the outcome randomly and assign an error rate of 50% to the qubit.

Parity-encoding-based topological quantum computing

We introduce the linear-optical parity-encoding-based topological quantum computing (PTQC) protocol, where fusion success rates are boosted by using multiphoton qubits for all qubits that participate in fusions and single-photon polarization encoding is used for central qubits. The parity encoding31 is employed for the multiphoton qubits, which are fused by CBSM32. On-off or single-photon resolving detectors are used as photodetectors, and GHZ-3 states, which can be generated linear-optically38, are regarded as basic resource states. The (n, m) parity encoding defines a basis as

$$\left\vert {0}_{{{{\rm{L}}}}}\right\rangle := {\left\vert {+}^{(m)}\right\rangle }^{\otimes n},\,\,\,\left\vert {1}_{{{{\rm{L}}}}}\right\rangle := {\left\vert {-}^{(m)}\right\rangle }^{\otimes n},$$
(1)

where

$$\left\vert {\pm }^{(m)}\right\rangle := {(\left\vert {{{\rm{H}}}}\right\rangle +\left\vert {{{\rm{V}}}}\right\rangle )}^{\otimes m}\pm {(\left\vert {{{\rm{H}}}}\right\rangle -\left\vert {{{\rm{V}}}}\right\rangle )}^{\otimes m}.$$
(2)

The Hilbert space has a hierarchical structure composed of three levels: the lattice, block, and physical levels with respective bases \(\{\left\vert {0}_{{{{\rm{L}}}}}\right\rangle ,\left\vert {1}_{{{{\rm{L}}}}}\right\rangle \}\), \(\{\left\vert {\pm }^{(m)}\right\rangle \}\), and \(\{\left\vert {{{\rm{H}}}}\right\rangle ,\left\vert {{{\rm{V}}}}\right\rangle \}\). In the original CBSM scheme32, a BSM of a certain level is decomposed into multiple BSMs of one level below. Our current CBSM scheme slightly differs from the original one in the following two areas: (i) We consider two types of photodetectors: single-photon resolving and on-off detectors. A physical-level BSM can discriminate between a photon loss and failure only if single-photon resolving detectors are used. (ii) The letter outcome of a lattice-level BSM is obtained by a weighted majority vote of block-level letter outcomes. See the Methods section for details of the CBSM scheme and its error rates.

For practical reasons, we consider generating “post-H” microclusters (that is, the states obtained by applying several lattice-level Hadamard gates on microclusters) directly from GHZ-3 states, instead of generating microclusters first and then applying the lattice-level Hadamard gates for the fusions. Figure 4a depicts the central and side post-H microclusters for the HIC and HIS configurations. A post-H microcluster can be generated up to several physical-level Hadamard gates by performing physical-level BSMs or fusions (referred to as “merging operations”) between multiple GHZ-3 states according to a predetermined “merging graph,” as shown in the example of Fig. 4b. Note that the merging graph may be not unique for a post-H microcluster. However, each merging operation has a low success rate of less than or equal to 50%, which may lead to extensive usage of GHZ-3 states for generating a post-H microcluster successfully. Thus, the generation process, which is determined by the merging graph and the order of the merging operations, should be adjusted carefully to minimize the resource overhead. To optimize the merging order, our protocol utilizes a graph edge coloring algorithm, based on the idea that merging operations for non-adjacent edges can be performed simultaneously. See the Methods section for details of the structures of post-H microclusters, their generation, and the resource optimization problem.

Fig. 4: Structure and generation of post-H microclusters for PTQC.
figure 4

a Schematics of central and side post-H microclusters for PTQC with the HIC and HIS configurations. The marks “HL” indicate the locations of the lattice-level Hadamard gates. b Example of a process generating a post-H microcluster from GHZ-3 states. Each GHZ-3 state is represented by a triangle whose vertices indicate its three photons. An orange line connecting two vertices and a mark “H” next to a vertex respectively mean a fusion and Hadamard gate performed on the photon(s). The graph of the triangles connected with the orange lines is called a merging graph.

For error simulations, we consider the logical identity gate with the length T of 4d + 1 unit cells along the simulated time axis, where d is the code distance. All the fusion outcomes are sampled from appropriate probability distributions, and the corresponding error rates are assigned to individual central qubits according to the process described earlier. These error rates are exploited when decoding syndromes by the weighted minimum-weight perfect matching in the PyMatching package39. The loss thresholds are calculated by finding the intersections of logical error rates for d = 9 and d = 11. See Supplementary Note 2 for the detailed method of error simulations.

The resource overhead of PTQC is quantified by two quantities: (i) the average number \({N}_{{{{\rm{GHZ}}}}}^{* }\) of GHZ-3 states required per central qubit and (ii) the average total number \({{{{\mathcal{N}}}}}_{{p}_{{{{\rm{L}}}}}}\) of GHZ-3 states to achieve a target logical error rate of pL for the logical identity gate of T = d − 1. Both of them depend on the photon loss rate η. \({N}_{{{{\rm{GHZ}}}}}^{* }\) can be used to evaluate the resource overhead independently of its error-correcting capability, while \({{{{\mathcal{N}}}}}_{{p}_{{{{\rm{L}}}}}}\) reflects the comprehensive resource overhead of actual computation. See Supplementary Note 3 for the detailed method of resource calculations.

The simulation results of the loss thresholds and the resource overheads (quantified by \({{{{\mathcal{N}}}}}_{1{0}^{-6}}\)) are respectively presented in Figs. 5a and 5b for the two types of photodetectors, the two options for the post-selection of star clusters, and the two H-configurations. Figure 5a shows that, if single-photon resolving detectors are used, ηth reaches up to 8.5% (n = 5, m = 4, j = 2) when star clusters are post-selected and up to 6.3% (n = m = 5, j = 3, HIC) when they are not. If on-off detectors are used, ηth reaches up to 4.4% (n = 5, m = 4, j = 1) when star clusters are post-selected and up to 3.3% (n = 5, m = 4, j = 1, HIS) when they are not. The post-selection of star clusters increases the photon loss thresholds by about 1–2%p. From Fig. 5b, it is observed that the protocol using single-photon resolving detectors is most resource-efficient with \({{{{\mathcal{N}}}}}_{1{0}^{-6}}\approx 5\times 1{0}^{5}\) (n = 4, m = 3, j = 1, HIC) when star clusters are post-selected and with \({{{{\mathcal{N}}}}}_{1{0}^{-6}}\approx 1\times 1{0}^{6}\) (n = m = 4, j = 2, HIS) when they are not. If on-off detectors are used, the protocol is most resource-efficient with \({{{{\mathcal{N}}}}}_{1{0}^{-6}}\approx 2\times 1{0}^{7}\) (n = m = 4, j = 2, HIC) when star clusters are post-selected and with \({{{{\mathcal{N}}}}}_{1{0}^{-6}}\approx 3\times 1{0}^{7}\) (n = m = 5, j = 2, HIC) when they are not. It is worth noting that, compared to the protocol without the post-selection, the protocol with it requires fewer GHZ-3 states to achieve a target logical error rate. In other words, further fault-tolerance obtained by using only successfully-generated star clusters leads to a positive overall effect that surpasses the negative effect caused by the increase in the number of required GHZ-3 states for one central qubit in the final lattice.

Fig. 5: Simulation results for PTQC.
figure 5

The loss thresholds ηth (a) and resource overheads \({{{{\mathcal{N}}}}}_{1{0}^{-6}}\) (b) are calculated for various parameters on the encoding size (n, m), the type of detectors, the post-selection (PS) of star clusters, and the H-configuration. “SPRD” stands for single-photon resolving detector. \({{{{\mathcal{N}}}}}_{1{0}^{-6}}\) is calculated at η = 0.01. The values of j are chosen to maximize ηth and shown next to the data points in (a). The H-configuration does not affect ηth when star clusters are post-selected.

Additionally, Fig. 6 presents the photon loss threshold as a function of \({N}_{{{{\rm{GHZ}}}}}^{* }\) for various parameter settings. Here, \({N}_{{{{\rm{GHZ}}}}}^{* }\) is calculated while fixing η to 0.01 or varying it as η = ηth/2. It shows that at least about 400 GHZ-3 states are required per central qubit for PTQC to work and more than 1000 GHZ-3 states are required to achieve ηth 0.04. The explicit information of the data points along the upper envelope lines in the left plot of Fig. 6a is listed in Supplementary Table 1.

Fig. 6: Photon loss threshold ηth of PTQC as a function of the average number \({N}_{{{{\rm{GHZ}}}}}^{* }\) of GHZ-3 states per central qubit.
figure 6

\({N}_{{{{\rm{GHZ}}}}}^{* }\) is calculated at η = 0.01 in (a) and η = ηth/2 in (b). The data points correspond to different parameter settings on the type of detectors, the post-selection (PS) of star clusters, the encoding size, and the H-configuration, which are grouped by the first two factors. “SPRD” stands for single-photon resolving detector. In (a), only data points with ηth > 0.01 are presented. The upper envelope for each of the groups is presented as a line. The values of j are chosen to maximize ηth.

Comparison with other approaches

We now compare the PTQC protocol with three other known approaches for linear optical quantum computing, which respectively use (i) simple repetition codes, (ii) tree encoding, and (iii) single-photon qubits with fusions assisted by ancillary photons. Their detailed descriptions are as follows:

  1. 1.

    The approach of (i) that uses simple repetition codes and multi-photon BSMs, which is called the multi-photon-qubit-based topological quantum computing (MTQC) protocol, was proposed in our previous work18. There, the photon loss thresholds and resource overheads are analyzed in detail, but a rigorous analysis of the effects of nonideal fusions like that done for PTQC is lacking.

  2. 2.

    The approach of (ii) utilizes redundant tree structures on graph states to replace a single fusion with multiple fusion attempts. Among the related works22,23,24, Ref. 24 presents the current most advanced version of the protocol where an RHG lattice is constructed by entangling multiple GHZ-3 states like PTQC.

  3. 3.

    The approach of (iii) uses single-photon qubits with boosted fusions assisted by ancillary entangled19 or unentangled photons20. This approach has been widely studied in the context of ballistic quantum computing21,28,29,30. In these works, non-RHG lattices are considered except for Ref. 21; however, RHG lattices should be used to enable a solid error correction, as also mentioned in Refs. 28,30. Moreover, in these works, the detrimental effects of failed fusions corrupting nearby qubits are not treated comprehensively; instead, they (except Ref. 21) regard a fusion failure as removing the corresponding edge and mainly focus on finding percolation thresholds. For the comparison, we consider using the BSM scheme in Ref. 19 where a 2N−1-photon GHZ state (for an integer N≥2) is used to suppress its failure probability to 1/2N in the lossless case.

For the comparison, we suppose that each initial GHZ-3 state is generated from single-photon sources by using the linear optical scheme in Ref. 38. Each trial of the scheme requires six photons and has a 1/32 chance of success (in the lossless case), which is heralded. We also assume the same photon loss rate ηcomp between components. Here, each component means a single-photon source, beam splitter, switch, delay line (for the time period required to process classical data for a switch), and photodetector. The above two assumptions are made to impose the same condition as the analysis of the tree-encoding protocol in Ref. 24.

In Fig. 7, PTQC is compared with the above three approaches in terms of the photon loss threshold per component as a function of \({N}_{{{{\rm{GHZ}}}}}^{* }\). \({N}_{{{{\rm{GHZ}}}}}^{* }\) is calculated at η = 0 to be consistent with Ref. 24. The loss threshold per component is chosen as a measure instead of the total loss threshold for a fair comparison between schemes that have different numbers of components. See the Methods section for the calculation methods. We note that the values for the tree-encoding approach are those reported in Ref. 24, just with the conversion of the resource measure.

Fig. 7: Comparison of PTQC and three known approaches, in terms of the photon loss threshold per component as a function of \({N}_{{{{\rm{GHZ}}}}}^{* }\).
figure 7

The loss thresholds per component are obtained while assuming the same photon loss rate between single-photon sources, beam splitters, delay lines, switches, and photodetectors. The values for the tree-encoding approach are those reported in Fig. 4b of Ref. 24. The value for the single-photon-qubit approach is obtained by using the boosted BSM scheme of N = 4 in Ref. 19.

Figure 7 shows a strong evidence that our PTQC protocol is highly loss-tolerant and resource-efficient compared to other approaches. The MTQC protocol and the single-photon-qubit method cannot achieve high enough loss thresholds. The tree-encoding method consumes 10–100 times more resources than PTQC, although it has an advantage that higher thresholds can be achieved if enough resources are provided.

We note several limitations of the above comparison:

  1. (i)

    The assumption that the photon loss rate is the same between different types of components is unrealistic. The results may vary if realistic weights are considered.

  2. (ii)

    Photons may have different overall loss rates depending on their paths, but only the largest one (corresponding to the longest path) is considered for simplicity of calculation. Hence, the loss thresholds in Fig. 7 are actually their lower bounds.

  3. (iii)

    The lengths of delay lines are obtained under the assumption of complete parallelization; namely, it is assumed that actions that are not causally related can be done in parallel. However, whether it is indeed possible depends on the actual experimental system and architecture.

  4. (iv)

    We only consider noises that can be modeled with photon losses. It is uncertain how much the results will change if other types of noises (especially unheralded Pauli errors) are introduced.

  5. (v)

    The single-photon-qubit approach might be improved by using the lattice renormalization method in Ref. 21, which is not considered here. However, this method has a shortcoming that the renormalized lattice may be significantly smaller than the original lattice; namely, about 203 photons are consumed to generate one node21.

Discussion

In this work we address the problem of overcoming the negative effects of nonideal fusions and photon losses during linear-optical measurement-based quantum computing (MBQC). We first introduced a Bayesian methodology for tracking errors caused by nonideal fusions during the construction of graph states, which enables accurate and effective error simulations. We then proposed the parity-encoding-based topological quantum computing (PTQC) protocol that uses the parity encoding and concatenated Bell-state measurement, which turns out to have a high loss threshold of at most ~ 8.5%. Moreover, logical error rates near 10−6 can be achieved using about 106 or fewer three-photon Greenberger-Horne-Zeilinger states (GHZ-3) states in total when the photon loss rate is 1%, which outperforms other known linear optical computing protocols18. It is worth noting that GHZ-3 states can be deterministically generated using current techonology33. We presented comprehensive and systematic methods to construct a graph state from GHZ-3 states, including the graph-theoretical algorithm that can minimize the resource overhead efficiently.

Additionally, we investigated three other known approaches that respectively use simple repetition codes, and tree encoding, and single-photon qubits with fusions assisted by ancillary photons. We presented evidence that PTQC is highly competitive compared to others, as it exhibits high loss thresholds per component relative to the amount of resources it consumes. For instance, a loss threshold of ~ 0.35% per component can be achieved by using ~ 104 GHZ-3 states per data qubit, which is at least ~ 100 times resource-efficient than previous methods.

One may apply the Bayesian error tracking method to other encoding schemes or decoding algorithms (such as the union-find decoder40) to improve fault-tolerance or resource overheads. More careful consideration of component-wise errors, including both heralded photon losses and unheralded errors (such as dark counts on photodetectors), shall give rise to more realistic analyses. If type-I fusions are used for generating microclusters, the resource overhead may be reduced at the cost of additional Pauli errors, which will be worth investigating. Our protocol might be enhanced by using other codes such as the Steane 7-qubit code41 instead of the parity code. Resource analysis will be more comprehensive if other factors such as the number of optical switches or delay lines are considered. Our graph-theoretical optimization scheme for generating graph states can be applied to arbitrary graph states as well as microclusters for PTQC. It will be interesting future work to investigate the resource reduction effect of this scheme for various MBQC protocols or other applications of graph states such as quantum repeaters. Lastly, our methods may be generalized to fusion-based quantum computing42 that is attracting attention recently, or other MBQC protocols such as the color-code-based one43.

Methods

In this section, we describe the details of the PTQC protocol including the CBSM scheme, the closed-form expressions of error probabilities, the method to generate post-H microclusters, and the resource optimization problem.

Bell states for the parity encoding

For the lattice, block, and physical levels of the (n, m) parity encoding, the Bell states are respectively defined as

$$\left\{\begin{array}{l}\left\vert {{{\Phi }}}^{\pm }\right\rangle := \left\vert {0}_{{{{\rm{L}}}}}\right\rangle \left\vert {0}_{{{{\rm{L}}}}}\right\rangle \pm \left\vert {1}_{{{{\rm{L}}}}}\right\rangle \left\vert {1}_{{{{\rm{L}}}}}\right\rangle ,\quad \\ \left\vert {{{\Psi }}}^{\pm }\right\rangle := \left\vert {0}_{{{{\rm{L}}}}}\right\rangle \left\vert {1}_{{{{\rm{L}}}}}\right\rangle \pm \left\vert {1}_{{{{\rm{L}}}}}\right\rangle \left\vert {0}_{{{{\rm{L}}}}}\right\rangle ,\quad \end{array}\right.$$
(3)
$$\left\{\begin{array}{l}\left\vert {\phi }_{(m)}^{\pm }\right\rangle := \left\vert {+}^{(m)}\right\rangle \left\vert {+}^{(m)}\right\rangle \pm \left\vert {-}^{(m)}\right\rangle \left\vert {-}^{(m)}\right\rangle ,\quad \\ \left\vert {\psi }_{(m)}^{\pm }\right\rangle := \left\vert {+}^{(m)}\right\rangle \left\vert {-}^{(m)}\right\rangle \pm \left\vert {-}^{(m)}\right\rangle \left\vert {+}^{(m)}\right\rangle ,\quad \end{array}\right.$$
(4)
$$\left\{\begin{array}{l}\left\vert {\phi }^{\pm }\right\rangle := \left\vert {{{\rm{H}}}}\right\rangle \left\vert {{{\rm{H}}}}\right\rangle \pm \left\vert {{{\rm{V}}}}\right\rangle \left\vert {{{\rm{V}}}}\right\rangle ,\quad \\ \left\vert {\psi }^{\pm }\right\rangle := \left\vert {{{\rm{H}}}}\right\rangle \left\vert {{{\rm{V}}}}\right\rangle \pm \left\vert {{{\rm{V}}}}\right\rangle \left\vert {{{\rm{H}}}}\right\rangle ,\quad \end{array}\right.$$
(5)

where \(\left\vert {0}_{{{{\rm{L}}}}}\right\rangle\), \(\left\vert {1}_{{{{\rm{L}}}}}\right\rangle\), and \(\left\vert {\pm }^{(m)}\right\rangle\) are defined in Eqs. (1) and (2). The Bell states of each level can be decomposed into those of one level below as follows:

$$\left\vert {{{\Phi }}}^{\pm }\right\rangle ={2}^{-\frac{n-1}{2}}\mathop{\sum}\limits_{l:{{{\rm{even(odd)}}}}\le n}{{{\mathcal{P}}}}\left[{\left\vert {\phi }_{(m)}^{-}\right\rangle }^{\otimes l}{\left\vert {\phi }_{(m)}^{+}\right\rangle }^{\otimes n-l}\right],$$
(6)
$$\left\vert {{{\Psi }}}^{\pm }\right\rangle ={2}^{-\frac{n-1}{2}}\mathop{\sum}\limits_{l:{{{\rm{even(odd)}}}}\le n}{{{\mathcal{P}}}}\left[{\left\vert {\psi }_{(m)}^{-}\right\rangle }^{\otimes l}{\left\vert {\psi }_{(m)}^{+}\right\rangle }^{\otimes n-l}\right],$$
(7)
$$\left\vert {\phi }_{(m)}^{\pm }\right\rangle ={2}^{-\frac{m-1}{2}}\mathop{\sum}\limits_{k:{{{\rm{even}}}}\le m}{{{\mathcal{P}}}}\left[{\left\vert {\psi }^{\pm }\right\rangle }^{\otimes k}{\left\vert {\phi }^{\pm }\right\rangle }^{\otimes m-k}\right],$$
(8)
$$\left\vert {\psi }_{(m)}^{\pm }\right\rangle ={2}^{-\frac{m-1}{2}}\mathop{\sum}\limits_{k:{{{\rm{odd}}}}\le m}{{{\mathcal{P}}}}\left[{\left\vert {\psi }^{\pm }\right\rangle }^{\otimes k}{\left\vert {\phi }^{\pm }\right\rangle }^{\otimes m-k}\right],$$
(9)

where \({{{\mathcal{P}}}}[\cdot ]\) means the summation of all the permutations of the tensor products inside the bracket. Therefore, a BSM can be performed in a concatenated manner: A lattice-level BSM (BSMlat) is done by n block-level BSMs (BSMblc’s), each of which is again done by m physical-level BSMs (BSMphy’s). We refer to the sign (letter) result obtained from a lattice-, block-, or physical-level BSM as the lattice-, block-, or physical-level sign (letter), respectively.

Original CBSM scheme

We review the original CBSM scheme of the parity encoding in Ref. 32. A BSMphy can discriminate between only two among the four Bell states. Three types of BSMphy’s (Bψ, B+, and B) are considered, which discriminate between \(\{\left\vert {\psi }^{+}\right\rangle ,\left\vert {\psi }^{-}\right\rangle \}\), \(\{\left\vert {\phi }^{+}\right\rangle ,\left\vert {\psi }^{+}\right\rangle \}\), and \(\{\left\vert {\phi }^{-}\right\rangle ,\left\vert {\psi }^{-}\right\rangle \}\), respectively. Bψ can be implemented by the process in Fig. 2, which can be modified to implement B+ instead by adding a 45 wave plate on each input line just before the first PBS. If the 90 wave plate on the second input line is removed in the setting for B+, B is executed alternatively. A BSMphy has four possible outcomes: two successful cases (e.g., for Bψ, \(\left\vert {\psi }^{+}\right\rangle\) and \(\left\vert {\psi }^{-}\right\rangle\)), “failure,” and “detecting a photon loss.” Failure and loss can be distinguished by the number of total photons detected by the photon detectors. Since two photons may enter a single detector, it is assumed that single-photon resolving detectors are used. Note that, even in the failure cases, either sign or letter still can be determined. (For example, even if a Bψ fails, we can still learn that the letter is ϕ.) On the other hand, if it detects a loss, we can get neither a sign nor a letter.

A BSMblc is done by m-times of BSMphy’s. Each block is composed of m photons, thus we consider m pairs of photons selected respectively in the two blocks. The types of the BSMphy’s are selected as follows: First, Bψ is performed on each pair of photons in order until it either succeeds, detects a loss, or consecutively fails j times, where jm − 1 is a predetermined number. Then a sign s = ± is selected by the sign of the last Bψ outcome if it succeeds or selected randomly if it fails or detects a loss. After that, Bs’s are performed for all the left pairs of photons.

The block-level sign (letter) is determined by the physical-level signs (letters) of the m-times of BSMphy’s. In detail, the block-level sign is chosen (i) to be the same as s if the last Bψ succeeds or any Bs succeeds, and (ii) to be the opposite of s if the last Bψ does not succeed and any Bs fails. (iii) Otherwise (namely, if the last Bψ does not succeed and all the Bs’s detect losses), the block-level sign is not determined. The block-level letter is determined only when all the physical-level letters are determined, namely, when no losses are detected and all Bs’s succeed. For such cases, the block-level letter is ϕ (ψ) if the number of ψ in the BSMphy results is even (odd).

Next, a BSMlat is done by n-times of BSMblc’s. The lattice-level sign is determined only when all the block-level signs are determined; it is (+) if the number of (−) in the BSMblc results is even and it is (−) if the number is odd. The lattice-level letter is equal to any determined block-level letter. Thus, if all BSMblc’s cannot determine letters, the lattice-level letter is not determined as well.

Modified CBSM scheme for PTQC

In our PTQC protocol, we consider using either single-photon resolving or on-off detectors. The CBSM scheme should be slightly modified for this case.

Since failure and loss cannot be distinguished, a BSMphy now has three possible outcomes: two successful cases and failure. Consequently, in a BSMblc, Bψ’s are performed until it either succeeds or consecutively fails j times. The way to determine the block-level sign and letter is the same as the original scheme, except that case (iii) when determining the sign no longer occurs. The biggest difference from the original scheme is that the determined sign and letter may be wrong. These error probabilities are presented in the next subsection.

In a BSMlat, the lattice-level sign is determined from the block-level signs by the same method as the original scheme, although it may be wrong with a nonzero probability as well. On the other hand, the lattice-level letter is not determined by a single block-level letter unlike the original scheme; instead, we use a weighted majority vote of block-level letters. The weight of each block-level letter is given as \(w:= \log [(1-{q}_{{{{\rm{lett}}}}}^{{{{\rm{blc}}}}})/{q}_{{{{\rm{lett}}}}}^{{{{\rm{blc}}}}}]\), where \({q}_{{{{\rm{lett}}}}}^{{{{\rm{blc}}}}}\) is the probability that the block-level letter is wrong. This weight factor is justified as follows: Let Iϕ (Iψ) denote the set of the indices of block pairs where the block-level letters are ϕ (ψ). Assuming that the two lattice-level letters (Φ and Ψ) have the same prior probability, we get

$$\begin{array}{lll}\frac{\Pr ({{\Phi }}| {I}_{\phi },{I}_{\psi })}{\Pr ({{\Psi }}| {I}_{\phi },{I}_{\psi })}&=&\frac{\Pr ({I}_{\phi },{I}_{\psi }| {{\Phi }})\Pr ({{\Phi }})}{\Pr ({I}_{\phi },{I}_{\psi }| {{\Psi }})\Pr ({{\Psi }})}=\frac{\Pr ({I}_{\phi },{I}_{\psi }| {{\Phi }})}{\Pr ({I}_{\phi },{I}_{\psi }| {{\Psi }})}\\ &=&\frac{\mathop{\prod}\limits_{i\in {I}_{\phi }}\left(1-{q}_{{{{\rm{lett}}}}}^{(i)}\right)\mathop{\prod}\limits_{j\in {I}_{\psi }}{q}_{{{{\rm{lett}}}}}^{(j)}}{\mathop{\prod}\limits_{i\in {I}_{\phi }}{q}_{{{{\rm{lett}}}}}^{(i)}\mathop{\prod}\limits_{j\in {I}_{\psi }}\left(1-{q}_{{{{\rm{lett}}}}}^{(j)}\right)}\\ &=&\mathop{\prod}\limits_{i\in {I}_{\phi }}\frac{1-{q}_{{{{\rm{lett}}}}}^{(i)}}{{q}_{{{{\rm{lett}}}}}^{(i)}}\Big/\mathop{\prod}\limits_{j\in {I}_{\psi }}\frac{1-{q}_{{{{\rm{lett}}}}}^{(j)}}{{q}_{{{{\rm{lett}}}}}^{(j)}}\\ &=&\exp \left(\mathop{\sum}\limits_{i\in {I}_{\phi }}{w}^{(i)}-\mathop{\sum}\limits_{j\in {I}_{\psi }}{w}^{(j)}\right),\end{array}$$
(10)

where \({q}_{{{{\rm{lett}}}}}^{(i)}\) and w(i) are respectively the letter error probability and the weight of the ith block. Note that the third equality comes from the fact that a lattice-level Bell state is decomposed into block-level Bell states of the same letter, as shown in Eqs. (6) and (7).

Error probabilities of a CBSM under a lossy environment

We here present the possible outcomes of a CBSM using either single-photon resolving or on-off detectors and the corresponding error probabilities (qsign, qlett). We denote x (1−η)2, which is the probability that a BSMphy does not detect photon losses. It is assumed that the four Bell states have the same prior probabilities; namely, the initial marginal state on qubits 1 and 2 before suffering losses is the equal mixture of four lattice-level Bell states, which is justified in Supplementary Note 1. For a BSMblc or BSMlat, to avoid confusion, we use the term “outcome” to indicate the tuple of the outcomes of the BSMphy’s constituting the BSMblc or BSMlat, and use the term “result” to indicate one of the four Bell states that gives the largest posterior probability under its outcome. Note that the result of a BSM may be not deterministically determined by its outcome; if multiple Bell states have the same posterior probability, one of them is randomly selected as the result.

The case using single-photon resolving detectors is analyzed in Ref. 32 and we here review the contents to be self-contained. The outcome of a BSMblc is included in one of the following three cases: (Success) Both the sign and letter are identified if no losses are detected and all the B±’s succeed. (Failure) Neither sign nor letter is identified if no Bψ’s succeed and all B±’s detect losses. (Sign discrimination) Only the sign is identified if otherwise. The block-level sign (or letter) is selected randomly if it is not identified. The probabilities of these cases are respectively

$$\left\{\begin{array}{ll}{{{\rm{Success}}}}:\quad &{p}_{{{{\rm{s}}}}}=\left[1-{2}^{-(j+1)}\right]{x}^{m},\\ {{{\rm{Failure}}}}:\quad &{p}_{{{{\rm{f}}}}}=\mathop{\sum }\limits_{l=0}^{j}{\left(\frac{x}{2}\right)}^{l}{(1-x)}^{m-l},\\ {{{\rm{Sign}}}}\,{{{\rm{discrimination}}}}:\quad &{p}_{{{{\rm{sd}}}}}=1-{p}_{{{{\rm{s}}}}}-{p}_{{{{\rm{f}}}}}.\end{array}\right.$$
(11)

For a BSMlat, let Ns (Nf) denote the number of successful (failed) BSMblc’s. The lattice-level letter is identified if Ns≥1 (namely, if at least one block-level letter is identified) and the sign is identified if Nf = 0 (namely, if all block-level signs are identified). Hence, the outcome of a BSMlat is included in one of the following four events:

$$\left\{\begin{array}{ll}S\,({{{\rm{Success}}}}):\quad &{N}_{{{{\rm{s}}}}}\ge 1\wedge {N}_{{{{\rm{f}}}}}=0,\\ {D}_{{{{\rm{L}}}}}\,({{{\rm{Letter}}}}\,{{{\rm{discrimination}}}}):\quad &{N}_{{{{\rm{s}}}}},{N}_{{{{\rm{f}}}}}\ge 1,\\ {D}_{{{{\rm{S}}}}}\,({{{\rm{Sign}}}}\,{{{\rm{discrimination}}}}):\quad &{N}_{{{{\rm{s}}}}}={N}_{{{{\rm{f}}}}}=0,\\ F\,({{{\rm{Failure}}}}):\quad &{N}_{{{{\rm{s}}}}}=0\wedge {N}_{{{{\rm{f}}}}}\ge 1.\end{array}\right.$$
(12)

The sign and letter error probabilities (qsign, qlett) of the BSMlat for each event are (0, 0) for S, (1/2, 0) for DL, (0, 1/2) for DS, and (1/2, 1/2) for F. The probabilities of the events are respectively given as

$$\left\{\begin{array}{l}{P}_{S}={(1-{p}_{{{{\rm{f}}}}})}^{n}-{p}_{{{{\rm{sd}}}}}^{n},\quad \\ {P}_{{D}_{{{{\rm{L}}}}}}=1-{(1-{p}_{{{{\rm{s}}}}})}^{n}+{(1-{p}_{{{{\rm{f}}}}})}^{n}-{p}_{{{{\rm{sd}}}}}^{n},\quad \\ {P}_{{D}_{{{{\rm{S}}}}}}={p}_{{{{\rm{sd}}}}}^{n},\quad \\ {P}_{F}={(1-{p}_{{{{\rm{s}}}}})}^{n}-{p}_{{{{\rm{sd}}}}}^{n}.\quad \end{array}\right.$$
(13)

We now consider using on-off detectors for fusions. Each outcome of a BSMblc is uniquely identified by a triple O = (r, s, U), where \(r\in {{\mathbb{Z}}}_{j+1}:= \{0,\cdots \,,j\}\) is the number of failed Bψ’s, s = ± is the sign chosen by the successful (r + 1)th Bψ (if r < j) or randomly (if r = j), and U is an (m − r)-element tuple composed of “ϕ,” “ψ,” and “f” (failure) indicating the outcomes of the BSMphy’s from the (r + 1)th to the the last. (If r < j, the first component of U is always ψ, and the other components are determined by the Bs’s. If r = j, all the components are determined by the Bs’s.) Let Ne(U) for e {ϕ, ψ, f} denote the number of e in U. Then a BSMblc outcome O is included in one of the following j + 3 events:

$$\left\{\begin{array}{l}{{{{\mathcal{S}}}}}_{r}:= \{(r,s,{{{\bf{U}}}})| {N}_{f}({{{\bf{U}}}})=0\}\quad(0\le r\le j),\quad \\ {{{\mathcal{F}}}}:= \{(j,s,{{{\bf{U}}}})| {N}_{f}({{{\bf{U}}}})=m-j\},\quad \\ {{{\mathcal{D}}}}:= {{{\mathcal{O}}}}\setminus \left[{{{\mathcal{F}}}}\cup \mathop{\bigcup }\nolimits_{r = 0}^{j}{{{{\mathcal{S}}}}}_{r}\right],\quad \end{array}\right.$$
(14)

where \({{{\mathcal{O}}}}\) is the set of all possible outcomes. Note that the events \({{{{\mathcal{S}}}}}_{r}\), \({{{\mathcal{F}}}}\), and \({{{\mathcal{D}}}}\) correspond to success, failure, and sign discrimination when η = 0. For each event \({{{\mathcal{E}}}}\) in Eq. (14), its sign and letter error probabilities \({q}_{{{{\rm{sign/lett}}}}}^{{{{\rm{blc}}}}}({{{\mathcal{E}}}})\) and the probability \({p}_{{{{\mathcal{E}}}}}\) that the event occurs are given as follows (see Supplementary Note 4 for their derivation):

$$\left\{\begin{array}{l}{q}_{{{{\rm{sign}}}}}^{{{{\rm{blc}}}}}({{{{\mathcal{S}}}}}_{r})=0,\,\,\,{q}_{{{{\rm{lett}}}}}^{{{{\rm{blc}}}}}({{{{\mathcal{S}}}}}_{r})=\frac{1}{2}-\frac{1}{2}{\left(\frac{x}{2-x}\right)}^{r},\quad \\ {p}_{{{{{\mathcal{S}}}}}_{r}}=\frac{1}{2}{\left(1-\frac{x}{2}\right)}^{r}{x}^{m-r},\quad \end{array}\right.$$
(15)
$$\left\{\begin{array}{l}{q}_{{{{\rm{sign}}}}}^{{{{\rm{blc}}}}}({{{\mathcal{F}}}})=\frac{{(1-x)}^{m-j}}{1+{(1-x)}^{m-j}},\,\,\,{q}_{{{{\rm{lett}}}}}^{{{{\rm{blc}}}}}({{{\mathcal{F}}}})=\frac{1}{2},\quad \\ {p}_{{{{\mathcal{F}}}}}=\frac{1}{2}{\left(1-\frac{x}{2}\right)}^{j}\left[1+{(1-x)}^{m-j}\right],\quad \end{array}\right.$$
(16)
$$\left\{\begin{array}{l}{q}_{{{{\rm{sign}}}}}^{{{{\rm{blc}}}}}({{{\mathcal{D}}}})=0,\,\,\,{q}_{{{{\rm{lett}}}}}^{{{{\rm{blc}}}}}({{{\mathcal{D}}}})=\frac{1}{2},\quad \\ {p}_{{{{\mathcal{D}}}}}=1-\mathop{\sum}\limits_{r}{p}_{{{{{\mathcal{S}}}}}_{r}}-{p}_{{{{\mathcal{F}}}}}.\quad \end{array}\right.$$
(17)

A possible outcome of a BSMlat corresponds to an n-tuple of events composed of \({{{{\mathcal{S}}}}}_{r}\) (0 ≤ r ≤ j), \({{{\mathcal{F}}}}\), and \({{{\mathcal{D}}}}\), which can be regarded as an independent event for the outcomes of the BSMlat. The probability that an event \({{{\bf{E}}}}=({{{{\mathcal{E}}}}}_{1},\cdots \,,{{{{\mathcal{E}}}}}_{n})\) occurs is

$${p}_{{{{\bf{E}}}}}=\mathop{\prod }\limits_{i=1}^{n}{p}_{{{{{\mathcal{E}}}}}_{i}}$$
(18)

and the sign and letter error probabilities of \({{{\bf{E}}}}=({{{{\mathcal{E}}}}}_{1},\cdots \,,{{{{\mathcal{E}}}}}_{n})\) are respectively

$${q}_{{{{\rm{sign}}}}}({{{\bf{E}}}})=\frac{1}{2}-\frac{1}{2}{\left[1-2{q}_{{{{\rm{sign}}}}}^{{{{\rm{blc}}}}}({{{\mathcal{F}}}})\right]}^{{N}_{{{{\mathcal{F}}}}}},$$
(19)
$$\begin{array}{ll}{q}_{{{{\rm{lett}}}}}({{{\bf{E}}}})=\frac{1}{2}+\frac{1}{2}&\mathop{\sum}\limits_{({\lambda }_{1},\cdots \,,{\lambda }_{n})\in {{\mathbb{Z}}}_{2}^{n}}\mathop{\prod }\limits_{i=1}^{n}\left[{q}_{i}^{{\lambda }_{i}}{(1-{q}_{i})}^{1-{\lambda }_{i}}\right]\\ &\times {{{\rm{sgn}}}}\left(\mathop{\sum }\limits_{i=1}^{n}\left(2{\lambda }_{i}-1\right)\log \frac{1-{q}_{i}}{{q}_{i}}\right),\end{array}$$
(20)

where \({N}_{{{{\mathcal{F}}}}}\) is the number of \({{{\mathcal{F}}}}\)’s in E, \({q}_{i}:= {q}_{{{{\rm{lett}}}}}^{{{{\rm{blc}}}}}({{{{\mathcal{E}}}}}_{i})\), and \({{{\rm{sgn}}}}(a)\) is a/a if a ≠ 0 and 0 if a = 0. See Supplementary Note 4 for their derivation.

Generation of post-H microclusters

In this subsection, we first present the physical-level graphs of post-H microclusters for PTQC and then describe the method to generate them. A post-H microcluster, which is composed of three lattice-level qubits or two of them and one photon (physical-level qubit), can be regarded as a graph state of photons up to several physical-level Hadamard gates. The graph of this graph state, called the “physical-level graph” of the post-H microcluster, is visualized in Fig. 8 for each post-H microcluster; see Supplementary Note 5 for their derivation. Here, the squares (circles) indicate lattice-level (physical-level) qubits. If a square (circle) is filled with black, it means that the lattice-level (physical-level) Hadamard gate is applied on the qubit after the involved edges are connected. Recurrent subgraphs are abbreviated as blue dashed squares or circles with numbers; see Fig. 8b–d for the detailed interpretation of these notations.

Fig. 8: Physical-level graphs of post-H microclusters for PTQC.
figure 8

In (a), the physical-level graphs of post-H microclusters for the HIC and HIS configurations are shown for PTQC with the (n, m) parity encoding. The squares (circles) correspond to lattice-level (physical-level) qubits, among which black ones indicate that the lattice-level (physical-level) Hadamard gates are applied to the qubits on the graph state. A blue dashed box indicates a group of recurrent subgraphs; that is, the structure in the box is repeated as many times as indicated, and if there is an edge across the border of the box, it means that edges of the same pattern exist in each of the repeated structures. See (b) for an example. A number inside a circle means a blue dashed box surrounding only the circle with the indicated repetition number, as shown in the example of (c). If there is an edge between two blue dashed boxes or circles containing numbers, the full graph can be recovered just by expanding them one by one. As an example, the full graph of the side microcluster of the HIS configuration for n = m = 2 is shown in (d).

We now depict the ways to generate a specific post-H microcluster from GHZ-3 states. We first describe a straightforward method and then adjust or generalize it. The final method can be summarized as follows:

  1. 1.

    Determine a merging graph G for the post-H microcluster that we want to create by the algorithm presented below. Each edge of G is labeled as either “internal" or “external."

  2. 2.

    For each vertex v in G, Prepare a GHZ-3 state \({\left\vert {{{{\rm{GHZ}}}}}_{3}\right\rangle }_{v}\).

  3. 3.

    For each edge e in G that connects v1 and v2, perform a BSM (fusion) on two photons selected respectively from \({\left\vert {{{{\rm{GHZ}}}}}_{3}\right\rangle }_{{v}_{1}}\) and \({\left\vert {{{{\rm{GHZ}}}}}_{3}\right\rangle }_{{v}_{2}}\) if e is an internal (external) edge. The order of the operations does not matter.

We define the “GHZ-l state” for an integer l≥3 by the state \(\left\vert {{{{\rm{GHZ}}}}}_{l}\right\rangle := {\left\vert {{{\rm{H}}}}\right\rangle }^{\otimes l}+{\left\vert {{{\rm{V}}}}\right\rangle }^{\otimes l}\). Note that it is a state obtained from a graph state with a star graph (where the number of vertices is l) by applying Hadamard gates on all the leaves of the graph; namely,

$$\left\vert {{{{\rm{GHZ}}}}}_{l}\right\rangle ={H}_{2}\cdots {H}_{l}{C}_{12}^{Z}\cdots {C}_{1l}^{Z}{\left\vert +\right\rangle }^{\otimes l}.$$
(21)

We refer to the first photon of the above expression as the “root photon” of the state (which can be chosen arbitrarily) and the other photons as its “leaf photons.”

If a BSM is performed on the root photon of a GHZ-l1 state and a leaf photon of a GHZ-l2 state, the resulting state on the remaining photons is a GHZ-(l1 + l2 − 2) state. Thus, an arbitrary GHZ state can be constructed by performing BSMs on multiple GHZ-3 states appropriately. On the other hand, if a fusion is performed on two leaf photons selected respectively from GHZ-l1 and GHZ-l2 states, the resulting state is no longer a GHZ state, but it is a graph state (up to some Hadamard gates) with a graph containing a vertex with degree l1 − 1, a vertex with degree l2 − 1, and multiple vertices with degree one. (The degree dv of a vertex v means the number of edges connected to v.)

Combining the above facts, a post-H microcluster (or an arbitrary graph state) with the physical-level graph G can be generated from GHZ-3 states up to physical-level Hadamard gates in the following way: For each vertex v of G with a degree larger than one, prepare a state \({\left\vert {{{{\rm{GHZ}}}}}_{{d}_{v}+1}\right\rangle }_{v}\) through BSMs on GHZ-3 states. Then, for each edge (v1, v2) of G, perform a fusion on two photons selected respectively from \({\vert {{{{\rm{GHZ}}}}}_{{d}_{{v}_{1}}+1}\rangle }_{{v}_{1}}\) and \({\vert {{{{\rm{GHZ}}}}}_{{d}_{{v}_{2}}+1}\rangle }_{{v}_{2}}\). We refer to each BSM or fusion during this process as a merging operation.

However, the above method still has room for improvement. The physical-level graphs in Fig. 8 can be decomposed into multiple components that are combined by fusions through the process shown in Fig. 9. Here, each recurrent subgraph connected with multiple vertices is separated and connected with only one vertex. The decomposition of different post-H microclusters is explicitly presented in Supplementary Figure 7. To generate a post-H microcluster, we prepare the individual components first by the aforementioned method, then merge them through fusions. This process may greatly reduce the number of required merging operations since the number of edges decreases as shown in Fig. 9.

Fig. 9: Decomposition of a graph state.
figure 9

A graph state is decomposed by separating recurrent subgraphs that are connected with multiple vertices.

Furthermore, we can generalize the method using the fact that every merging operation commutes with each other. That is, even if all the fusions and BSMs in the above process are performed in an arbitrary order, the final state does not vary (up to the change of the Pauli frame). To systematically address this feature, we define a merging graph of a post-H microcluster or one of its components by a graph in which the vertices correspond to initial GHZ-3 states and the edges indicate the merging operations between them required to generate the state. Each edge of a merging graph is either internal or external that corresponds to BSMs or fusions, respectively.

A merging graph of a component can be constructed by the following method starting from its physical-level graph (see Fig. 10 for two examples): First, for each vertex v satisfying dv ≥ 2 in the physical-level graph, replace it with dv − 1 new vertices connected by internal edges in series with each other. This process means decomposing a GHZ-(dv + 1) state into dv − 1 GHZ-3 states. The edges originally connected to v are distributed to the new vertices in a way that every new vertex is connected to three or fewer edges. Then there is only one vertex connected to two edges, which is called the “seed vertex” of v. This seed vertex means that one photon in the corresponding GHZ-3 state does not participate in any merging operation and remains in the final state. Lastly, the merging graph is obtained by removing all the vertices with degree one. See Supplementary Note 6 for a stricter step-by-step description of the method.

Fig. 10: Construction of merging graphs from a physical-level graph.
figure 10

v is the only vertex with a degree larger than two in the original graph. The upper and lower processes differ in the selection of the seed vertex for the decomposition of v.

The merging graph of a post-H microcluster is constructed by combining the merging graphs of its components. That is, for each fusion between different components, the corresponding seed vertices in the merging graphs are connected by an external edge. Then we finally get the method summarized at the beginning of this subsection.

Optimization of resource overheads

The process of generating a post-H microcluster described above is determined by two factors: the merging graph and the order of the merging operations. Here, we discuss their optimization for minimizing resource overhead. The merging graph is selected randomly by the algorithm in Supplementary Note 6. Based on it, we determine the order of the merging operations through an algorithm found heuristically and calculate the expected number \({N}_{{{{\rm{GHZ}}}}}^{{{{\rm{MC}}}}}\) of GHZ-3 states required to generate the state. We repeat this process for a large enough number to obtain as low resource overhead as possible. \({N}_{{{{\rm{GHZ}}}}}^{* }\) and \({{{{\mathcal{N}}}}}_{{p}_{{{{\rm{L}}}}}}\) can be calculated by using the obtained optimal resource overheads; see Supplementary Note 3 for details.

During the generation process, performing each merging operation can be regarded as contracting the corresponding edge, which means removing the edge, merging the two vertices (v1, v2) that it previously joined into a new vertex w, and reconnecting all the edges that were connected to v1 and v2 with w. Here, each vertex indicates a connected subgraph (a group of entangled photons) of the intermediate graph state. We assign a “weight” Nv (which is initialized to 1) on each vertex v, which is the average number of GHZ-3 states required to generate the connected subgraph. If the edge between two vertices v1 and v2 are contracted, the new vertex w has the weight of

$${N}_{w}=\frac{2}{{(1-\eta )}^{2}}({N}_{{v}_{1}}+{N}_{{v}_{2}})=:{N}_{{v}_{1}}{+}_{m}{N}_{{v}_{2}},$$
(22)

where the factor 2/(1−η)2 is the inverse of the success probability of the merging operation. By repeating this process, the post-H microcluster is obtained when there is only one vertex left, whose weight is equal to \({N}_{{{{\rm{GHZ}}}}}^{{{{\rm{MC}}}}}\).

To find an optimal order of merging operations, we use the following strategy:

  1. 1.

    Find the set Emin.wgt of edges with the smallest weight, where the weight of an edge (v1, v2) is defined as \({N}_{{v}_{1}}{+}_{m}{N}_{{v}_{2}}\).

  2. 2.

    Using an edge coloring algorithm, allocate “colors” to all edges so that different edges sharing a vertex have different colors and as few colors as possible are used.

  3. 3.

    Partition Emin.wgt into disjoint subsets by the colors of the edges. Find the largest subset Emrg among them. If such a subset is not unique, choose one randomly.

  4. 4.

    Contract each edge in Emrg in an arbitrary order.

  5. 5.

    Repeat all the above steps until only one vertex is left.

The strategy is based on the following two intuitions: First, it is better to merge vertices with small weights first, since (N1 + mN2) + mN3 < N1 + m(N2 + mN3) if N1 < N2 < N3. Secondly, it is better to perform merging operations in parallel as much as possible. Such a set of edges can be found by the edge coloring algorithm. For our results, we have used the function coloring.greedy_color in NetworkX package44 with the strategy largest_first. (Since the function performs vertex coloring, we input the line graph of Gmrg into the function.)

In Supplementary Note 7, we show an evidence that this optimizing strategy is indeed highly effective in terms of both the optimality of the calculated overhead and searching time, by comparing its performance with those of its variants constructed by omitting or altering specific steps. We conjecture that this strategy is powerful for generating general graph states as well as those for PTQC, which will be worth investigating.

Methods for comparing PTQC and previous approaches

Here, we describe the methods to obtain the results in Fig. 7 where PTQC and three known approaches are compared. Let ηe, ηb, ηs, ηd, and ηm denote the photon loss rates in a single-photon source, beam splitter, switch, delay line (for the time period required to process classical data for a switch), and photodetector, respectively. We consider “fancy” switches24 that have multiple input and output modes; thus, N states can be post-selected from M input states (N < M) with a single switch. For the analysis, we assume ηe = ηb = ηs = ηd = ηm = ηcomp. The total photon loss rate η is upper bounded by

$${\eta }_{e}+{\eta }_{m}+{N}_{b}{\eta }_{b}+{N}_{s}{\eta }_{s}+{N}_{d}{\eta }_{d}:= {N}_{{{{\rm{comp}}}}}{\eta }_{{{{\rm{comp}}}}},$$
(23)

where Nb, Ns, and Nd are respectively the maximal numbers of beam splitters, switches, and delay lines that a single photon encounters between its creation and measurement. When counting delay lines, we assume that actions that are not causally related can be done in parallel; namely, delay lines are compressed as much as possible so that those required for switches are dominant. The loss threshold per component is lower bounded by ηth/Ncomp, where ηth is the total loss threshold.

Let us first consider PTQC without post-selection of star clusters. During the generation of GHZ-3 states and their post-selection, a photon passes through one beam splitter, switch, and delay line38. While constructing microclusters, a photon encounters at most Nstep pairs of a switch and delay line that are used for post-selecting photons by the outcomes of merging operations. Here, Nstep is the number of steps (groups of merging operations that can be conducted in parallel). In a CBSM, physical-level BSMs (BSMphy’s) in each block should be done one by one since their types (Bψ, B+, and B) depend on the previous BSMphy outcomes. Therefore, a photon passes through at most one switch (zero if m = 1) and m − 1 delay lines before the BSMphy of the photon is performed. Lastly, a photon enters two beam splitters during the BSMphy. To sum up, we get

$$\begin{array}{lll}\eta &\le &{\eta }_{e}+{\eta }_{m}+3{\eta }_{b}+({N}_{{{{\rm{step}}}}}+2-{\delta }_{m,1}){\eta }_{s}+({N}_{{{{\rm{step}}}}}+m){\eta }_{d}\\ &=&(2{N}_{{{{\rm{step}}}}}+m+6-{\delta }_{m,1}){\eta }_{{{{\rm{comp}}}}},\end{array}$$
(24)

where δ is the Kronecker delta. If star clusters are post-selected, we should add one switch and delay line (for the post-selection) and m − 1 delay lines (to wait for step-1 fusions to finish) to the formula, which leads to

$$\eta \le (2{N}_{{{{\rm{step}}}}}+2m+7-{\delta }_{m,1}){\eta }_{{{{\rm{comp}}}}}.$$
(25)

MTQC is the same as PTQC except that m is fixed to 1 and central qubits are encoded. Since only side qubits are involved in CBSMs, Eqs. (24) and (25) for m = 1 can be directly applied to this case. Figure 7 shows only the case that star clusters are post-selected, which gives higher thresholds than the case without it. In Supplementary Note 8, we discuss the effects of the central qubit encoding in detail, showing that it is not helpful for improving the performance of the protocol unlike claimed in Ref. 18.

For the tree-encoding method, the thresholds per component are already reported in Fig. 4b of Ref. 24. The number \({N}_{\det }^{* }\) of detectors per data qubit, which is used as a resource measure in Ref. 24, can be approximately converted to \({N}_{{{{\rm{GHZ}}}}}^{* }\) by multiplying 1/198. It is because a single successfully generated GHZ-3 state requires 6 × 32 = 192 detectors for its generation and two detectors for measuring each photon in the state.

We lastly investigate the approach with single-photon qubits and boosted fusions. Employing the BSM scheme in Ref. 19, a GHZ-2m state for each m {1, 2,  , N − 1} (for an integer N≥2) is used as an ancillary state for a single BSM, where a GHZ-2 state is a Bell state \(\left\vert 00\right\rangle +\left\vert 11\right\rangle\). (Bell states are ignored in resource analysis.) The BSM scheme succeeds with the probability of \((1-1/{2}^{N}){(1-\eta )}^{{2}^{N}}\) and discriminates only the letter of the Bell state (qsign = 1/2, qlett = 0) with the probability of \({(1-\eta )}^{{2}^{N}}/{2}^{N}\). In other cases, photon losses are detected and the data is discarded (qsign = qlett = 1/2). Based on this information, we can conduct error simulations for various values of N and obtain the loss thresholds, as done for PTQC. To compute the threshold per component, we consider the path of a photon in an ancillary GHZ-2N−1 state (which is the longest):

$$\begin{array}{lll}\eta &\le &{\eta }_{e}+{\eta }_{m}+(1+{2}^{N}){\eta }_{b}+(1+{N}_{{{{\rm{step}}}}}^{{{{\rm{anc}}}}})({\eta }_{s}+{\eta }_{d})\\ &=&(5+{2}^{N}+2{N}_{{{{\rm{step}}}}}^{{{{\rm{anc}}}}}){\eta }_{{{{\rm{comp}}}}},\end{array}$$
(26)

where \({N}_{{{{\rm{step}}}}}^{{{{\rm{anc}}}}}\) is the number of steps during the generation of the GHZ-2N−1 state. The factor 2N in front of ηb comes from the number of beam splitters in a boosted fusion19. Considering ancillary GHZ states for two step-1 and two step-2 fusions per central qubit, \({N}_{{{{\rm{GHZ}}}}}^{* }\) is given as

$${N}_{{{{\rm{GHZ}}}}}^{* }=\left\{\begin{array}{ll}3+4{N}_{{{{\rm{GHZ}}}}}^{{{{\rm{anc}}}}}\quad &{{{\rm{without}}}}\,{{{\rm{PS}}}},\\ \frac{3+2{N}_{{{{\rm{GHZ}}}}}^{{{{\rm{anc}}}}}}{\left(1-1/{2}^{N}\right){(1-\eta )}^{{2}^{N}}}+2{N}_{{{{\rm{GHZ}}}}}^{{{{\rm{anc}}}}}\quad &{{{\rm{with}}}}\,{{{\rm{PS}}}},\end{array}\right.$$
(27)

where “PS” means post-selection of star clusters and \({N}_{{{{\rm{GHZ}}}}}^{{{{\rm{anc}}}}}\) is the average number of GHZ-3 states required to generate all the ancillary GHZ states for one BSM. The calculation results are as follows: For the cases of N≤3, we get ηth < 10−3. For the case of N = 4 with PS, we get ηth = 2.7 × 10−3, ηth/Ncomp = 1.0 × 10−4, and \({N}_{{{{\rm{GHZ}}}}}^{* }=185\). For the case of N = 5 with PS, we get ηth = 1.8 × 10−3, ηth/Ncomp = 4.0 × 10−5, and \({N}_{{{{\rm{GHZ}}}}}^{* }=1027\). Only the case of N = 4 with PS is marked in Fig. 7.