Cycle Basis Algorithms for Reducing Maximum Edge Participation
Abstract
A cycle basis of a graph is a minimal set of cycles from which every cycle in the graph can be generated by symmetric difference. We study the problem of constructing cycle bases of graphs with low maximum edge participation, defined as the maximum number of cycles in the basis that share any single edge. This quantity, though less studied than total weight or length, plays a critical role in quantum fault tolerance, as it directly impacts the overhead of lattice surgery procedures used to implement an almost universal quantum gate set. Building on a recursive algorithm by Freedman and Hastings, we introduce a family of load-aware heuristics that adaptively select vertices and edges to minimize edge participation throughout the cycle basis construction. Our approach improves empirical performance on random regular graphs and on graphs derived from small quantum codes. We further analyze a simplified balls-into-bins process to establish lower bounds on edge participation. While the model differs from the cycle basis algorithm on real graphs, it captures what can be proven for our heuristics without using more complex graph theoretic properties related to the distribution of cycles in the graph. Our analysis suggests that the maximum load of all of our heuristics will be . Our results indicate that careful cycle basis construction can yield significant practical benefits in the design of fault-tolerant quantum systems. Maximum edge participation has been studied in the graph theory literature under the name basis number, which is the minimum possible maximum edge participation over all cycle bases in a graph.
Keywords and phrases:
Graph algorithms, Cycle Basis, Quantum fault toleranceCopyright and License:
2012 ACM Subject Classification:
Theory of computation Graph algorithms analysisSupplementary Material:
Software (Source code): https://github.com/FanWang000/Cycle_basis_algorithms_publicarchived at
swh:1:dir:ef7c07c921a0cf1b423e9089254a8b82a7780b4c
Editors:
Martin Aumüller and Irene FinocchiSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
A cycle basis of an undirected graph is a minimal set of cycles such that every cycle in can be expressed as the symmetric difference (i.e., edgewise XOR) of some subset of the basis cycles (i.e., cycles in the basis). The cycles are not necessarily simple and are just viewed as Eulerian subgraphs, i.e., subgraphs in which every vertex has even degree. For any connected graph with vertices and edges, the dimension of the cycle space – and hence the number of basis cycles – is exactly [11].
One intuitive way to see this is via a spanning tree of : such a tree has exactly edges and no cycles. Each of the remaining non-tree edges, when added back to the spanning tree, closes a unique simple cycle. These cycles, formed by combining each non-tree edge with the unique tree path connecting its endpoints, constitute a valid cycle basis. A cycle basis constructed this way is called a fundamental cycle basis.
Much of the literature on cycle bases focuses on finding a minimum-weight cycle basis in weighted graphs, where the weight of a cycle is the sum of its edge weights, and the weight of the basis is the sum of the weights of all basis cycles [15, 17, 16]. In unweighted graphs, this reduces to minimizing the total length of the basis cycles. In contrast, we consider a different structural property that disregards edge weights: the maximum edge participation of a basis. This measures the maximum number of basis cycles that any edge participates in. Formally, for a cycle basis of , we define: The motivation for minimizing the maximum edge participation comes from a well-known construction for quantum fault tolerance and is described further in Section 2.
1.1 Previous Work
The basis number for a graph, denoted simply by , is the smallest that can be obtained for any cycle basis [28].
For certain families of graphs, tight bounds on the basis number are known. Planar graphs satisfy [22]. Any complete graph with has , and this characterization is tight: for any , if a graph has , then it must be complete [28]. More recently, the basis number has been related to topological properties of the graph: if a graph can be embedded on a surface of genus , then [18]. Since any graph with edges can be embedded on a surface of genus [23], this implies the general bound . In this paper, we restrict attention to simple graphs or multigraphs with constant edge multiplicity (as is sufficient for the applications in Section 2), yielding .
On the other hand, a general lower bound holds for any connected graph: as shown in [1].
For some constant-degree expander families such as LPS expanders [21], which have logarithmic girth, this implies
1.2 The Freedman–Hastings algorithm
While theoretical bounds on are known for some graph families, few algorithmic approaches explicitly target minimizing this quantity. A notable exception is the recent recursive algorithm of Freedman and Hastings [8], which on any constant-degree graph constructs a cycle basis , such that with high probability The cycle basis produced by the Freedman-Hastings algorithm produces a cycle basis consisting of simple cycles that is also weakly fundamental. A cycle basis is called weakly fundamental if its cycles can be placed in a linear ordering such that each cycle contains at least one edge that does not appear in any later cycle in the ordering [27]. Their method proceeds recursively, handling one of three cases at each step:
-
Case 1: If there is a degree-one vertex, remove it.
-
Case 2: If there is a degree-two vertex with neighbors and : Case 2A: If and are not connected by an edge, remove and add an edge between and . Case 2B: If the edge already exists (i.e., the three vertices form a triangle), add the triangle to the cycle basis and remove . These two subcases are illustrated in Figure 1.
-
Case 3: If all vertices have degree at least three, find a short cycle of length , add it to the basis, and randomly remove one of its edges from the graph.
In the third case, a short cycle of length is found using a breadth-first search (BFS). In this context, cross edges are defined as edges connecting a newly discovered vertex to an already visited one – i.e., all non-tree edges in the BFS tree. Starting from any vertex, any cross edge encountered during BFS, together with the paths from its endpoints to their lowest common ancestor, forms a cycle. The cycle formed by the first cross edge in the BFS tree is guaranteed to have length at most (see Lemma 4.3 of [16]). In the Freedman-Hastings algorithm, the BFS root is chosen uniformly at random, and they use the cycle generated by the first cross edge encountered.
As noted in [8], the algorithm can be extended to multigraphs via a preprocessing step: all self-loops and parallel edges are first removed, and the cycles induced by these edges are added directly to the cycle basis.
However, the bound achieved by this algorithm may be pessimistic for typical graphs. In [32], it was conjectured that for constant-degree random expanders, it might be possible to construct a cycle basis such that the expected maximum edge participation is only . From this perspective, the Freedman–Hastings construction can be seen as a worst-case bound, while more efficient average-case constructions may be possible with more refined cycle selection strategies. More broadly, the problem of minimizing maximum edge participation over all cycle bases remains a largely open combinatorial question, with practical implications in contexts such as quantum error correction and fault-tolerance [13, 12].
1.3 Our contribution
In the Freedman–Hastings algorithm, several design choices remain flexible and open to optimization, including:
-
the starting vertex (root) for BFS;
-
the selection of the cross edge used to extract a short cycle;
-
the choice of which edge to remove from the cycle.
We explore heuristics that refine the edge and vertex selection rules, proposing a load-aware variant of the algorithm. The load of an edge is defined as the number of basis cycles it has appeared in so far, while the load of a vertex is the average load of its incident edges. To better reflect structural changes, we further define how load evolves during transformations: in Case 2A (where a new edge is inserted between two neighbors of a removed vertex), the load of the new edge is set to the maximum of the loads of the two removed edges. In Case 2B (where the connecting edge already exists), we increment the load of that existing edge by one. Among the variants we tested, the following heuristic performed best empirically on random regular graphs:
-
initialize each BFS from the vertex with the highest load;
-
select the first cross edge that forms a cycle containing the BFS root;
-
remove the highest-load edge from the resulting cycle.
In Section 2 we give an overview of how the cycle basis problem arises in quantum fault tolerance. In Section 3, we present experimental results on random regular graphs to compare several of our best-performing heuristics. Section 4 applies our algorithm to graphs derived from small quantum LDPC codes, demonstrating its practical relevance. The implementation and experimental scripts are available as additional material [31]. Finally, in Section 5, we define a random process based on a balls-and-bins model to analyze and minimize the maximum load on a bin. This process serves as a proxy for the cycle basis problem on a random graph, capturing the distribution of load on edges under the simplifying assumption that cycles are random sets of edges. The edges chosen in a cycle is modeled by a random set of edges. The goal is to capture the best analysis that can be achieved without understanding the more complex distribution of edges chosen when cycles are selected in a real graph. Our analysis suggests that the maximum load of all of our heuristics will be .
2 Motivation from Quantum Fault Tolerance
Due to the fragile nature of quantum systems, quantum error correction (QEC) is an important challenge for building quantum computers capable of practical applications. QEC protects quantum information from environmental noise by redundantly encoding it using a quantum error-correcting code (QECC). In recent years, a particular class of QECCs known as quantum low-density parity-check (QLDPC) codes [10] has attracted significant attention for their potential to reduce the overhead associated with encoding and logical operations. A parity check is a measurement which measures whether an error has occurred. Low-density parity checks, which only operate on a constant number of qubits, are easier to implement in a fault-tolerant way. Recent works [24, 5, 25, 19] have proposed constructions of good QLDPC codes – those with constant rate and linear distance.
However, a major challenge remains: how to perform logical gates fault-tolerantly on information encoded using these codes. A technique known as lattice surgery was originally developed for implementing logical gates on surface codes [14], and has since been generalized to broader classes of QLDPC codes [6, 7, 32, 13]. The core goal of lattice surgery is to enable fault-tolerant measurements of logical operators, which in turn allows the implementation of an almost universal gate set – the Clifford group. This set, when supplemented by magic state distillation [4], yields a universal gate set for quantum computation [20].
Every QLDPC code has a Tanner graph representation, where physical qubits and checks are nodes, and edges indicate which checks act on which qubits. We define the weight of a check to be the number of physical qubits it touches, and the degree of a qubit to be the number of checks connected to it.
Without loss of generality, we focus on CSS codes, which involve only two types of checks: -checks and -checks. (In general, a check can involve both and operators.) These two types of checks correspond to the two common types of errors in quantum systems: -errors (bit-flip errors) and -errors (phase-flip errors). For CSS codes, the Tanner graph is a tripartite graph – one part for qubits, one for -checks, and one for -checks – analogous to the bipartite structure in classical LDPC codes.
Correspondingly, there are two types of logical measurements: Pauli measurements and Pauli measurements. In this discussion, we focus on Pauli measurements; the procedure for Pauli measurements is analogous. A Pauli measurement can be viewed as a measurement on a subset of physical qubits. However, such measurements often have high weight, meaning they involve many physical qubits. Performing high-weight measurements directly is challenging in a fault-tolerant manner.
The goal of lattice surgery is to decompose such high-weight measurements into a sequence of lower-weight, fault-tolerant measurements. The basic idea is to introduce an ancillary system (which can also be thought of as another QLDPC code) that is coupled to the original code on which we wish to perform the measurement. By measuring all the -checks in the ancilla system, one can effectively obtain the outcome of the desired high-weight Pauli measurement.
There have been several approaches for constructing the ancilla system [6, 7, 32]. These constructions share a common starting point: they begin with the Tanner graph and focus on the induced subgraph of the support (i.e., the set of qubits involved in the Pauli measurement.) The cycle basis problem comes out of the Williamson et. al. construction. Although the details of the construction are beyond what we can cover here, the result of the construction is a new graph based on the induced subgraph of the Tanner graph in which edges represent physical qubits, vertices correspond to -checks, and -checks are defined via a cycle basis of the graph , which together define the ancilla system.
Each basis cycle corresponds to a -check in the ancilla system, and its length determines the weight of that check. Long cycles lead to high-weight checks, which can violate the LDPC property of the original code. However, there is a straightforward method to resolve this: cellulation – the process of subdividing long cycles into multiple short cycles by adding auxiliary edges, thereby restoring LDPC properties.
In contrast, maximum edge participation corresponds to the maximum qubit degree in the ancilla system – that is, the number of -checks attached to a given qubit. High qubit degrees can violate the LDPC property of the code, and unlike the case of high-weight checks, there is no comparably low-cost fix such as cellulation. The overhead of the construction is then dominated by the cost of reducing the maximum edge participation.
3 Experimental Comparison of Different Heuristics on Random Regular Graphs
In this section, we present five different variants of the original Freedman–Hastings algorithm by varying the three key design choices listed in Table 1. We will refer to the Freedman–Hastings algorithm as Version .
| Variant Name | BFS Root Selection | Cross Edge Selection | Edge Removal Strategy |
|---|---|---|---|
| Version 0 | Random vertex | First encountered | Random edge |
| Version 1 | Random vertex | First encountered | Max-load edge |
| Version 2 | Max-load vertex | First encountered | Max-load edge |
| Version 3 | Max-load vertex | First forming cycle with root | Max-load edge (prefer incident to root) |
| Version 4 | Max-load vertex | First forming cycle with root | Load-weighted probabilistic removal |
| Version 5 | Each vertex | Shortest cycle over all roots | Max-loaded edge |
The only difference between Version 1 and Version 0 is the edge removal strategy: while Version 0 removes a random edge from the selected cycle, Version 1 removes the edge with the highest load (breaking ties randomly). This strategy helps reduce long-term edge congestion by preferentially eliminating the most heavily used edges early in the recursion.
The difference between Version 2 and Version 1 lies in the BFS root selection. While Version 1 selects the BFS root randomly, Version 2 always starts from the vertex with the highest load. Although this factor may seem less impactful than edge removal, empirical results show that prioritizing the max-load vertex leads to better performance. Intuitively, a high-load vertex is likely incident to multiple heavily loaded edges. By starting BFS from such a vertex, the resulting cycle has a higher chance of containing one of these high-load edges, which can then be removed using the same greedy strategy.
Version 3 improves upon Version 2 by refining both the cross edge selection and edge removal strategies. Instead of selecting the first encountered cross edge during BFS, we restrict the choice to those that yield a cycle containing the BFS root. This ensures that the starting vertex – which is chosen based on maximum load – remains in the cycle, increasing the chance of targeting heavily used edges.
Additionally, when multiple edges in the cycle have the same maximum load, we prioritize removing an edge that is incident to the BFS root. This tie-breaking rule is particularly effective in the later stages of the algorithm when the graph becomes sparse. For instance, in a 3-regular graph, removing one edge via a short cycle (as in Case 3) typically creates two degree-two vertices – the endpoints of the removed edge – which will each trigger additional reductions via Case 2; see Figure 2 for an illustrative example. If the BFS root lies on the cycle and has high load, this refinement increases the likelihood of further removing overloaded edges connected to it, thus improving overall balance in the cycle basis.
Version 4 introduces a probabilistic edge removal strategy. Instead of deterministically removing the highest-load edge, we remove edge from the selected cycle with probability where denotes the load of edge . This softmax-style weighting introduces randomness into the algorithm, which may help avoid worst-case scenarios that can trap greedy variants. However, empirical results suggest that Version 4 does not outperform Version 3 on average.
Finally, Version 5 is a significantly more expensive algorithm. It selects the cycle of minimum length and then removes the maximum-load edge from that cycle. To identify the shortest cycle, the algorithm performs a BFS from each vertex as the root, searches for a cycle containing that root, and then takes the shortest cycle among all roots. Owing to its high computational cost, we evaluate Version 5 only in the next section, where the graphs – arising from small quantum codes – are relatively small.
We evaluate the variants (Versions 0–4) on random regular graphs, which are known to be asymptotically close to Ramanujan graphs – optimal spectral expanders – according to the result of Friedman [9]. This motivates our choice, as most random d-regular graphs are constant-degree expanders, resembling the structure of graphs that arise in real quantum LDPC codes.
To generate these graphs, we use Python’s NetworkX package, which internally implements the configuration model of Steger and Wormald [30]. Specifically, we test our heuristics on random 3-regular and 8-regular graphs across a range of sizes. We chose these graphs to roughly mimic the structure of near-term quantum codes, which typically do not exhibit very high connectivity, check weight, or qubit degree. For each graph size, we generate a number of random instances (as detailed in Table 2) and apply all five algorithmic variants.
| Degree / Graph size | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384 |
|---|---|---|---|---|---|---|---|---|---|---|
| 1600 | 1600 | 1600 | 1600 | 1600 | 800 | 400 | 200 | 100 | 50 | |
| 1600 | 1600 | 1600 | 1600 | 1600 | 800 | 400 | 200 | 100 | – |
Note: No experiments were conducted for at due to runtime constraints. Completing all trials required approximately 42 hours.
Implementation details.
A naïve recursive implementation would repeatedly scan all vertices to identify degree– or degree– vertices and to select a start vertex for cycle search, incurring work per recursion step. Since each step removes or contracts only a constant number of vertices or edges, this leads to an overall overhead even before accounting for the cost of cycle searches.
To avoid this inefficiency, we maintain two queues containing vertices that may currently have degree or . After each local modification of the graph, only the affected neighboring vertices are re-checked and (if applicable) enqueued. Queue entries may become stale, meaning that they no longer reflect the current graph state (e.g., the vertex has already been removed or its degree has changed); such entries are detected and discarded upon extraction. This approach yields amortized work per update for degree tracking.
To guide cycle selection, we additionally maintain a priority queue over vertices keyed by their current load. Whenever a vertex’s load changes, a new entry is inserted into the heap, and outdated entries are discarded lazily when extracting the maximum-load vertex. Each load update therefore incurs amortized overhead. As a result, all global scans over vertices are eliminated, and the overhead outside the BFS-based cycle search is reduced from per recursion step to amortized (since each recursion may trigger load updates), which is essential for scalability to large graphs.
Running time analysis.
All variants (Versions 1–4) have the same worst-case asymptotic running time as the original Version 0 (the Freedman–Hastings algorithm). Each recursive step removes at least one edge and may invoke a breadth-first search (BFS) to identify a cycle, which takes time in the worst case. Since at most such steps can occur over the entire recursion, the overall worst-case running time remains (equivalently, for constant-degree graphs).
Our implementations primarily reduce constant factors by eliminating repeated global scans over all vertices. In particular, degree– and degree– vertices are maintained using queues, while candidate start vertices for cycle search are selected via a priority queue keyed by vertex load. As a result, degree updates and load updates incur only local or amortized work per recursion step, rather than -time global scans. Although these optimizations do not improve the worst-case asymptotic bound, they substantially reduce the overhead outside of the BFS-based cycle search and are crucial for scaling the algorithms to larger graphs in practice.
As graph sizes grow exponentially as in Table 2, we correspondingly reduce the number of trials for larger instances to keep the total computation time manageable. All experiments were performed on a desktop workstation (Intel® CoreTM i7–14700F CPU, 16 GB RAM, 64-bit Windows 11), and completing all trials required approximately 42 hours.
Results and Visualization.
We collectively visualize the results across all graph sizes and degrees using the boxplot from multiple trials, as shown in Figure 3. Empirically, all of our algorithmic variants demonstrate significant improvement over the original Freedman–Hastings algorithm, suggesting that the max-load edge removal strategy is the primary factor driving these performance gains.
Among the variants, Version 3 consistently achieves the lowest maximum edge participation on average, followed by Version 2, then Version 4, and finally Version 1. This ordering confirms that both the BFS root selection and cross edge selection strategies contribute meaningfully to reducing edge congestion – beyond the effect of edge removal alone.
To further understand the asymptotic behavior of the different algorithmic variants, we plot in Figure 4 the ratio between the actual median maximum edge participation and fitted functions of the form and , where the coefficient is independently optimized for each curve. This normalization removes the leading-order growth rate and highlights the deviation from ideal logarithmic or polylogarithmic scaling.
We include results for Version 0 and Version 3 of the algorithm across both degree-3 and degree-8 random regular graphs. All curves use solid lines, with different marker shapes distinguishing the vertex degree. In the left plot, we observe that the ratios for both Version 0 and Version 3 trend upward, indicating super-logarithmic scaling for both versions. In contrast, the right plot shows that the ratios for Version 0 remain relatively flat, whereas those for Version 3 initially decrease but eventually level off. This suggests that Version 3 offers only a constant-factor improvement in scaling relative to Version 0, rather than a fundamentally different asymptotic behavior. This observation is also consistent with the lower bound established for the balls-into-bins proxy in Section 5.
4 Experiment on Graphs from Small Quantum Codes
In this section, we evaluate our algorithms on graphs arising from practical quantum codes. Here we consider two different families of codes: quantum radial codes [29] and quantum Tanner Codes [19, 26].
Quantum radial codes were introduced by Scruby et al. [29], which are based on the lifted product construction [24] applied to certain quasi-cyclic classical codes. The lifted product is one of the first constructions known to yield good quantum LDPC codes, and it is also effective for generating near-term deployable codes. Quantum radial codes exhibit promising features for fault-tolerant quantum computing. In particular, they offer comparable error suppression to surface codes while requiring roughly five times fewer physical qubits. Moreover, they have been observed to support single-shot decoding [2], making them strong candidates for near-term implementations.
Quantum Tanner codes were introduced by Leverrier and Zémor [19] as another construction of asymptotically good quantum LDPC codes. Building on this framework, Radebold, Bartlett, and Doherty presented explicit instances of quantum Tanner codes based on dihedral groups and pairs of classical component codes [26]. Numerical simulations show that these explicit codes achieve logical error rates comparable to surface codes of similar distance under both phenomenological and circuit-level noise models, highlighting their potential for fault-tolerant quantum error correction.
4.1 Experiments for Graphs from Quantum Radial Codes
We test our algorithm on graphs arising from two specific quantum radial codes presented in [29]: a code and a code. Here, a code refers to a quantum code with physical qubits, logical qubits, and code distance . These codes have parameters comparable to those of the Gross code and the Double Gross code [3], but have received relatively less attention in the literature. In [29], the authors provide a canonical basis for all Pauli- and Pauli- logical operators. In our experiments, we focus on the Pauli- basis (note that the procedure for Pauli- measurements would be essentially identical). Following the logical operator measurement construction in [32], we extract, for each Pauli- basis operator, an induced subgraph from the Tanner graph representation of the code. Specifically, each intersecting -check becomes an edge in the induced graph; in the two quantum radial codes we study, every -check intersects each logical operator on exactly two qubits, so this conversion is unambiguous.
For the code, this yields 8 graphs (one for each logical operator), and for the code, we obtain 18 graphs. In general, to ensure distance preservation during lattice surgery, one may need to augment these graphs with additional edges to boost their Cheeger constants to at least 1, as this is a sufficient (but not necessary) condition for maintaining code distance. However, in our case, we observe that for the smaller code, all 8 graphs already have Cheeger constant exactly 1. For the larger code, 12 out of the 18 graphs have Cheeger constant , 3 have approximately 0.91, and the remaining 3 have values near 0.73. Given these relatively high expansion properties, we directly test our algorithms on these induced subgraphs without further augmentation, expecting the results to closely reflect those obtained in a full lattice surgery simulation.
The algorithms we test include Version 0 (the original Freedman–Hastings algorithm), Version 3 (our best-performing heuristic on random regular graphs), Version 5 (the variant that always selects the shortest cycle at each recursion), and min-basis (a minimum-weight cycle basis algorithm [17]). We include Version 5 and the minimum-weight cycle basis because, in the context of lattice surgery, shorter basis cycles may reduce overhead, even though maximum edge participation is typically the dominant cost.
We first focus on the induced graphs arising from the larger code. These graphs each have 22 vertices and are 4-regular; two representative examples are shown in Figure 6. The corresponding performance comparison is presented in Figure 6. For each such graph, we evaluate each algorithm over 200 independent runs and report the median maximum edge participation.
As shown in Figure 6, Version 3 consistently achieves the best performance on these graphs, yielding roughly a one-third reduction in maximum edge participation compared to Version 0. The min-basis algorithm can occasionally match the performance of Version 3, but also exhibits substantial variability and can produce the worst outcomes, which is expected since it optimizes cycle length rather than edge participation. Version 5 most often matches the performance of Version 3 and consistently improves over Version 0, although on some instances it is slightly worse than Version 3.
We briefly comment on the induced graphs arising from the smaller code. These graphs have 10 vertices – comparable to the code distance – and are 3-regular. Representative examples and the corresponding performance plots are included in the additional material [31]. For these smaller graphs, each algorithm is run 100 times per graph. The observed performance differences among the algorithms are relatively minor, reflecting the limited graph size and degree.
4.2 Experiments for Graphs from Quantum Tanner Codes
Similar to the case of quantum radial codes, we evaluate our algorithms on graphs arising from two quantum Tanner codes introduced in [26]: a code and a code. Unlike the previous setting, the graphs induced by these Tanner codes are generally irregular and span a wider range of sizes. For the code, the 14 induced graphs have sizes ranging from 8 to 14 vertices, with maximum degrees between 2 and 4. For the code, the 10 induced graphs have sizes ranging from 20 to 55 vertices, with maximum degrees between 5 and 7.
The experimental results for the larger Tanner code are deferred to Appendix B. In particular, the performance results are shown in Figure 10, with two representative induced subgraphs illustrated in Figure 10. The corresponding performance results for the smaller Tanner code, together with representative induced subgraphs, are provided in the additional material [31]. For each graph of the larger (respectively, smaller) code, we run each algorithm 200 (respectively, 100) times and report the median maximum edge participation.
Overall, the results are consistent with those observed for random regular graphs and graphs derived from quantum radial codes. In particular, Version 3 continues to perform robustly across all tested instances, typically achieving the lowest or near-lowest maximum edge participation. Version 5 often matches the performance of Version 3 but occasionally performs slightly worse, while incurring a higher computational cost due to its exhaustive shortest-cycle search. The min-basis algorithm again exhibits substantial variability: although it can sometimes achieve competitive performance, it can also produce the worst outcomes, reflecting its optimization for cycle length rather than edge participation.
These experiments demonstrate that our load-aware heuristics – and Version 3 in particular – remain effective even for irregular graphs with heterogeneous degree distributions and sizes, indicating that their benefits extend beyond the regular graph families considered earlier.
5 A balls-into-bins model as a proxy
We consider a balls-into-bins model as a proxy for the behavior of our algorithms on 3-regular graphs. In this model, each bin corresponds to an edge in the graph, and each selected cycle is a subset of bins. The load on each edge is represented by placing a ball in each of the selected bins. Then three bins are removed, representing the edges that are removed from the graph. Note that when the graph is exactly -regular, each iteration of Case (followed by two applications of Case 2A) decreases the total number of edges by three, as illustrated in Figure 2. Indeed, the local transformation removes five existing edges and inserts two new edges, so the net change in the number of edges is .
Process 1
Process 2
The goal of the model is to understand the extent to which we can analyze the asymptotic behavior of our best variant without using detailed graph-theoretic properties. As discussed above, one iteration consisting of Case 3 followed by two applications of Case 2A can potentially remove up to three heavily loaded edges from the graph. In the balls-to-bins model, we model the selection of a cycle as selecting the three most heavily loaded edges/bins, and the rest of the bins are selected at random. Then the three most heavily loaded bins are removed from the system, representing the removal of those edges from the graph. This model is favorable to the algorithm by allowing the algorithm to select and remove the three most heavily loaded bins in the entire system. In a real graph, the three most heavily loaded edges might not even be located on a single short cycle. The selection of the rest of the edges is simplified to be a random set. Intuitively, getting a better analysis for the behavior of our cycle basis algorithms will require a more sophisticated understanding of the distribution of the edges participating in each selected cycle.
There are a few other ways in which our proxy process differs from cycle basis selection in a real graph. The proxy process assumes that the cycle selected will have length exactly in each round. The versions which select the cycle arising from the first cross edge encountered may yield shorter cycles, resulting in less load on the edges. To better justify this choice, we provide an analysis of the cycle length produced during a BFS exploration of a random regular graph. In particular, we show that with constant probability, the exploration remains tree-like up to depth , and the first back edge creates a cycle of length . The detailed proof is deferred to Appendix E. Thus, without a more refined model for how the graph evolves over time, we cannot exploit the possibility of shorter selected cycles to obtain sharper bounds on the performance of our heuristics. The proxy process also does not capture vertex removals from Cases and . However, our numerical results suggest that these are relatively infrequent events and therefore do not contribute significantly to edge load as shown in Appendix A.
The balls-and-bins process is called Process 1 and is given in Algorithm 1. However, Process 1 remains analytically challenging. To facilitate analysis, we define a further simplification, which still preserves the essential features needed for bounding load growth. In the simplified process, we define an epoch as a sequence of iterations in which the number of buckets decreases by a factor of . During each iteration within an epoch, we add a ball to each of randomly chosen bins and decrease , the counter for the number of buckets, by . However, the buckets are not actually removed until the end of an epoch, at which point a new epoch begins. The delayed-removal process is called Process 2 and is given in Algorithm 1.
This delayed-deletion model allows additional load to accumulate before pruning. As a result, more balls are discarded during each epoch compared to Process 1. Therefore, any lower bound established for Process 2 also applies to Process 1, and thus to the original algorithm. In Appendix D, we provide a formal proof that Process 2 lower-bounds Process 1 if we select buckets instead of buckets in Process 2; note that this modification does not affect the asymptotic lower bound for Process 2 discussed below.
In what follows, we prove the following theorem, which provides a lower bound on the maximum load in Process 2. All logarithms are base , unless stated otherwise.
Theorem 1.
For any fixed , process 2 satisfies
Explicitly,
Before proving the theorem, we prove several lemmas. Define , , and . During epoch , we begin with buckets and perform ball tossing for rounds. In each round, we toss balls into distinct buckets chosen uniformly at random without replacement. No deletions occur during the rounds.
Consider a particular an epoch j. The probability that a fixed bucket is chosen during a single round in epoch is . The incremental load placed on any bucket during epoch is
Fix a constant and call a bucket bad in epoch if the incremental load satisfies During epoch let be the number of bad buckets. We state the following two lemmas, whose proofs are provided in Appendix C.
Lemma 2 (Few bad buckets in one epoch).
Fix and set . During epoch , let be the number of buckets whose incremental load is at most . Then
Lemma 3 (Few bad buckets over epochs).
Fix and define . Let . Then with probability , the total number of buckets that are bad in any of the first epochs is at most
We are now ready to prove Theorem 1. The basic idea is that for the chosen value of (which is ), with high probability the number of buckets that have ever gone bad in rounds is less than the total number of buckets remaining. Thus, with high probability, there will be a bucket remaining which was never bad in the first rounds. A bucket with this property received incremental load in each of the rounds, resulting in a bucket with total load . For a complete proof of Theorem 1 check Appendix C.
References
- [1] John Anthony Banks and Edward F Schmeichel. The basis number of the n-cube. Journal of Combinatorial Theory, Series B, 33(2):95–100, 1982.
- [2] Héctor Bombín. Single-shot fault-tolerant quantum error correction. Physical Review X, 5(3):031043, 2015.
- [3] Sergey Bravyi, Andrew W Cross, Jay M Gambetta, Dmitri Maslov, Patrick Rall, and Theodore J Yoder. High-threshold and low-overhead fault-tolerant quantum memory. Nature, 627(8005):778–782, 2024. doi:10.1038/S41586-024-07107-7.
- [4] Sergey Bravyi and Alexei Kitaev. Universal quantum computation with ideal clifford gates and noisy ancillas. Physical Review A—Atomic, Molecular, and Optical Physics, 71(2):022316, 2005.
- [5] Nikolas P Breuckmann and Jens N Eberhardt. Balanced product quantum codes. IEEE Transactions on Information Theory, 67(10):6653–6674, 2021. doi:10.1109/TIT.2021.3097347.
- [6] Lawrence Z Cohen, Isaac H Kim, Stephen D Bartlett, and Benjamin J Brown. Low-overhead fault-tolerant quantum computing using long-range connectivity. Science Advances, 8(20):eabn1717, 2022.
- [7] Andrew Cross, Zhiyang He, Patrick Rall, and Theodore Yoder. Linear-size ancilla systems for logical measurements in qldpc codes. arXiv e-prints, pages arXiv–2407, 2024.
- [8] Michael Freedman and Matthew Hastings. Building manifolds from quantum codes. Geometric and Functional Analysis, 31(4):855–894, 2021.
- [9] Joel Friedman. A proof of alon’s second eigenvalue conjecture. In Proceedings of the thirty-fifth annual ACM symposium on Theory of computing, pages 720–724, 2003. doi:10.1145/780542.780646.
- [10] Daniel Gottesman. Fault-tolerant quantum computation with constant overhead. arXiv preprint, 2013. arXiv:1310.2984.
- [11] Jonathan L Gross, Jay Yellen, and Mark Anderson. Graph theory and its applications. Chapman and Hall/CRC, 2018.
- [12] Matthew B Hastings. On quantum weight reduction. arXiv preprint, 2021. arXiv:2102.10030.
- [13] Zhiyang He, Alexander Cowtan, Dominic J Williamson, and Theodore J Yoder. Extractors: Qldpc architectures for efficient pauli-based computation. arXiv preprint, 2025. arXiv:2503.10390.
- [14] Dominic Horsman, Austin G Fowler, Simon Devitt, and Rodney Van Meter. Surface code quantum computing by lattice surgery. New Journal of Physics, 14(12):123011, 2012.
- [15] Joseph Douglas Horton. A polynomial-time algorithm to find the shortest cycle basis of a graph. SIAM Journal on Computing, 16(2):358–366, 1987. doi:10.1137/0216026.
- [16] Telikepalli Kavitha, Christian Liebchen, Kurt Mehlhorn, Dimitrios Michail, Romeo Rizzi, Torsten Ueckerdt, and Katharina A Zweig. Cycle bases in graphs characterization, algorithms, complexity, and applications. Computer Science Review, 3(4):199–243, 2009. doi:10.1016/J.COSREV.2009.08.001.
- [17] Telikepalli Kavitha, Kurt Mehlhorn, Dimitrios Michail, and Katarzyna E Paluch. An algorithm for minimum cycle basis of graphs. Algorithmica, 52(3):333–349, 2008.
- [18] Florian Lehner and Babak Miraftab. Basis number of bounded genus graphs. arXiv preprint, 2024. arXiv:2410.10566, doi:10.48550/arXiv.2410.10566.
- [19] Anthony Leverrier and Gilles Zémor. Quantum tanner codes. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 872–883. IEEE, 2022. doi:10.1109/FOCS54457.2022.00117.
- [20] Daniel Litinski. A game of surface codes: Large-scale quantum computing with lattice surgery. Quantum, 3:128, 2019. doi:10.22331/Q-2019-03-05-128.
- [21] Alexander Lubotzky, Ralph Phillips, and Peter Sarnak. Ramanujan graphs. Combinatorica, 8(3):261–277, 1988. doi:10.1007/BF02126799.
- [22] Saunders Mac Lane. A combinatorial condition for planar graphs. Seminarium Matemat., 1936.
- [23] Martin Milgram and Peter Ungar. Bounds for the genus of graphs with given betti number. Journal of Combinatorial Theory, Series B, 23(2-3):227–233, 1977. doi:10.1016/0095-8956(77)90033-8.
- [24] Pavel Panteleev and Gleb Kalachev. Quantum ldpc codes with almost linear minimum distance. IEEE Transactions on Information Theory, 68(1):213–229, 2021. doi:10.1109/TIT.2021.3119384.
- [25] Pavel Panteleev and Gleb Kalachev. Asymptotically good quantum and locally testable classical ldpc codes. In Proceedings of the 54th annual ACM SIGACT symposium on theory of computing, pages 375–388, 2022. doi:10.1145/3519935.3520017.
- [26] Rebecca Katharina Radebold, Stephen D Bartlett, and Andrew C Doherty. Explicit instances of quantum tanner codes. arXiv preprint, 2025. arXiv:2508.05095.
- [27] Romeo Rizzi. Minimum weakly fundamental cycle bases are hard to find. Algorithmica, 53(3):402–424, 2009. doi:10.1007/S00453-007-9112-8.
- [28] Edward F Schmeichel. The basis number of a graph. Journal of Combinatorial Theory, Series B, 30(2):123–129, 1981. doi:10.1016/0095-8956(81)90057-5.
- [29] Thomas R Scruby, Timo Hillmann, and Joschka Roffe. High-threshold, low-overhead and single-shot decodable fault-tolerant quantum memory. arXiv preprint, 2024. arXiv:2406.14445.
- [30] Angelika Steger and Nicholas C Wormald. Generating random regular graphs quickly. Combinatorics, Probability and Computing, 8(4):377–396, 1999. URL: http://journals.cambridge.org/action/displayAbstract?aid=46711.
- [31] Fan Wang. Cycle basis algorithms public repository. https://github.com/FanWang000/Cycle_basis_algorithms_public, 2026. Implementation and experimental scripts.
- [32] Dominic J Williamson and Theodore J Yoder. Low-overhead fault-tolerant quantum computation by gauging logical operators. arXiv preprint, 2024. arXiv:2410.02213.
- [33] Nicholas C Wormald et al. Models of random regular graphs. London mathematical society lecture note series, pages 239–298, 1999.
Appendix A The Frequency of Each Case in Version 3
We ran Version 3 on 25 random 3-regular graphs of size 8192 and 25 random 8-regular graphs of size 4096, and computed the average percentage of each case across the different graphs. The results show that Case 1 and Case 2B occur relatively infrequently compared to Case 2A and Case 3. As expected, when the graphs become denser, Case 3 becomes dominant.
Appendix B Experimental Results for Graphs from Quantum Codes
Appendix C Proofs
Proof of Lemma 2.
For a single bucket, the multiplicative Chernoff lower tail bound
with gives: Since , we have:
Let be the indicator that bucket is bad. Then is a sum of Bernoulli variables with . Hence, Now apply Markov’s inequality:
Proof of Lemma 3.
We first bound the total failure probability over all epochs. Since we have From Lemma 2, the probability that epoch has more than bad buckets is at most . Thus, the union bound gives:
Since , we have
As , this product is , so with high probability all epochs satisfy the per-epoch bound.
Conditioned on this event, we now sum the bad buckets over all epochs:
This geometric sum is bounded by
Hence the total number of bad buckets is at most
Proof of Theorem 1.
Since each deleted bucket has a unique ancestor among the original buckets, Lemma 3 bounds how many buckets ever go bad. Provided that , which holds for every , we have and hence for sufficiently large , forcing the existence of at least one bucket that is never bad in any epoch .
For such a never-bad bucket, its load in epoch satisfies using the lower bound from earlier.
Summing over epochs, we obtain a lower bound on the total load on that bucket:
where we use that and that is decreasing in , so each term is at least the last one.
Substituting the bounds , we control both terms in the product:
Thus, completing the proof of Theorem 1.
Appendix D Process 1 Results in Higher Remaining Loads than Process 2
We define three new processes, , , and , where is essentially equivalent to Process 1 from the main text (as we are only interested in the loads of the remaining bins), and is a slight variant of Process 2 in which only balls are thrown per round instead of . The intermediate process serves as a bridge to enable a direct, step-by-step comparison between and .
Theorem 4 (Pointwise comparison of P1, P1a, and P2).
Let with , and let be any initial load vector. Run rounds of the following processes:
- P1:
-
At the start of each round, delete the three heaviest bins, then throw balls uniformly into the remaining bins.
- P1a:
-
In each round, mark the three heaviest bins, then throw balls uniformly into all bins. After round , delete all marked bins.
- P2:
-
In each round, throw balls uniformly into all bins. After round , delete the heaviest bins.
For a random outcome of the bin-selection randomness (i.e., the sequence of random bin selections in all rounds), let denote the vector of surviving bin loads after deletion, sorted in non-increasing order. Then, for every ,
Proof.
We couple all three processes (P1, P1a, and P2) using the same randomness. For each round , we sample bins uniformly at random without replacement from , and record the selected labels as . These selections are fixed and reused across all processes.
Comparison of P1a and P2.
Since no bins are removed during the rounds of P1a or P2, both processes place balls identically in every round using the same selections . Thus, before the final deletion step, P1a and P2 produce the same load vector. Process P2 deletes the bins with largest loads, which deterministically minimizes the remaining sorted load vector among all choices of bins. Therefore,
Comparison of P1 and P1a.
In P1, the three heaviest bins are deleted at the start of each round. Let be the number of remaining bins in round . After this deletion, we relabel the remaining bins by sorting them in non-increasing order of their current loads and indexing them as .
For each label :
-
If , then the corresponding bin exists in both P1 and P1a during round , and the ball is placed into the same bin in both processes.
-
If , then under the current relabeling this label corresponds to a bin that has already been deleted in P1 by round . In P1, the ball is redirected to a bin chosen uniformly from , while in P1a the ball is placed into the original bin.
Thus, whenever a redirection occurs in P1, a ball that would have gone to a bin deleted in that round (under P1a) is instead placed into a bin that survives the round. Consequently, the load of every bin surviving P1 is at least as large as the load of the corresponding surviving bin in P1a. Since both processes delete exactly bins in total, after sorting we obtain
Conclusion.
Combining the two comparisons yields
as claimed.
Appendix E BFS Results in Cycles with Logarithmic Length
We consider generating a random -regular graph using the configuration model [33]. Consider the multi-set consisting of copies of each . Edges are created by pairing items and in the ordering for . If there are any multi-edges or self-loops, then the graph is discarded and the process repeats. is defined to be the probability that the process succeed in producing a simple graph. It was proven in [1], that as gets large, converges to a constant that depends only on and is independent of .
In the proof below, we imagine generating the permutation and revealing the edges in the graph by exploring a BFS starting at vertex until the first time a back edge, self-loop, or multi-edge is found. If the graph discovered so far is a simple tree, then BFS continues from some vertex , be searching for the undiscovered occurrences of in the permutation and examining the neighbors of . The unrevealed items in the permutation are referred to as unmatched half-edges. If a back-edge is found before a self-loop or multi-edge, then the the rest of the graph is revealed to determine if the resulting graph is simple.
Theorem 5 (Logarithmic cycle from BFS with constant probability).
Fix . Consider the process described above to generate a -regular random graph . Then there exists a constant such that, for all sufficiently large , with probability at least the process produces a simple graph and the first back edge encountered creates a cycle of length .
Proof.
We say that the BFS aborts when a back edge, self-loop, or multi-edge is found. We imaging running BFS in a series of iterations until it aborts. Before the first iteration, the BFS tree consists only of the single vertex . In each iteration, a leaf with the smallest depth is chosen, and all of its remaining neighbors are explored. Let be the event that the BFS exploration aborts during or before iteration , and define the conditional abort probability
After successful iterations, the BFS tree contains
vertices and exposed edges. Let be the set of remaining half-edges. Then:
Fix . For all , we have and thus .
Condition on the explored BFS tree after iterations. The remaining edges are distributed as a uniformly random perfect matching on . Let be the leaf explored at iteration .
Back edges / self-loops.
For a fixed remaining half-edge of , the probability that it is paired to a half-edge incident to one of the currently discovered vertices is at most . By a union bound over the half-edges of , the probability of creating a back edge or self-loop is .
Multi-edges.
A multi-edge incident to occurs if two of the half-edges of are paired to half-edges of the same vertex. There are such pairs. Fix one pair. Conditioned on the partner chosen for the first half-edge, the second hits the same vertex with probability at most (uniformly for since ). Thus the probability of a multi-edge incident to is .
Combining the failure modes,
Since is defined conditionally,
Summing the bound using gives
Therefore the exploration does not abort in the first iterations with probability , and hence the probability of the event
is at least , which is bounded below by a positive constant depending only on .
Conditioned on the BFS exploration remaining tree-like up to time , the first back edge is incident to a uniformly random leaf of the BFS tree. Since the tree has leaves at depth , spread across the root-subtrees, with constant probability the back edge connects two leaves whose least common ancestor is the root, thereby creating a cycle of length . Combining with the constant lower bound on reaching without abort proves the theorem.
