Triangular color codes on trivalent graphs with flag qubits

The color code is a topological quantum error-correcting code supporting a variety of valuable fault-tolerant logical gates. Its two-dimensional version, the triangular color code, may soon be realized with currently available superconducting hardware despite constrained qubit connectivity. To guide this experimental effort, we study the storage threshold of the triangular color code against circuit-level depolarizing noise. First, we adapt the Restriction Decoder to the setting of the triangular color code and to phenomenological noise. Then, we propose a fault-tolerant implementation of the stabilizer measurement circuits, which incorporates flag qubits. We show how information from flag qubits can be used with the Restriction Decoder to maintain the effective distance of the code. We numerically estimate the threshold of the triangular color code to be 0.2%, which is competitive with the thresholds of other topological quantum codes. We also prove that 1-flag stabilizer measurement circuits are sufficient to preserve the full code distance, which may be used to find simpler syndrome extraction circuits of the color code.


Introduction
Universal quantum computers offer the exciting potential of solving certain classes of problems with exponential speedups over the best known classical algorithms [1]. However, one of the main drawbacks of quantum devices is their sensitivity to noise. One way to mitigate effects from noise is to fault-tolerantly encode the logical information into error correcting codes, such as stabilizer codes [2,3]. Stabilizer codes allow us to extract information about the errors by measuring certain Pauli stabilizer generators without revealing the state of the encoded information. For the special case of topological stabilizer codes [4][5][6], physical qubits can be placed on a lattice so that the stabilizer generators can be measured using only nearest-neighbor interactions. Information from the stabilizer measurement outcomes (known as the error syndrome) is fed into a classical decoding algorithm whose goal is to find likely error configurations based on the obtained syndrome. We remark that for generic stabilizer codes, the task of optimal decoding is a computationally hard problem [7,8]. Nevertheless, there exist many efficient (but not necessarily optimal) decoding algorithms for topological codes.
In addition to protecting logical information from noise, it is important to perform gates on information encoded in a quantum error correcting code. These gates need to be implemented using fault-tolerant methods to prevent errors from spreading uncontrollably. One simple way to apply logical gates fault-tolerantly is to use transversal operations. Unfortunately, there are certain limitations on logical gates implemented by transversal operations [9][10][11][12][13]. In particular, no non-trivial stabilizer code can have a universal logical gate set consisting only of transversal gates. Still, we should seek quantum codes which not only exhibit good performance in terms of correcting errors but which can also implement as many logical gates transversally as possible. The color code is distinguished in this latter sense since, unlike for the toric code, all logical Clifford gates can be implemented transversally [14][15][16][17].
While computationally advantageous, the color code has lacked competitive decoders and syndrome measurement circuits with two clear problems standing in the way. First, the decoding problem seemed more difficult than decoding the toric code [18,19], which can be solved via a simple matching algorithm. Second, color code stabilizer generators are higher weight than the toric code stabilizers, thus in general requiring more ancilla qubits. The first problem has been extensively studied [20][21][22][23][24][25]. The thresholds for optimal correction, obtained by statistical-mechanical mappings, are very comparable for both the toric and color codes [5,[26][27][28]. Thus, one should not expect the inferior error-correction performance of the color code. Indeed, this was confirmed with color code decoders matching the performance of the toric code decoders [29][30][31] assuming perfect syndrome measurement circuits.
Dealing with the second problem, thus extending the competitiveness of the color code to circuit-level noise, is the subject of the current paper. Our starting point is the recently proposed decoder for the color code, the Restriction Decoder [31], which is particularly appealing due to its simplicity and good performance. The Restriction Decoder builds on the close connection between the toric and color codes in any dimension [32]. It combines any toric code decoder with a local lifting procedure to find a color code correction. Importantly, the Restriction Decoder seems to be a good candidate for adaptation to realistic circuit-level noise.
In this work, we obtain three key results. Our first result focuses on the adaptation of the Restriction Decoder to the triangular color code and to phenomenological noise. We emphasize that the original version of the Restriction Decoder is applicable only to the color code on a lattice without boundaries and to the scenario of perfect syndrome extraction, i.e. when there are no measurement errors. A naive adaptation of the Restriction Decoder would be to perform the decoding of the toric code with boundaries, and then apply a generalized lifting procedure also to the boundary. This naive adaptation would, however, result with the effective distance dropping by half (i.e. the code would correct errors arising from d 3 4 ⌊( ) ⌋faults). In our adaptation of the Restriction Decoder, we thus address this problem by first finding connected components of the error syndrome, and only then applying the local lifting procedure. We show numerically that using such a scheme enables any error arising from d 3 2 ⌊( ) ⌋faults to be corrected. As was shown in [33], for superconducting qubit architectures with fixed frequency qubits, frequency collisions and cross-talk errors can be reduced by using codes where the degree of the connectivity between qubits is small. For our second result, we show how the color code qubits and all of the required ancilla qubits can be placed on vertices of the hexagonal lattice such that syndrome measurement circuits interact only with neighboring qubits. Consequently, each qubit has degree three connectivity. Further, we show how the syndrome measurement circuits take advantage of additional ancilla qubits used as flag qubits [37][38][39][40][41][42][43]33]. In an error correction scheme, the role of flag qubits 5 is to detect errors of weight greater than v arising from < v d eff faults (where d eff if the effective distance of the code with a given decoder 6 ) and to provide additional information allowing such errors to be identified and corrected. Further, we show how to supplement the Restriction Decoder with information from the flag qubits to maintain the full effective distance of the color code. In particular, we show that using 1-flag circuits is enough to recover the effective distance of the code. We emphasize that in our proof the structure of the color code plays an important role, since weight-three Pauli errors of the same type arising from two faults in a stabilizer measurement circuit cannot have full support along a minimum-weight logical operator of the color code.
For our third result, we provide numerical estimates of the storage threshold of the adapted Restriction Decoder for the triangular color code against both code capacity and a full circuit-level depolarizing noise model. We estimate the Restriction Decoder threshold for the triangular color code against the circuit-level depolarizing noise model to be 0.2%. In table 1, we compare the connectivity, total number of qubits, transversal gate sets and threshold of the triangular color code with other topological codes. We remark that the triangular color code threshold for the circuit-level depolarizing noise model without the use of flag qubits and edge weight renormalization has also been independently investigated in [45,46]. We also point out that in [47], the color code with flag qubits was studied for small distances using machine learning methods where no prior information regarding the noise model is required. Although such methods lead to good code performance compared to algorithmic decoders, they can only be applied to small distance codes since they are not scalable [48].
The manuscript is organized as follows. Section 2 is devoted to decoding the color code. We begin in section 2.1 by briefly reviewing the triangular color code and in section 2.2, we review the Restriction Decoder for the color code. We then show how to adapt the Restriction Decoder to the triangular color code in section 2.3, and in section 2.4 we show how to incorporate measurement errors into the decoder. In section 3, we focus on the fault-tolerant implementation of the color code on low degree graphs. In section 3.1, we describe 5 We point out that in [44], unverified cat states interacting with data qubits, along with a decoding circuit can be used to fault-tolerantly measure stabilizers. However such methods add additional overhead compared to the flag schemes presented in this paper. Further, it is not known if they can be implemented in a decoding scheme in a scalable and efficient way. 6 Note that given an error correcting code of distance d and a decoder used to correct errors, it is possible that not all errors arising from d 1 2 ⌊( ) ⌋faults can be corrected (in many cases a suboptimal decoder is preferred for reasons of speed and scalability). In such a case the circuit layout of the triangular color code on a graph of degree three. We then provide the syndrome measurement circuits in addition to the CNOT gate scheduling for a full round of stabilizer measurements. In section 3.2, we show how flag qubits can be used to correct high weight errors arising from fewer faults, and prove in appendix C that only 1-flag circuits are required to measure the weight-six stabilizers. In section 3.3 we show how to add flag edges to the decoding graphs, and in section 3.4 we show how edges of the graph are renormalized based on the flag qubit measurement outcomes. We conclude section 3 by providing an alternative flag scheme which does not require modifications to the decoding graphs in section 3.5. In section 4, we provide numerical results of the performance of the triangular color code under both code capacity and circuit level depolarizing noise models. We conclude in section 5 and discuss future work.

Triangular color code
The triangular color code is a version of the color code defined on a two-dimensional lattice  with three boundaries, see figure 1(a). We choose the lattice  to be a finite region of the hexagonal lattice. Importantly, the lattice , as a color code lattice, has to satisfy the following two conditions • 3-valence: all the vertices except for the three corner vertices of  are incident to three edges.
• 3-colorability: every face of  can be colored in one of three colors R, G and B in such a way that any two neighboring faces sharing an edge have different colors.
We place one qubit at each vertex of . For each face of  we introduce both X-and Z-type stabilizer generators, each of which are supported on all the qubits belonging to that face. The code space is defined as the +1 ( )-eigenspace of all the stabilizer generators. We remark that any logical Pauli operator of the color code can be implemented as a tensor product of Pauli operators supported within a 1D string-like region.
The discussion of the color code decoding can be simplified if we use a lattice * dual to the lattice . We illustrate the dual lattice * in figure 1(b). Since  satisfies the 3-valence condition, * necessarily consists of triangular faces. By definition, two faces of * share an edge if and only if the corresponding two vertices of  are incident to the same edge of . Lastly, the vertices of * correspond to faces and the three boundaries of . Thus, the vertices of * endow the colors of the corresponding faces (or boundaries) of . Note that in the dual lattice *, qubits are placed on faces and stabilizer generators are identified with vertices (except for the three boundary vertices v R , v G and v B ).

Color code decoding problem
Since color code stabilizer generators can be chosen to be either X-or Z-type, we choose to independently correct the bit-flip X and phase-flip Z errors. Moreover, the 2D color code is self-dual, i.e. X-and Z-type stabilizer generators have the same support, implying that the procedures of correcting X and Z errors are analogous. Thus, in what follows we focus our discussion only on X errors. Table 1. A comparison of the triangular color code with other topological codes: the rotated surface code [34,35] and the Heavy hexagon/square codes [33]. The connectivity c c , 1 2 { } denotes the average number c 1 of nearest neighbor qubits (qubits connected by a CNOT gate) and the maximum number c 2 of qubits interacting with any qubit in a fault-tolerant implementation of the code. We point out that a smaller average connectivity results in fewer frequency collisions and cross-talk errors for superconducting qubit architectures [33]. We provide the total number of qubits (including the data, syndrome measurement and flag qubits) as a function of the code distance d, as well as the generating set of transversal gates, where X, Z, = S i diag 1, ( ), H and CNOT are the Pauli X and Z, phase, Hadamard and controlled-NOT gates (a bar above the gate denotes the logical version of the gate). Note that S, H and CNOT generate the Clifford group. We observe that the storage thresholds of the analyzed codes against the circuit-level noise model (described in section 3.4) are comparable.

Topological code
Connectivity Total number of qubits Transversal gates Threshold Heavy hexagon code (only X errors) Heavy square code a The threshold of 0.45% for the Heavy Hexagon code is only for one type of Pauli error, since the code is a hybrid surface/Bacon-Shor code, and the Bacon-Shor code has no threshold [36]. b The threshold of p th =0.7% was obtained from multiple independent simulations performed at IBM using the noise model described in the text and optimized edge weights. Note that in [58], a threshold of over 1% was obtained, but we could not reproduce such results for the noise model considered in this work.
Let us denote by D  0 * ( ), D  1 * ( )and D  2 * ( )the sets of vertices, edges and faces of the dual lattice *. For convenience, we exclude the edges v v , ( )be the subset of faces, which correspond to qubits affected by X errors. The corresponding syndrome } is the subset of all the Z-type stabilizer generators, which anticommute with the error ò. The syndrome σ can be found as the subset of vertices, which are incident to an odd number of faces in ò. As illustrated in figure 1(b), a single X 1 error anticommutes with three neighboring stabilizer generators, whereas a two-qubit X X 2 3 error anticommutes with two stabilizer generators. Note that near the boundary a two-qubit error X X 4 5 anticommutes with only one stabilizer generator.
The problem of color code decoding can now be formulated as follows: given the Z-type syndrome find an X-type correction operator supported on f Í D  2 * ( ), whose syndrome matches σ. We can view color code decoding as a task of finding a subset of faces f from some subset of vertices σ. Importantly, f has to satisfy the following condition: }is incident to an odd number of faces of f iff v belongs to σ. We say that decoding of the error ò succeeds iff ò combined with the correction f forms a trivial logical operator. In the rest of this section, we describe a novel decoder for the triangular color code which builds upon the recently introduced Restriction Decoder [31].

Adaptation of the Restriction Decoder
First, following [31], we review a couple of concepts, such as boundaries and restricted lattices. Let a Í D  2 * ( ) and b Í D  1 * ( )be some subsets of faces and edges of *. We denote by a ¶ Í D  2 1 * ( ) and b ¶ Í D  1 0 * ( )the sets of all the edges and vertices of *, which belong to an odd number of faces in α and edges in β, respectively. We refer to a ¶ 2 and b ¶ 1 as the 1-boundary of α and 0-boundary of β. We construct the restricted lattice  RG * by removing from * all the vertices of color B as well as all the edges and faces incident to the removed vertices; see figure 1(c). In other words,  RG * contains R and G vertices, as well as edges between them; the restricted lattices  } . This step, roughly speaking, allows us to find a subset of edges r Í D  C C 1 * ( )with the 0-boundary matching s C . For instance, for every vertex in s RG we either choose to pair it up with another vertex in s RG or with the boundary vertex v R ; see figure 1(c). Then, we can find a subset of edges r Í D  , whose 0-boundaries can only differ from s RB and s GB by some subsets of v v , { }, respectively. Before proceeding, we need to introduce the notion of a connected component (see figure 1(d)). We say that two different vertices }are connected iff they have been paired up within at least one of the three restricted lattices. We say that a subset of syndrome vertices . Otherwise, we set C(s) to be one of three colors R, G and B, which is different from the colors of v 0 and + v n 1 . Now, we recall a couple of notions introduced in [31 } , which belong to at least one edge of β, and denote by b v | the set of all the edges of β incident to a vertex Î D  v 0 * ( ). We also define v St 2 ( ) to be the set of all the faces of * incident to the vertex v.
The third step of the adapted Restriction Decoder applies a local lifting procedure Lift to some of the vertices of *. Roughly speaking, the local lifting procedure Lift allows us to find a subset of faces incident to the same vertex, whose 1-boundary locally matches either or the pairing g s ( ) of one of the connected components Î S s . To be more precise, for every vertex as a correction for the syndrome σ. One can show that the syndrome of f(σ) is σ, thus f(σ) is indeed a valid correction of the error ò. We illustrate the correction found by the adapted Restriction Decoder in figure 1 To summarize, the adapted Restriction Decoder consists of the following steps.

For every color
}pair up the restricted syndrome s C within the restricted lattice  C * to find r C , whose 1-boundary matches s C .

Find the set Σ of all the connected components
of the syndrome σ, which are connected to the boundary vertex v R .
3. Apply the local lifting procedure Lift to every vertex to find a subset of faces t v , whose 1-boundary locally matches ρ or g s i ( ).

Return the correction f s t
We would like to make a couple of remarks about the adapted Restriction Decoder. 7 This choice is arbitrary and we can set (i) The local lifting procedure Liftcan naively be implemented in constant time by checking for all possible subsets t Í v St v 2 ( ) of faces incident to the given vertex v whether the 1-boundary of t v locally matches ρ or g s ( ).
(ii) The complexity of the adapted Restriction Decoder is determined by the complexity of finding the pairing of the restricted syndrome s C within the restricted lattice  C } . This problem, in turn, can be efficiently solved using e.g. the Minimum Weight Perfect Matching (MWPM) algorithm [49].

(iii)
Step 2 of the adapted Restriction Decoder is the main difference from the original version of the Restriction Decoder in [31]. Namely, in the presence of the boundaries we find connected components of the syndrome and then apply the local lifting procedure Liftto certain vertices along the pairing for each connected component.
(iv) The adapted Restriction Decoder can correct all errors of weight at mostd 3 2 for odd d. We numerically found that in the sub-threshold regime 8 , the scaling of the logical error rate is . A plot of the logical Z error rate is given in figure 9 (see section 4). We illustrate an example of a smallest weight error leading to a logical error in figure 11(b) (see appendix A).
(v) A naive generalization of the Restriction Decoder could treat the boundary vertex v R on the same footing as any R vertex in the bulk of the lattice *. In particular, one could first pair up the restricted syndromes s RG and s RB within the restricted lattices  RG * and  RB * , and then apply the local lifting procedure Lift to every R vertex of *, including the boundary vertex v R . This decoder, however, is only guaranteed to correct errors of weight at most We discuss such a naive generalization of the Restriction Decoder in appendix A.

Incorporating measurement errors
Until now, we have assumed that the syndrome σ can be extracted perfectly, i.e. the stabilizer measurement circuits do not introduce any errors into the data qubits and there are no measurement errors. In the remainder of this section, we explain how one can use the adapted Restriction Decoder in the presence of measurement errors. In such a setting, to get a reliable estimate of the syndrome we need to repeat stabilizer measurements T times, where T is comparable with the code distance. Let us denote by s Í D  ( ), but also certain flag edges; seefigure 7. A flag edge is added for any two vertices of  V C of the same color, whose graph distance in the restricted lattice  C * is two. To give the reader some intuition, flag edges are added to the matching graph to capture the possibility of a weight-two data qubit error being introduced by a single fault in a stabilizer measurement circuit 9 . We defer the detailed discussion of flag edges to section 3.3. Now, we can construct the space-time matching graph } . The vertices of the space-time matching graph  C  correspond to the elements of the set ¼ , and Î  u w V , C , whenever two vertices u and w of the matching graph  C are connected by an edge, i.e.
are connected by an edge Î  e E C  iff either u=w or e corresponds to a diagonal edge. Diagonal edges are added to the space-time matching graph  C  to account for space-time correlated errors introduced into the data qubits by two-qubit gate failures occurring in the stabilizer measurement circuits. A detailed description of diagonal edges is provided in appendix B. We remark that the edges of the space-time matching graph are assigned weights, which depend on the stabilizer measurement circuits and the flag measurement outcomes; see section 3 and appendix B for more information. Let us denote by  A 2 ( ) a vector space over  2 , whose basis corresponds to the elements of some finite set A. Since there is a one-to-one correspondence between the vectors in  A 2 ( ) and the subsets of A, we would treat them interchangeably.
as a linear map defined on every basis element e by 8 We obtained the scaling numerically in the sub-threshold regime to ensure that the higher order terms are negligible. 9 In section 3.2, we show that flag edges for weight-three data qubit errors arising from two faults in a stabilizer measurement circuit are not if or is a diagonal edge, 0 o t h e r wise, 5 where v v , 1 2 ( ) denotes the edge connecting two vertices v 1 and v 2 in the matching graph  C . We refer to f as the flattening map. Moreover, we define where (whenever e is the flag edge) e 1 and e 2 are the two edges in the restricted lattice  C * connecting the endpoints of e (see section 3 and in particular figure 6). We refer to g as the flag projection map. Lastly, we define the set of highlighted vertices where ⊕denotes the symmetric difference of the syndromes st 1 and s t extracted at time stepst 1 and t. We can think of the vertices W as the space-time locations, where stabilizer measurement outcomes change in between two consecutive measurement rounds. The restricted highlighted vertices W RG are defined as the subset of the highlighted vertices W within the space-time matching graph  ; RG  similarly W RB and W GB . Also, we would Now we are ready to describe how the Restriction Decoder can be used for the triangular color code in the presence of measurement errors. First, we pair up the restricted highlighted vertices W C within the space-time } , and find a subset r C  of the edges of  C  , whose 0-boundary matches (up to the space-time boundary vertices ¶V ) W C . Then, we find the set S  of all the connected components , j 1˜, which are connected to any of the space-time boundary vertices We conclude this section by mentioning that hook errors discussed in [5] form of subset of the space-time correlated errors leading to diagonal edges mentioned above, and discussed further in appendix B. In our work, space-time correlated errors comprise of any error arising from a two-qubit gate failure which can have both spatial and/or temporal correlations. In addition, the flag qubits are used to detect and identify a subset of spacetime correlated errors as discussed in section 3.

Fault-tolerant implementation of the triangular color code
In section 3.1, we first describe the stabilizer measurement circuits used for the triangular color code. The circuits are chosen to minimize the degree of the connectivity of each qubit. In sections 3.2-3.4, we describe how flag qubits can be used to maintain the full effective distance of the Restriction Decoder in the presence of circuit level noise. In section 3.5, we describe an alternative flag scheme compared to the scheme described in previous sections.

Triangular color code stabilizer measurement circuits
As was shown in [33], for superconducting qubit architectures with fixed-frequency transmon qubits coupled via the cross resonance gates [50,51], reducing the degree of the connectivity between ancilla 10 and data qubits can minimize frequency collisions and reduce crosstalk errors. This motivates finding an implementation of the triangular color code where both data and ancilla qubits have low degree connectivity.
In figure 2, an implementation of the triangular color code where both ancilla and data qubits have degree three connectivity is shown. Notice that both data and ancilla qubits arise from a tiling of smaller hexagons (shown in red). Since only one ancilla qubit is needed to measure a given stabilizer, the extra ancilla qubits can be used as flag qubits to correct high weight errors arising from fewer faults. Circuits for measuring the weight-four and weight-six stabilizers with minimal depth are provided in figure 3. As can be seen, one round of X stabilizer measurements can be done in 8 time steps (and thus 16 time steps are required to measure both X and Z stabilizers). For a distance  d 5 color code, the total number of data, syndrome measurement and flag qubits in the implementation of the code is The full CNOT scheduling for one round of X stabilizer measurements which minimizes the total circuit depth is given in figure 4. If the same CNOT scheduling for the weight-four stabilizer measurements were used at the boundaries b 1 , b 2 and b 3 , an additional time step would be required to perform the X stabilizer measurements. Hence a different scheduling for the weight-four stabilizers is used for each boundary.

Use of flag qubits to correct high weight errors
Performing an exhaustive search over all single fault locations in the circuits of figure 3, it can be shown that a single fault results in a data qubit error of weight at most two. Similarly, two faults occurring during a weight-six stabilizer measurement can result in a data qubit error of weight at most three. In what follows, if a flag qubit has a non-trivial measurement outcome, we will say that the flag qubit flagged.
In order to maintain the full effective distance of the Restriction Decoder adapted to the triangular color code presented in section 2, [39] proves the sufficiency of 2-flag circuits for stabilizer measurements. In other words, if Figure 2. Implementation of the triangular color code where syndrome measurement qubits (red, blue and green circles), flag qubits (yellow circles) and data qubits (white circles) have all degree three connectivity. All the qubits can be viewed as being located at the vertices of smaller hexagons (shown in red). The black edges between vertices represent physical connections between the qubits. The dashed edges do not represent any physical connections, and are simply included to highlight the two-dimensional lattice . Figure 3. Circuits for measuring (a) weight-four and (b) weight-six Z-stabilizers of the triangular color code with minimal depth. The white circles correspond to data qubits, yellow circles to flag qubits and the dark circle to the ancilla qubits. Circuits for measuring the X-stabilizers can be obtained by reversing the direction of each CNOT gate, swapping +ñ | and ñ 0 | states and swapping X and Z measurements. a single fault occurs in a circuit C g i ( ) for measuring a stabilizer g i which results in a data qubit error of weight greater than one, at least one flag qubit must flag 11 . Similarly, if two faults occur in a circuit C g i ( ) for measuring a stabilizer g i resulting in a data qubit error of weight greater than two, at least one flag qubit must flag. By performing an exhaustive search, we find that the circuits in figure 3 are indeed 2-flag circuits. However, only 1-flag circuits are required to maintain the effective distance of a given decoder (not necessarily the Restriction Decoder) adapted the triangular color code when all circuit components can fail (see for instance the circuit level noise model in section 3.4). We state this result as a theorem: The proof of theorem 3.1 is provided in appendix C. To be clear, theorem 3.1 indicates that with full circuit level noise (where all components of the circuits are allowed to fail), one only needs to consider flag outcomes from a single fault in the stabilizer measurement circuits, which significantly simplifies the decoding scheme presented in sections 3.3 and 3.4. However, to achieve the effective distance of a given decoder, one still needs to provide a flag based scheme which indicates how flag information can be used to recover the full effective distance. Such details are provided in sections 3.3 and 3.4. Moreover, the theorem does not guarantee that there exists an efficient decoder achieving the full code distance.
In figure 5, we give all possible data qubit errors arising from a single fault leading to non-trivial flag-qubit measurement outcomes. For weight-six Z-stabilizers, the only Z-type non-trivial data qubit error that can arise from a single fault resulting in two non-trivial flag measurements is Z Z 3 4 (where the flag qubits f 1 and f 3 have non-trivial measurement outcomes). Other errors arising from a single fault which results in more than one non-trivial flag measurement outcome cannot propagate to the data qubits.
For weight-four stabilizers, since the CNOT scheduling is different at the three boundaries b 1 , b 2 and b 3 , the possible data qubit errors arising from a non-trivial flag measurement depends on the particular boundary and these features must be taken into account by the decoder 12 . Lastly, note that a single fault occurring in a weightfour stabilizer measurement circuit can result in at most one non-trivial flag qubit measurement outcome.
In order to correct weight-two errors arising from a single fault, we use similar methods to those presented in [33]. There are two main steps that need to be implemented. First, edges corresponding to non-trivial flag measurement outcomes need to be added to the lattice * described in section 2 (such edges are given infinite . Full CNOT gate scheduling for one round of X stabilizer measurements. Note that in order to minimize the total number of time steps, a different scheduling for the weight-four stabilizer measurements is used at the boundaries b 1 , b 2 and b 3 . 11 In general, a circuit for measuring a stabilizer P is called a t-flag circuit if at least one flag qubit flags whenever any  v t faults result in an error E satisfying > E E P v min wt , wt ( ( ) ( )) . 12 In particular, in how edge weights are assigned to edges of the lattice * at the boundary. weight unless a flag qubit associated with such an edge flags). Second, the weights for edges belonging to * need to be renormalized, where the weights are chosen based on the number of flags and locations where they occur.

Constructing the matching graph 
We begin by describing the particular flag edges that are added to D  1 * ( )for one round of stabilizer measurements. Since a single fault causing a flag can result in a data qubit error of weight at most two, flag edges need to be added such that choosing such an edge during the MWPM step of the decoding algorithm would allow both data qubits to be identified when implementing the Restriction Decoder. In figure 6, we illustrate the 2D version of * with the added flag edges, which connect two vertices in D  0 * ( )of the same color, using the results from figure 5. For a weight-six stabilizer corresponding to a face i of  with data qubits labeled 1-6 (as in figure 5), the possible weight two data qubit errors are arising from a single fault are E E 1 2 , E E 3 4 and E E 5 6 . Here E j is X j or Z j (depending on whether an X or Z type stabilizer is being measured) and has support on the data qubit j belonging to the face i of . Since such weight two-data qubit errors results in two highlighted vertices of the same color 13   { }. Note that we ignore contributions from CNOT failures which also add X errors to the data since X and Z errors are decoded separately, and for a single fault, the weight of the X errors can be at most one. Lastly, data qubit errors arising from a single fault during X-stabilizer measurements have the same support as shown above, but are of X-type. Figure 6. Flag edges added to the 2D lattice *. In this example, the lattice * shown corresponds to the d=9 triangular color code where the flag f 1 flagged (belonging to the face i with ancilla vertex v i ), resulting in the data qubit errors E E 1 2 . Note that this depiction of the lattice * differs from previous illustrations, e.g. figure 1, by an affine transformation.
As an example, in figure 6(a), we illustrate a highlighted green flag edge arising from a weight-two data qubit error E E 1 2 connecting two highlighted green vertices in D  0 * ( ). In other words, we are considering the case where a single fault during a weight-six stabilizer measurement circuit corresponding to face i with red vertex Î D  v i 0 * ( ) resulted in the weight-two data qubit error E E 1 2 . The weight of the flag edge, along with all other edges in D  1 * ( ), are then renormalized (see section 3.4 for a description of the renormalization step). If there are no other faults, then the green flag edge will be chosen during the MWPM step of the Restriction Decoder as illustrated in figure 6(a). On the other hand, if the two data qubit errors E E 1 2 had arisen from failures at the qubits 1 and 2, then the four edges shown in figure 6(b) would be highlighted during the MWPM step. Hence, prior to implementing the local lifting procedure Lift of the Restriction Decoder described in section 2, the highlighted flag edge of figure 6(a) is projected to the four 2D edges of D  1 * ( )shown in figure 6(b) (again, assuming that a single fault occurred resulting in the flag f 1 ).
Note that flag edges are used specifically for weight-two errors arising from a single fault (we will discuss more about weight one data qubit errors arising from a single fault resulting in a flag in section 3.4). In general, a given flag edge can be chosen in at most two restricted lattices when perform MWPM. In the example illustrated by figure 6, the restricted lattices are  RB * and  GB * . If a flag edge is highlighted when performing MWPM on a given restricted lattice (say  RB * ), the flag edge should be projected to two 2D edges belonging to D  RB 1 * ( )(i.e. edges present in D  RB 1 * ( )before flag edges were introduced). In the presence of other errors, it is possible that a flag edge would only be chosen during MWPM in only one of the two restricted lattices it belongs to, in which case one would project the flag edge onto two 2D edges of D  1 * ( )instead of four. Lastly, note that two-qubit errors arising when there are flags (i.e. those given in figure 5) always result in two highlighted vertices of the same color (assuming there are no other errors). This argument justifies our choice of flag edges always connecting two vertices of the same color.

Edge weight renormalization
The circuit level depolarizing noise model used throughout the manuscript is given as follows.
1. With probability p, each single-qubit gate location is followed by a Pauli error drawn uniformly and independently from X Y Z , , { }.
2. With probability p, each two-qubit gate is followed by a two-qubit Pauli error drawn uniformly and independently from Ä Ä I X Y Z I I , , , 3 , any single qubit measurement has its outcome flipped. 5. Lastly, with probability p, each idle gate location is followed by a Pauli error drawn uniformly and independently from X Y Z , , { }.

With probability
Let P e be the probability for a given edge Î D  e 1 * ( )to be highlighted during MWPM. P e can be computed by summing the probabilities of all error configurations (using the circuit level depolarizing noise model described above) resulting in the edge e being highlighted. The weight for the edge e is then given by =w P log e e . More details on the edge weight calculations for the lattices * considered in this manuscript are given in appendix B.
, r 1 2  be the generating set for the stabilizer group of the triangular color code. Further, let  (see appendix B). Further it was shown that by adopting such a scheme, the full distance of the considered codes could be preserved (i.e. any error arising from at most d 1 2 ⌊( ) ⌋faults would be corrected). In this work, edge weights will be renormalized as described above allowing any set of errors from at most d 3 2 ⌊( ) ⌋faults to be corrected (since the Restriction Decoder can correct errors arising from at most d 3 2 ⌊( ) ⌋faults). Since a flag edge e f i should only be used when there are flags, its weight should be set to infinity unless the flag qubits associated with the edge e f i flagged. Further, as seen in figure 5, a single fault resulting in flags can also introduce weight-one data qubit errors. In figure 7, we show the flag edges and edges associated with single qubit errors whose weights should be renormalized to =w P log If Ï e C j f is a flag edge, then its weight should be infinite.

Alternative flag scheme
Instead of renormalizing the edge weights for edges in D  1 * ( )based on the flag measurement outcomes, given enough flag qubits associated with a stabilizer measurement circuit, there is a simpler approach that one can take 14 .
Consider the the case where only the flag qubit f 1 flags during the weight-six Z stabilizer measurement shown figure 8. Assuming there was at most one fault, from figure 5, the possible Z-type data qubit errors are I Z Z Z , , Consequently, if one applies the correction Z 1 to the data immediately after the flag outcome f 1 is known, the weight of any remaining data qubit error can be at most one. Similarly, for a flag outcome f 2 , one would apply the correction Z 4 , for f 3 one would apply the correction Z 6 and for f f 1 3 , one would apply Z Z 3 4 . Lastly, if a different flag outcome is obtained, no correction is applied to the data 15 . In all cases, the remaining data qubit errors arising from a single fault during the measurement of the stabilizer can be at most one. The 14 The ideas presented in what follows were first proposed in a correspondence with Ben Reichardt regarding the weight-four stabilizer measurements of the heavy-hexagon code of [33]. 15 To be clear, a correction to the data would still be applied once all the measurement outcomes were obtained and fed into the Restriction Decoder described in section 2. The corrections described in this section refer to preliminary corrections, based uniquely on the flag measurement outcomes. same scheme can be applied when measuring X stabilizers, but replacing the Z corrections with X Pauli's, supported on the same qubits. Further, one can define similar rules for the weight-four stabilizer measurements. Also, note that in the presence of slow measurements, such corrections based on the above flag outcomes could be done in a Pauli frame [44,[52][53][54].
In what follows, the flag scheme described above will be referred to as the direct flag method. By applying the direct flag method, it is straightforward to see that a single fault occurring during a stabilizer measurement can result in a data qubit error of weight at most one. From theorem 3.1, if two faults occur resulting in a flag outcome compatible with those of figure 5, the resulting data qubit error can be of weight at most three and cannot be entirely supported on a logical operator. With these properties, it is straightforward to show that the direct flag method satisfies the the fault-tolerant definitions of [39].
One caveat of such a scheme is that in general, more flag qubits are required for each stabilizer measurement compared to the edge weight renormalization scheme of section 3.4. For instance, consider the case where a single flag qubit was used for a weight-four Z-type stabilizer. If a single fault resulted in a flag, the possible Z-type data qubit errors would be Z Z Z Z Z Z I , , Since there is only one flag qubit, one would not have enough information to determine whether to apply a Z 1 or Z 3 correction to the data. However, one could still use the scheme of sections 3.3 and 3.4 and renormalize the edge weights for edges in D  1 * ( )corresponding to data qubit errors Z 1 , Z 3 and Z Z 1 2 (using the same methods as in figure 7). Following the same arguments presented in [33], one can show that the effective code distance of the color code would be preserved.
Another caveat of the direct flag method (which is relevant for the lattice of figure 4) is that regardless of the noise model, the same operations are always applied to the data (and thus the scheme is suboptimal). In the case where measurement errors occur with high probability, the direct flag method would apply weight-one corrections to the data more often than necessary, whereas the renormalization methods of sections 3.3 and 3.4 would incorporate the higher measurement error probabilities into the assignment of edge weights.
For the reasons mentioned above, the numerical results of section 4 were obtained using the edge weight renormalization methods of sections 3.3 and 3.4.

Numerical results
In this section we present the plots illustrating the logical failure rates for both code capacity noise and the full circuit level noise model described in section 3.4.
For code capacity noise, each data qubit can be afflicted by X, Y or Z Pauli errors, each occurring with probability p 3. Measurements, state preparation and gates are assumed to be implemented perfectly. Thresholds for code capacity noise are important as they illustrate the theoretical limitations of a code and the decoder used to correct errors. In figure 9, we illustrate logical Z error rates for the triangular color code using the 2D decoder presented in section 2. We considered distances d=3 to d=21. Note that since both X and Z errors are corrected symmetrically by the decoder, the plot for logical X error rates is identical to the one shown in figure 9. { }. Applying the correction Z 1 immediately after the flag outcome guarantees that there can be at most a weight-one data qubit error.
Numerically, we find a threshold of 12.6%, in accordance to the threshold found in [29] using the decoder by projection. Although the threshold is identical to the decoder by projection, the Restriction Decoder applied to the triangular color code presented in section 2 achieves lower logical error rates since a larger family of errors can be corrected by the latter (see appendix A for more details).
In figure 10 we illustrate the logical X and Z error rates for the triangular color code afflicted by the full circuit level noise model using the Restriction Decoder described in section 2.4 (with = + T d 1, where no errors are introduced in round + d 1 to guarantee projection to the codespace) along with the flag methods and scheme to renormalize edge weights described in section 3 and appendix B. As can be seen, for both X and Z logical failure rates, the threshold occurs at = p 0.002 th . Note that in our simulations, for a given syndrome measurement round, we chose the convention where we first measured X-stabilizers followed by Z-stabilizers. Now, suppose that during the j′th syndrome measurement round, a subset of flag qubits flagged during the X-stabilizer measurements. Flag edges (described in section 3.3) with finite weights are then introduced in the j′th 2D layer of the full 3D lattice * used for X-stabilizer measurement outcomes. However, for flag qubits which flag during the Z-stabilizer measurements, Z errors resulting from faults which led to the non-trivial flag measurements would only be detected during the + j 1′th syndrome measurement round. Hence, in such a case, flag edges with finite weight must be introduced in the + j 1′th 2D layer of the full 3D lattice * used for Z-stabilizer measurement outcomes. We also point out that in order to obtain the high threshold and logical error rate scaling in figure 9, the choice of flag edges and structure of the decoding graphs given in section 3.3, and the edge weight renormalization scheme given in section 3.4 were all crucial features. As shown in [33], omitting such steps can lead to higher logical error rates by several orders of magnitude.
Lastly in section 3.4, we showed that in the presence of flags, edges e are renormalized as = -¢ w P log  . Logical Z error rates for the triangular color code afflicted by code capacity noise, where each data qubit has an X, Y or Z Pauli error with probability p 3 each. Data qubit errors were corrected using the 2D decoder described in section 2. Since the decoder corrects both X and Z errors symmetrically, the plot for logical X errors is identical to the one shown above. We numerically explored a more general setting, where ¢ = a P p P e m e for some parameter α. Choosing a = 1.5 (compared to a = 1 in previous simulations), we did not find a significant difference between the obtained logical failure rate curves and those of figure 10. We leave a more detailed exploration of renormalization parameters to future work.

Conclusion
In this work, we developed an extension of the Restriction Decoder introduced in [31] to the triangular color code. In the presence of boundaries, a new notion of connected components was introduced to deal with errors resulting in highlighted boundary vertices. We then showed how the Restriction Decoder can be adapted to include measurement errors.
Next, we considered a fault-tolerant implementation of the triangular color code applicable to a full circuit level noise model. We showed how the triangular color code can be implemented on a lattice of degree three to reduce frequency collisions and cross talk errors relevant to superconducting qubit architectures. We emphasize that instead of the hexagonal lattice we could use the standard toric code architecture with the square lattice, where we do not use some connections between the qubits. Further, we showed how the additional qubits necessary for a low degree implementation of the triangular color code can be used as flag qubits and provided a scheme which incorporates information from the flag qubits to preserve the full effective distance of the Restriction Decoder. Performing a numerical simulation, we estimated the storage threshold of the triangular color code against circuit-level depolarizing noise to be 0.2%. The threshold obtained is competitive with the surface code threshold, and thresholds for other low degree topological codes such as the ones considered in [33]. However, the color code has the computational advantage that the full Clifford group can be implemented using only transversal operations. Hence due to the low degree connectivity of the hexagonal layout, transversal gate sets and competitive threshold, we believe the color code to be a promising candidate for fault-tolerant quantum computation.
For future work, it would be interesting to consider an implementation of the flag schemes presented in this work to other color code families, such as the 4.8.8 color code family and color codes with twist defects (see for instance [55]). Finding implementations of such codes on low degree graphs would also be an area of interest since such implementations could potentially be more suitable for superconducting qubit architectures. Further, of experimental relevance would be to study such codes under biased noise models such as in [56,57]. Lastly, we believe a further numerical study for edge weight renormalizations, such as finding the optimal value of α (see the last paragraph of section 4) would be of great interest. ( )). Finally, we find the correction to be f s = We illustrate a naive generalization of the Restriction Decoder infigure 11. The effective distance of that decoder is however reduced by a factor of two compared to the effective distance of the adapted Restriction Decoder described in section 2.3. In other words, a naive decoder is only guaranteed to correct errors of weight at most d 3 4 ⎢ ⎣ ⎥ ⎦ , whereas the adapted Restriction Decoder can correct all the errors of weight at most We illustrate examples of smallest weight errors leading to a logical error in figure 11. Appendix B. Edges and edge weight calculations for the space-time matching graphs  RG  , In addition to the 2D edges of the lattice *, along with 3D vertical edges connecting a vertex in D  0 * ( )of the same color in two different time steps to deal with measurement errors, there can also be correlated errors in both space and time arising from CNOT gate failures [58]. To see this, consider the circuit in figure 12(a), which illustrates the connectivity between a red ancilla vertex in D  0 * ( )(belonging to a face of  in the bulk), with blue and green vertices in D  0 * ( ). In figure 12(b), we label the edges between the red vertex with the green and blue vertices (as would be seen in *) as e 1 to e 6 . Now, consider the CNOT gates connecting the red and green vertices to the data qubits (represented by yellow circles), along the edge e 5 . In particular, we focus on the CNOT gates between the flag qubits (represented by white circles) and the data qubits.
Let C t l correspond to a CNOT gate belonging to a face of  with a vertex in D  0 * ( )of color l, applied during time step t for a given round of syndrome measurements. Now suppose that during the j′th syndrome measurement round, the CNOT C 4 G fails and introduces an error from the set ZZ ZY YZ YY , , , { }. Propagating such errors through the stabilizer measurement circuits of figure 3(b), one can show that such a fault introduces a Z error on the data qubit q j shown in figure 12(a). However, given the time step at which the error occurs (the fourth time step), we find that only the green ancilla vertex is highlighted. If a Z error on the data qubit q j had instead occurred during the first time step of the syndrome measurement round j, then both green and red ancillas would have been highlighted (assuming no other errors were introduced). Now during the next syndrome measurement round + j 1 (again, assuming no other errors are introduced), both red and green ancillas would be highlighted. Similarly, if the CNOT gate C 3 R failed and introduced an error from the set IZ XZ IY XY , , , { }, the same pattern in highlighted ancillas would be observed. Now, if both red and green ancillas were highlighted in the same syndrome measurement round (say during the round j, caused by a Z data qubit error on qubit q j at the first time step), the edge e 5 would be chosen when performing MWPM on the matching graph  RG  . However, for CNOT failures mentioned above, since the red vertex is highlighted during round + j 1, whereas the green vertex is highlighted in both rounds j and + j 1, one can add the green edge e G shown in figure 13 to the matching graph  RG  . Since the Restriction Decoder considers changes in measurement outcomes of a given vertex between consecutive syndrome measurement rounds, the set of highlighted vertices W (see section 2.4) will contain the green vertex for round j with the red vertex for round + j 1. Thus the shortest path connecting both vertices is obtained by choosing the edge e G . If such an edge was chosen during MWPM, e G would be projected onto the edge e 5 when applying the flattening map g (see equation (6)). Lastly, it can be shown that the red edge e R in figure 13 figure 13 are referred to as 3D diagonal edges since they are due to errors arising from CNOT gates resulting in different highlighted vertices in W between two consecutive syndrome measurement rounds. Consequently, such faults result in highlighted edges between vertices belonging to different locations in the 2D lattice * (after performing the flattening on all edges belonging to the matching graphs  RG  ,  RB  and  GB  ). Measurement errors result in 3D vertical edges connecting the same vertex in two different syndrome measurement rounds (see for instance [59]).
The set of all 3D diagonal edges associated with the matching graphs  RG  ,  RB  and  GB  can be found in figure 14. Such edges are obtained by performing a similar analysis to the one performed above leading to the   edges shown in figure 13. In particular, we considered all single fault events arising from CNOT failures leading to edges which (after applying the flattening map g) are projected on the 2D edges e 1 to e 6 in the bulk (see figure 12(b)). In addition, we also considered the CNOT scheduling at all boundary locations. Next, we show how to obtain the edge weight for e G in figure 13. From the noise model described in section 3.4, each two-qubit Pauli operator occurs with probability p 15. To leading order in p, a green edge will Proof. To prove the theorem, it is enough to show that, within a single round of stabilizer measurements, any set ofd 1 or fewer faults does not cause a (nontrivial) logical error to be placed on the data without any flag qubits flagging. This is enough because it implies that two different sets of d 1 2 ⌊( ) ⌋or fewer faults can be distinguished either by their flags or by future rounds of stabilizer measurements. Therefore, in principle, there is an algorithm to decode with full distance.
There is a simplification to the problem coming from the form of the syndrome extraction circuits. Notice that if the circuits measuring Z-or X-type stabilizers propagate errors from ancilla to data qubits, then the resulting errors on the data are Z or X errors, respectively. If it takes f 0 faults to place a nontrivial logical operator P without flag qubits flagging, then there is a way to use ff 0 faults to place the logical operator Z(P) and ¢  f f 0 faults to place logical operator X(P), where Z(P) is an Z-type Pauli string with Pauli Z wherever P has Z or Y and with identity elsewhere and = X P PZ P ( ) ( ). As P is nontrivial, at least one of Z(P) and X(P) is also nontrivial while being entirely Z-or X-type. Using the code symmetry, assume Z(P) is nontrivial. In the remainder, we restrict attention to errors of purely Z-type and prove a lower bound   f f d 0 . Given a logical Pauli operator P of Z-type, we can associate parts of its support to each face. During a single round of syndrome extraction, imagine that faults in the circuit measuring the stabilizer on face i result in Z errors on qubits in a set A i (of course A i must be a subset of the qubits in the face). Then, if there are s faces and ! is the symmetric difference operation on sets, we call the collection of sets i i (formed, for instance, by repeatedly finding a qubit q, if it exists, that appears in two sets A i and A j and removing it from both). We call ¢ A i { } a sub-partition of A i { }. We use two facts for this proof-(1) by definition (see [39]), if a 1-flag circuit for syndrome extraction results in two or more errors on the data, either more than one fault has occurred in the circuit or a flag has flagged and (2) + ¢ + ¢ + ¢ + ¢  P d a a a a supp 2 4 6 size three will become sets C i with size two or less during the sub-partition algorithm. It may be that = c b 3 3 , so we are not done.
Step (b) begins by finding a face i such that = C 3 i | | (if none exists we are done). Since Q is logical, it must be that it commutes with the stabilizer on face i and so has even overlap with the faces support. This implies another qubit Î q Q supp( )but Î q C i . So Î q C j for some ¹ j i. Move q from C j to C i and take the complement of set i. This defines a new over-partition ¢ B i { } for another logical operator ¢ Q . Note further that