Graph-theoretical optimization of fusion-based graph state generation

Graph states are versatile resources for various quantum information processing tasks, including measurement-based quantum computing and quantum repeaters. Although the type-II fusion gate enables all-optical generation of graph states by combining small graph states, its non-deterministic nature hinders the efficient generation of large graph states. In this work, we present a graph-theoretical strategy to effectively optimize fusion-based generation of any given graph state, along with a Python package OptGraphState. Our strategy comprises three stages: simplifying the target graph state, building a fusion network, and determining the order of fusions. Utilizing this proposed method, we evaluate the resource overheads of random graphs and various well-known graphs. Additionally, we investigate the success probability of graph state generation given a restricted number of available resource states. We expect that our strategy and software will assist researchers in developing and assessing experimentally viable schemes that use photonic graph states.

ogy [15].Photonic qubit-based graph states are particularly crucial in these applications, not only because photons are predominantly used in quantum communication but also because MBQC can circumvent the need for in-line near-deterministic multi-qubit gates that are challenging in photonic systems [16].
All-optical methods for constructing photonic graph states are commonly processed by merging multiple smaller graph states into a larger one using fusion operations of types I and/or II [17].The failures of these operations are heralded, presenting a significant advantage [18] over alternative methods such as the post-selected controlled-Z (cz) gate [19,20] and the post-selected fusion gate [17].Among the two fusion types, we focus exclusively on type II.This is because, assuming photodetectors with negligible dark counts, a type-I fusion could potentially transform a photon loss into an undetectable computational error [21], whereas any photon loss occurring before or during a type-II fusion can be identified.
The non-deterministic nature of fusions is a crucial consideration when investigating quantum tasks using photonic graph states.When employing dual-rail-encoded qubits (such as polarization qubits) and restricting the setup to linear-optical devices and photodetectors, the success probability of a type-II fusion is limited to 50% without ancillary resources [22].Higher success probabilities can be achieved by utilizing ancillary photons [23,24], encoded qubits [25,26], redundant graph structures [27,28,21], or continuous-variable techniques [29,30,31,32,33,34].Through these methods, fault-tolerant linear-optical MBQC is theoretically possible.For instance, our recent research verified that high photon loss thresholds of around 8% under a uniform photon loss model can be attained by employing parity-encoded multiphoton qubits [35].
Despite these advancements, resource overhead remains a significant challenge for generating large-scale graph states.Specifically, the number of required basic resource states (such as threephoton Greenberger-Horne-Zeilinger states) or optical elements like photodetectors increases exponentially as the number of fusions grows.Consequently, it is essential to carefully design a procedure for generating a desired graph state from basic resource states to minimize resource overhead as much as possible.While several prior studies [36,37] have addressed this issue, they only considered specific graph families and type-I fusion.In our previous work [35], we proposed a partial solution for general graphs and type-II fusion using a fine-tuning strategy; however, there is still considerable scope for improvement.
In this work, we introduce a graph-theoretical strategy to effectively identify a resource-efficient method for fusion-based generation of any given graph state, building upon and generalizing the strategies presented in Ref. [35].A single trial of our strategy comprises three main stages: (i) simplifying the graph state through the process of unraveling, (ii) constructing a fusion network (a graph that dictates the required fusions between basic resource states), and (iii) determining the order of fusions.A sufficient number of trials are repeated with randomness and the one with the smallest resource overhead is selected as the outcome of the strategy.Although our approach does not guarantee the most optimal method, we provide evidence of its power and generality, making it suitable for studying various tasks involving graph states.Our strategy is implemented in an open-source Python package, OptGraphState, which is publicly available on Github: https:// github.com/seokhyung-lee/OptGraphState.This paper is structured as follows: In Sec. 1, we review the definitions and basic properties of graph states and type-II fusion.In Sec. 2, we describe our optimization strategy step by step with examples.In Sec. 3, we compute the resource overheads of various graphs using our strategy and numerically verify its effectiveness by comparing it with alternative strategies that lacks certain stages of the original strategy.We additionally discuss the success probability of generating a graph state given a restricted number of available basic resource states.We conclude with final remarks in Sec. 4. x-and z-axis, respectively, in the Bloch sphere; namely, RP := exp −i(π/4) P for P ∈ X, Ẑ .For the presented five-qubit graph state, applying R † X to vertex v 1 and RZ to each of its neighbors is equivalent to transform the graph by an LC with respect to v 1 .

Preliminaries 1.Graph states and their equivalence relation
For a given graph G = (V, E) with a vertex set V and an edge set E, a graph state |G⟩ V on qubits placed at the vertices is defined as where ÛCZ (v 1 , v 2 ) is the controlled-Z (cz) gate between the qubits at v 1 and v 2 and |+⟩ v is the state |0⟩ + |1⟩ on v. (We omit normalization coefficients throughout the paper unless necessary.)The graph state |G⟩ V has the stabilizer group generated by where Xv and Ẑv are respectively the Pauli-X and Z operators on v and adj(v) is the set of the adjacent vertices of v. Namely, An important problem regarding graph states is whether two different graph states are equivalent under a unitary operation, especially under a sequence of single-qubit Clifford operations.For a graph G = (V, E) and a vertex v ∈ V , we define a Clifford operator A local complementation LC v with respect to a vertex v ∈ V is defined as a graph operation Unit cell of RHG lattice that, for every pair of adjacent vertices of v, connect them if they are disconnected and disconnect them if they are connected.As proved in Ref. [38] and visualized in Fig. 1, ÛLC (v) transforms G by a local complementation; namely, Furthermore, it is known that two graph states are equivalent under a sequence of single-qubit Clifford operations if and only if one of their corresponding graphs can be obtained by applying a sequence of local complementations on the other [38].
The followings describe several well-known families of graph states visualized in Fig. 2: is a graph where one of the vertices (say, v root ) is connected with all the other vertices that are not connected with each other; see Fig. 2 , where V leaf is the set of the leaf vertices of G (m) * and Ĥv is the Hadamard gate on the qubit at v. Star graph states are often used as basic resource states of photonic MBQC [28,21,31,39,35] and FBQC [6].

Cycle graph.
A cycle graph consists of vertices connected in a closed chain.In particular, the graph state for the six-vertex cycle graph, which is shown in Fig. 2(b), is used as a basic resource state of FBQC [6].
Lattice graph.The (m x , m y )-lattice graph for integers m x , m y ≥ 1 has a two-dimensional (2D) square lattice structure where the vertices are repeated m x (m y ) times along the x-axis (y-axis).See Fig. 2(b) for an example.Lattice graph states are particularly useful for 2D MBQC [2,3], which is universal but not fault-tolerant [4].Any singlequbit rotation and the controlled-not gate can be implemented by measuring qubits of a lattice graph state in appropriate single-qubit bases.

Raussendorf-Harrington-Goyal
(RHG) lattice.The (L x , L y , L z )-RHG lattice graph is composed of unit cells stacked L x , L y , and L z times along the x-, y-, and z-axis, respectively.Each unit cell is cube-shaped and it consists of vertices locating at the faces and edges of the cube, as visualized in Fig. 2(d).RHG lattices are utilized in fault-tolerant three-dimensional (3D) MBQC [4,5].Logical qubits encoded in a surface code can be embedded into a lattice and logical operations and measurements can be done only by single-qubit measurements and state injection.A specific operator on each unit cell serves as a parity-check operator, whose measurement outcome is used to detect and locate errors.

Tree graph.
A tree graph is defined as a connected acyclic graph.We particularly define the as a tree graph where a vertex (designated its root vertex) has b 0 neighbors called 1st-generation branches and each ith-generation branch (i ≥ 1) has b i +1 neighbors that are (i+1)generation branches except for one.As an example, see Fig. 2(e) for the (4, 2, 2)-tree graph.One important usage of tree graphs is counterfactual error correction; by attaching tree graph states on qubits for 2D MBQC, qubit loss up to 50% can be tolerated [40].Such a technique also can be employed for 3D MBQC to suppress the effects of failed entangling operations during the construction of an RHG lattice [21].
Repeater graph.The 4m-vertex repeater graph (m ≥ 1) consists of 2m completelyconnected vertices and other 2m vertices that are respectively connected with them; see Fig. 2(f) for the case of m = 3.A repeater graph state can be used for all-optical quantum repeaters [13], which distribute entanglement over a long distance by recursive entanglement swapping.m determines the number of Bell-state measurements (BSMs) required per single trial of entanglement swapping, which succeeds if any one of these m BSMs succeed.

Type-II fusion operation
The type-II fusion operation (hereafter referred to simply as "fusion") [17] is a two-qubit operation that consists of applying a Hadamard gate  ( Ĥ) to one of the qubits, followed by a BSM, and finally erasing the qubits.In other words, fusion indicates a destructive measurement of two Pauli operators X ⊗ Ẑ and Ẑ⊗ X on a pair of qubits.By applying a fusion on an unconnected pair (v 1 , v 2 ) of vertices in a graph state, we can connect (disconnect) every adjacent vertex of v 1 with every adjacent vertex of v 2 up to several Pauli-Z operators if they are unconnected (connected); see the example in Fig. 3(a).More formally, for two unconnected vertices v 1 and v 2 of a graph G, F v 1 ,v 2 is defined as a graph operation that, for every u 1 ∈ adj (v 1 ) and u 2 ∈ adj (v 2 ), connect (disconnect) u 1 and u 2 if they are unconnected (connected) and delete v 1 and v 2 from the graph.When v 1 and v 2 undergo a fusion for which the Hadamard gate is applied on v 1 , the resulting state is where (m sign , m lett ) is the outcome of the BSM.
Here, we denote the Bell basis as and the outcome of a BSM as (±1, 1) if |ϕ ± ⟩ is obtained and (±1, −1) if |ψ ± ⟩ is obtained.Note that fusion was originally defined as a BSM in Ref. [17].Nevertheless, we consider its variant (differing only by a Hadamard gate) since it is more suitable to generate arbitrary graph states due to its aforementioned property.
For single-photon polarization qubits with the basis of horizontally and vertically polarized single-photon states (|h⟩, |v⟩), the BSM can be done with linear optical devices and photodetectors [41], as visualized in Fig. 3(b).This BSM scheme can distinguish only two among the four Bell states, thus the fusion succeeds with the probability of when each photon suffers loss with probability η and the input state is maximally mixed.See Ref. [35] for a discussion on how failed fusions affect the resulting graph state.
2 Strategy for identifying a method for graph state generation In this section, we present our main result: a graph-theoretical strategy to effectively identify a resource-efficient method for generating an arbtirary graph state via fusions.Our basic resource state is the three-qubit star graph state where |±⟩ := |0⟩ ± |1⟩.Hence, our goal is to find an efficient way to build a desired graph state |G⟩ by performing fusions on multiple G (3) * states.We take an approach that, whenever a fusion fails, we discard the photons that were entangled with the photons involved in the failed fusion, regenerate the state of the discarded photons with new photons, and retry the fusion.This process does not necessarily have to proceed in order; that is, we may parallelly generate multiple identical states and post-select only the ones with successful fusions.
The resource overhead of a method to generate |G⟩ is quantified by the expected value Q of the number of G state gives the resource overhead of 2 × (4 + 1) = 10.In reality, the success probability may vary for each fusion due to different lengths of delay lines, but we simplify the problems by neglecting this fact in the following investigations.Note that, by definition, having Q basic resource states does not guarantee the successful generation of the graph state.The exact success probability is worth investigating, which will be covered later in Sec.3.4.
The basic resource state G (3) * can be generated with a success rate of 1/32 (in a lossless case) by using linear optical devices, singlephoton sources, and photodetectors [42].Furthermore, its deterministic generation is possible with matter-based methods [43,44], which is experimentally demonstrated in several recent works [45,46,47].
The key concept of our strategy is a fusion network, which is a graph where vertices correspond to individual G (3) * states and edges indicate fusions between the states required to generate |G⟩.Since fusion networks are not unique, selecting an appropriate fusion network is the first challenge.The second challenge is to determine the order of the fusions; although the final state is regardless of the order as long as all the fusions succeed, the non-deterministic nature of fusions makes it severely affect the resource efficiency.
The strategy is summarized as follows: 1. Simplify the graph of the desired graph state by unraveling subgraphs of specific types (bipartitely-complete subgraphs and cliques).(Sec.2.1) 2. Construct a fusion network from the simpli- We cover these steps in the following four subsections one by one.

Simplification of graph by unraveling
If the graph G = (V, E) of the desired graph state |G⟩ contains specific types of subgraphs, it is posible to generate |G⟩ by applying singlequbit Clifford operations and/or fusions on the graph state of a simplified graph.Unraveling means the process to build such a simplified graph G unrv = (V ′ , E ′ ) (referred to as an unraveled graph) and specify the information ÛC , F necessary to recover |G⟩ from |G unrv ⟩, where ÛC is the product of single-qubit Clifford operations and F ⊂ V ′ ×V ′ is the set of pairs of vertices that undergo fusions.We currently have unraveling schemes for two types of subgraphs: bipartitelycomplete subgraphs and cliques.

Unraveling bipartitely-complete subgraphs
Note that a bipartitely-complete graph allows edges between vertices in one part, thus it is different from a complete bipartite graph.The parameter (n, m) of a bipartitely-complete graph may not be uniquely determined.
If G has an (n, m) BCS, its two parts can be disconnected by adding two vertices (v 1 , v 2 ) that are respectively connected with all the vertices in one of the two parts and adding (v 1 , v 2 ) to F, which replace nm edges with n+m edges and one fusion; see Fig. 4 for an example.This process is called unraveling the BCS.
In our strategy, we repeat the cycle of finding non-overlapping BCSs (that do not share any vertices) via Algorithm 1 and unraveling them as above until no new BCSs are found.The time complexity of Algorithm 1 is O |V |d 4 max in the worst case, where d max is the largest degree 1 .Note that the iterations in Algorithm 1 are done in random orders because the final unraveled graph may vary depending on the orders and we want to suppress any possible bias during iteration (Step 4 of the strategy).All the randomness appearing from now on exist for the same reason.

Definition 2.2 (Clique). A clique of a graph
G is a subgraph of G where every vertex is fully connected with each other.A clique is maximal if it cannot be enlarged by adding a new vertex.
If G contains a clique, it can be simplified by using a local complementation.For a maximal clique of size greater than two, the unraveling process is conducted as follows (see Fig. 5 for an example): 1. Let us define V cl as the set of the vertices in the clique and V no.outer ⊆ V cl as the set of the vertices in the clique that are connected only with vertices in the clique.
2. If V no.outer is not empty, select a vertex v 0 randomly from V no.outer .
Algorithm 1: Finding non-overlapping bipartitely-complete subgraphs (BCSs) Input: A graph G = (V, E).Output: A set S of BCSs of G that do not share any vertices.1 S ← ∅; 2 V in.bcs ← ∅; // Vertices included in any BCS found so far 3 E checked ← ∅; // Edges checked so far 4 foreach v ∈ V (in a random order) do In our strategy, we repeat the cycle of finding non-overlapping maximal cliques (that do not share any vertices) and unraveling them as above until no new cliques are found.Listing all maximal cliques of a graph is an important problem in the graph theory and known to take exponential time in the worst case [48].However, there exist algorithms to list them in polynomial time per clique [49,50], thus the prob-lem can be efficiently solved if the graph does not contain many cliques.Our Python package OptGraphState uses Graph.maximal_cliquemethod from Python package python-igraph [51], which implements a more advanced algorithm in Ref. [52].

Additional notes
It is a subtle problem which of bipartitelycomplete graphs and cliques to unravel first.We randomly choose it since we currently have no basis for judging which one is better.
One may expect that BCSs and cliques are quite non-trivial and not very common.However, the smallest BCS and clique that are concerned for unraveling are cycles with four vertices and with three vertices, respectively.These are simple enough and appear in various graphs such as square and triangular grid graphs and RHG lattices.Moreover, large bipartitely-complete subgraphs may appear when converting a logically encoded graph state into a graph state with physical qubits.For instance, a three-qubit linear graph state with the (n, m) parity encoding contains at most (n, m) bipartitely-complete subgraphs in the physical level; see Sec. 3.3 and Ref. [35] for more details.

Construction of fusion network
After unraveling a graph G, we obtain an unraveled graph G unrv along with the information ÛC , F that identifies the operations needed to to restore |G⟩ from |G unrv ⟩.In particular, the fusions specified by F are called external fusions to distinguish them from the fusions used to generate the unraveled graph state.We now deal with the problem of building a fusion network from result.
We first formally define fusion networks as follows: 2. For each link l = {n 1 , n 2 }, iterate the following: (a) Let q 1 be q root if r l,n 1 = 1 and an arbitrary unmeasured qubit in Q (n 1 ) leaf if r l,n 1 = 0. Define q 2 analogously for n 2 .
(b) Apply appropriate single-qubit Clifford operations on q 1 and q 2 , if required.
(c) Perform a fusion on q 1 and q 2 .
3. Apply appropriate single-qubit Clifford operators on the remaining qubits, if required.
We say that a link l = {n 1 , n 2 } has the type of root-to-root, root-to-leaf, or leaf-to-leaf, when both r l,n 1 and r l,n 2 are equal to 1, only one of them is equal to 1, and both of them are equal to 0, respectively.
We now describe how to build a fusion network N f and the corresponding root indicators {r l,n } from the unraveled graph G unrv and the external fusions F. The main idea is to decompose a graph state into multiple star graph state, each of which is again decomposed into multiple G is called the seed node (marked as "S") of the node group that consists of these m − 2 nodes.
A general graph state |G⟩ can be generated by conducting fusions on leaf qubits of multiple star graph states, where each star graph is originated from a vertex in G with degree larger than one.Consequently, its fusion network can be constructed by connecting the fusion networks of the individual star graphs (which respectively form one node group) with leaf-to-leaf links.An example is illustrated in Fig. 6(b), where root-toleaf links and leaf-to-leaf links are represented by black single lines and orange double lines, respectively.If an external fusion exists, it also creates a link (blue dashed line) between nodes of different star graphs, as shown in Fig. 6(b).Such a link may belong to any one of the three types,  states, which leads to a three-node linear fusion network that forms one node group.The process varies depending on the selection of the seed node (marked as "S"), which determines the root vertex of G depending on the vertices involved in the external fusion.Note that external fusions always appear between different star graphs, considering the unraveling processes in Figs. 4 and 5.
It is important that the above process contains two types of ambiguity for each star graph (which are determined randomly in our strategy): which node in the node group to select as its seed node and which node to include each leaf vertex in.To illustrate the latter factor with the example of Fig. 6(a), the leaf vertex v f in G In other words, if v f participates in a fusion, the resulting fusion network may vary depending on this selection.For example, G (5) * appears in the decomposition of Fig. 6(b), and in this case, vertex 3 in (1) is selected to be v f ; thus, the link for the fusion is connected to node n 2 .
We lastly note that the single-qubit Clifford operators required in the process of generating a graph state can be identified from ÛC , the product of single-qubit Clifford operations obtained from the unraveling process, and the fusion out-comes.

Determination of fusion order
We now have one stage left: how to determine the order of fusions.Let us regard a fusion network as a weighted graph where each node indicates a group of entangled qubits and each link represents a fusion between these groups that needs to be done.The weight of each node w(n), which is initialized to 1, is defined as the resource overhead of the process of generating the corresponding entangled states.Namely, w(n) is the average number of required G (3) * states to generate the state.
Upon the above setting, the action of a fusion can be treated as the contraction of a link l, which means to merge two endpoints (n 1 , n 2 ) of the link into a new node n l and reconnect the links connected to the original nodes with n l .The weight of n l is updated as where p succ is the fusion success probability.Hence, if the order of the fusions is given, the resource overhead Q of the entire process can be obtained as the summation of the weights of the last remaining nodes after contracting all the edges in the order.Note that an intermediate fusion network during this process may have loops (links connecting a node to itself) or multi-links (links incident to the same two vertices).For a fusion network N f = (N, L), the number of possible fusion orders is |L|!; thus it is extremely inefficient to randomly sample fusion orders and find the best one unless there are very few links.Instead of it, our strategy is based on the following two intuitions: 1.It is preferred to contract links with small weights first, where the weight of a link l is defined as w(n l ) in Eq. ( 5).It is because, defining f (x, y) := (x + y)/p succ for two numbers x and y, when w 1 < w 2 < w 3 .
2. Links that do not share endpoints can be contracted simultaneously and it is preferred to contract links as parallelly as possible.
For example, let us consider a four-node linear fusion network where the node set is {n 1 , n 2 , n 3 , n 4 } and n i and n i+1 are connected with a link l i,i+1 for each i ∈ {1, 2, 3}.
Provided that p succ = 1/2, we obtain Q = 16 if l 1,2 and l 3,4 are first contracted in parallel, but obtain Q = 22 if l 2,3 is contracted first.
Based on these intuitions, we introduce the min-weight-maximum-matching-first method to determine the fusion order.For each round of the link contraction process, we first identify the set of links with the smallest weight and get the subgraph N min.wgt of the intermediate fusion network induced by these links.We then find a maximum matching of N min.wgt, which is the largest set of links that do not share any nodes, and contract these links in parallel.By repeating this procedure until no links remain, we can determine the fusion order and calculate the resource overhead Q.We illustrate an example in Fig. 7. To compute a maximum matching, our software uses max_weight_matching function from Python package NetworkX [53], which is based on the algorithm in Ref. [54] and takes time of O |number of nodes| 3 .

Note on the average number of fusions
One may want to use the average number of required fusion attempts to quantify resource overheads instead of the average number of required G (3) * states.In such a case, Eq. ( 5) should be modified to and the weights of nodes should be initialized to 0. All the other parts of the strategy remain the same.OptGraphState provides an option to use this alternative resource measure instead of Q.

Iteration
Since the method introduced above has randomness in several stages, it may produce a different outcome each time it is attempted.We thus iterate the method a sufficient number of times and choose the best one.Our software uses an adaptive method to determine the iteration number: Denoting the process to iterate the strategy m times as R(m), we first perform R(m init ) for a given integer m init ≥ 1 and obtain Q (1) opt , which is the minimal value of Q obtained from the samples.We then perform R(2m init ) and obtain opt , we stop the iteration and return Q (1) opt .If otherwise, we perform R(4m init ), obtain Q opt , and so on.Here, we refer to this method as the adaptive iteration with the given value of m init .
We emphasize that our strategy does not guarantee that the obtained generation method is strictly optimal.As elaborated above, our approach involves simulating sufficiently many random samples and selecting the best performing one.

Applications of the strategy
In this section, we present the numerical results obtained by applying our strategy to various graphs.We first analyze the distribution of resource overheads for random graphs, showing its tendency with respect to the numbers of vertices and edges.We then provide numerical evidence indicating that each step of our strategy can significantly contribute to lowering the resource overhead.Additionally, we show the calculated resource overheads of various well-known graphs described in Sec.1.1.We lastly investigate the probability of successfully generating a graph state given a restricted number of available basic resource states and present the results for several graph states.
Throughout the section, |V | and |E| for a given graph indicate the numbers of vertices and edges, respectively, and |E| max is defined as the maximal possible number of edges for a given value of |V | (under the assumption that there are no loops and multi-edges):

Analysis of random graphs
To sample random graphs, we use the Erdős-Rényi model [55], where all graphs that contain given fixed values of |V | and |E| have an equal probability.Figure 8   • The fusion scheme with p succ = 0.75 may greatly reduce the order of Q opt , compared to the one with p succ = 0.5, especially when |V | is large.Note that, to achieve p succ = 0.75 with linear optics, we require an ancillary two-photon Bell state [23] or four ancillary unentangled photons [24] per fusion and photon-number resolving detectors that can discriminate at least four photons.On the other hand, the scheme with p succ = 0.5 requires only on-off detectors and no ancillary photons.

Performance analysis
We now show that our strategy is indeed effective by comparing it with two "deficient" strategies in which a certain stage is missing from the original "full" strategy.In detail, we consider the following two alternative strategies: (s1) The strategy without the unraveling process, where the original graph is directly used for generating a fusion network.The other steps are the same as the full strategy.
(s2) The strategy where the fusion order is randomly selected without using the minweight-maximum-matching-first method.The other steps are the same as the full strategy.
In Fig. 9, the distributions of Q opt optimized by these three strategies for random graphs are presented as box plots.Each box extends from the first quartile (Q1) to the third quartile (Q3) and the corresponding whisker covers the entire range of the values.It clearly shows that the full strategy is significantly more powerful than the deficient ones, especially when there exist many vertices and edges.In other words, each step in the full strategy contributes to reducing the resource overhead.A dashed box with a text "×N " (for an integer N ) indicates a bundle of recurrent subgraphs.Namely, the subgraph inside the box is repeated N times and, for each edge crossing the border of the box, an edge of the same format exists for every repeated subgraph.See Ref. [35] for more details.

Applications to well-known graphs
We here investigate the resource overheads of the graph states in Sec.1.1, which are utilized in various quantum tasks such as MBQC, FBQC, quantum repeaters, and quantum error correction.Be-Table 1: Results of resource overhead analyses for various well-known graphs.See Fig. 2 for the visualization of these graphs.|V | and |E| indicate the numbers of vertices and edges.|E| max = |V |(|V |−1)/2 is the maximal possible number of edges.The optimized resource overheads Q opt and the corresponding average numbers of fusion attempts are calculated for two fusion success rates: p succ ∈ {0.5, 0.75}.The adaptive iteration method of m init = 1200 is used for the calculation.
In Table 1, we list the results of the resource analyses for these graph states, together with the basic information of the graphs.Additionally, in Appendix A, we present several explicit examples of the application of our strategy with visualization.We note that the extremely high resource overheads of RHG lattices do not necessarily render them impractical.From the perspective of fault-tolerant quantum computing [4], certain levels of absent vertices or edges result-ing from fusion failures can be endured [57,58].Hence, many previous schemes [21,39,35,6] take an approach of initially generating "unit" resource states successfully, followed by merging them while allowing fusion failures.In this context, our strategy can be utilized to evaluate the resource costs of these unit states.For example, they can be tree graphs [21], parity-encoded 3-star graphs [39,35], or parity-encoded 6-cycle graphs [6], all of which are presented in Table 1.

Success probability of graph state generation
We emphasize that the resource overhead Q we have used so far is defined by the expected value of the resource count required to generate the desired graph state |G⟩.Namely, if we define a discrete random variable C by this resource count, then One may want to know more information on the probability mass function (PMF) Pr(C = c), not just its expectation value.Moreover, the corresponding cumulative mass function (CMF) indicates the probability P succ (c) of the successful generation of |G⟩ when c resource states are provided, namely, which may be a more practical indicator than Q to assess the performance of a scheme.We first investigate the case where two graph states with resource counts C 1 and C 2 are merged by a single fusion of success rate p s to form a graph state with resource count C 3 .For each i ∈ {1, 2, 3}, let us define q i (•) by the probability distribution function (PDF) corresponding to the PMF Pr (C i = c); namely, where δ is the Kronecker delta function.Then q 1 , q 2 , and q 3 are related as where the " * " symbol indicates convolution defined as Here, each term including p s (1 − p s ) l for l ≥ 0 corresponds to the case where the fusion fails l times and succeeds on the next attempt.The convolution theorem [59] states that the Fourier transformation (FT) defined as converts convolution into multiplication of functions as Thus, applying the FT to the both sides of Eq. ( 7), we obtain Therefore, considering that the PDF of the resource count for the basic resource state G (3) * is δ(x−1) =: q base (x), the Fourier-transformed PDF (FTPDF) for every graph state can be written as the inverse of a polynomial of q−1 base (k) = e −ik =: z −1 .Namely, for every FTPDF q(k), there exists a series of real numbers {a l } L l=0 that satisfies To compute the FTPDF for a desired graph state, we just need to assign the PDF of z to every node of the fusion network and sequentially apply the rule of Eq. (8) for every link contraction.After obtaining the final FTPDF q(k) in the form of Eq. (9), we need to recover the PMF Pr(C = c) from it.By applying the Taylor expansion at z = 0 on , we get the power series where {b j } is recurrently defined as Since z j = e ikj is the FT of δ(x − j), we conclude that the PMF is Additionally, we obtain the CMF P succ (c) in Eq. ( 6) as where if we define a −1 := 0. The above calculations are implemented in our software OptGraphState.In Fig. 11, we display the computed success probabilities P succ for generating various graph states, plotted against the resource count c.Lines labeled (a)-(d) correspond to the repeater graph with m = 6, (4, 4) parity-encoded 3-star graph, (4, 4)-lattice graph, and (4, 4) parity-encoded 6-cycle graph, respectively.We note that the resource overhead Q, which is shown as dashed lines, matches the resource count when the associated success probability is roughly 60%.For achieving a greater success probability, such as 90%, one would need approximately twice as many resource states as Q.

Remarks
Graph states are versatile resource states for various tasks on quantum computation and communication, such as MBQC [2,4], FBQC [6], quantum error correction [7,8], and quantum repeaters [11].However, in optical systems, the non-deterministic nature of entangling operations hinders the generation of large-scale graph states; thus, the generation process should be carefully designed.
In this work, we introduced a graph-theoretical strategy to construct a resource-efficient method for generating an arbitrary graph state with the type-II fusion operation.Here, the resource overhead is quantified by the average number of required basic resource states (three-qubit star graph states) to generate the graph state without failed fusions.As outlined in Sec. 2, the strategy is composed of multiple trials to find the optimal one, where each round contains three stages: unraveling the graph, constructing a fusion network, and determining the fusion order.In Sec. 3, we applied the strategy to various graph states and verified numerically that each step of the strategy is indeed necessary to achieve high resource efficiency.Moreover, we described a recursive technique to determine the success probability of generating a graph state as a function of the resource cost and tested it on several representative graph states.
We anticipate that our strategy and software will aid researchers in designing experimentally feasible approaches utilizing photonic graph states and in evaluating the practicality of their proposed schemes.For example, the basic resource states of MBQC and FBQC can be logically-encoded star or cycle graph states [35,6].Employing larger or more complex codes may improve the fault-tolerance of these schemes; however, generating such resource states could become a bottleneck in their implementation.Our strategy can contribute to evaluating such a trade-off relation and identifying the most practical sweet spot.
We lastly note several interesting unsolved problems related to our work: is used as the basic resource state, only minor adjustments are needed in our strategy: Within each node group of a fusion network shown in Fig. 6, contract adjacent nodes beforehand so that each node represents a star graph state with at most n qubits.However, if the basic resource state is not a star graph state, it might necessitate a complete overhaul of the algorithm, which will be worth investigating.

5.
Tolerance for fusion failures.The aim of our strategy is to generate a graph state without any failed fusions.However, in practical scenarios, we may consider allowing some fusion failures at the cost of some missing vertices and edges from the lattice, which can be tolerable depending on the characteristics and usage of the generated state.For example, in parity-encoded graph states, which are graph states of logically encoded qubits, such defects may lead to correctable errors.If we allow a degree of failed fusions, how many vertices or edges would be missing from the resulting lattice?In such cases, how can we determine an efficient generation scheme and calculate its resource overhead?Can we relate the fault-tolerance of a graph state and the resource overhead to generate it?
A Examples of the application of the strategy In this Appendix, we present examples of applying our strategy to several graphs, which is obtained by using our Python package OptGraphState.Figures 12,13, and 14 show the (4, 4)-lattice graph, repeater graph with m = 4, and (2, 2) parity-encoded 6-cycle graph and their unraveled graphs and fusion networks that give the resource overheads in Table 1 when p succ = 0.5, which are plotted by using the python-igraph library.The description of the various elements of these figures is as follows.

Original graph:
• A number inside each vertex is its unique name.
• Orange vertices indicate qubits with non-trivial Clifford gates.

Unraveled graph:
• A number inside each vertex is its unique name.If a vertex is originated from a vertex in the original graph, they have the same name.
• Black solid lines are edges of the unraveled graph and red dashed lines indicate external fusions.
• Orange vertices indicate qubits with non-trivial Clifford gates.

Fusion network:
• A number inside each node is its unique name.Each seed node has the same name as the vertex in the unraveled graph that the node is originated from; namely, the qubit at the vertex is the root qubit of the G (3) * state of the seed node.Non-seed nodes have names like 'i-j', where i is the name of the seed node in the same node group and j is an index starting from 1.
• Black solid lines are leaf-to-leaf links, red dashed lines are root-to-root links, and blue arrows are root-to-leaf links.Each arrow for a root-to-leaf link points from the node that contains the leaf qubit involved in the fusion to the other node.
• A number placed on each link indicates the order of the fusion.The fusions should be performed in the order in which these numbers increase and those with the same number can be done simultaneously.
• If the text placed on a link ends with the letter 'C' (such as '1C'), it means that the corresponding fusion is accompanied by non-trivial Clifford gates applied to one or both of the qubits before the fusion is performed.The unraveled graph and fusion network give the resource overhead of 208 when p succ = 0.5.See Appendix A for their interpretation.In the unraveled graph, the qubits at the orange vertices are subjected to non-trivial Clifford gates: R X (π/2) := exp i(π/4) X to qubit 16 and R Z (π/2) := exp i(π/4) Ẑ to the others.In the fusion network, the fusion of the link connecting the nodes 5 and 16 is accompanied by R X (π/2) applied to the qubit in node 16 before the fusion is performed.

Figure 1 :
Figure 1: Example of a local complementation (LC) and the corresponding single-qubit Clifford operations.RX and RZ indicate a π/2 rotation around the x-and z-axis, respectively, in the Bloch sphere; namely, RP := exp −i(π/4) P for P ∈ X, Ẑ .For the pre-

Figure 2 :
Figure 2: Examples of various well-known families of graphs.See Sec.1.1 for their descriptions and usages.
(a) for an example.The vertex v root is called the root vertex of G (m) * and the other vertices are called its leaf vertices.Note that the graph state G (m) * is equivalent to the m-qubit Greenberger-Horne-Zeilinger (GHZ) state |GHZ m ⟩ := |0⟩ ⊗m + |1⟩ ⊗m and the graph state of the m-vertex complete graph G (m) cmpl (where all the vertices are connected) un-der single-qubit Clifford gates; namely, Photodetectors thus this process has the resource overhead of four if p succ = 1/2.Fusing it again with another G(3) *

Figure 4 :
Figure 4: Example of an unraveling process of a bipartitely-complete subgraph.The vertices of the two parts are colored in blue and yellow, respectively.The original graph state can be constructed by performing a fusion on v 1 and v 2 of the unraveled graph state.

Figure 5 :
Figure 5: Example of an unraveling process of a maximal clique.The process is done through three steps: (a) selecting a random vertex v 0 in the clique, (b) separating v 0 from the clique by adding two vertices v 1 and v 2 , and (c) applying a local complementation with respect to v 1 .Vertices in the clique are colored in blue and the new vertices are colored in yellow.The original graph state can be constructed by performing single-qubit Clifford operations ( RP := exp −i(π/4) P for P ∈ X, Ẑ ) and a fusion on the unraveled graph state in (c).
is a fusion network of a graph state |G⟩ (where vertices and edges are refereed to as nodes and links) for root indicators {r l,n ∈ {0, 1} | ∀l ∈ L, ∀n ∈ l} if |G⟩ can be generated by the process: 1. Prepare a state G (3) * for each node n.Let q (n) root denote its root qubit and Q (n) leaf denote the set of its leaf qubits.
m-qubit star graph state G (m) * can be constructed by conducting fusions on m − 2 copies of G (3) * , which leads to a fusion network with m − 2 nodes connected linearly with root-to-leaf links; see Fig. 6(a) for an example when m = 5.Note that there is an ambiguity in positioning the root qubit (marked as "R") of G (m) * as depicted in Fig. 6(a) with (1) and (2).The node for the G (3) * state containing the root qubit of G (m) *

Figure 6 :
Figure 6: Examples of the construction of fusion networks.(a) A five-qubit star graph state G (5) * and (b)

( 5 )
* (marked as "R").A leaf vertex v f of the star graph can be any of the four vertices (1-4) after the decomposition.In (b), |G⟩ is decomposed into multiple star graph states, where each of them is again decomposed into G(3) * states and forms one node group in the fusion network.The line styles of the links in the fusion network indicate their origins: black solid lines for fusions inside a star graph, orange double lines for fusions between star graphs, and a blue dashed line for an external fusion.
of the four vertices (1-4) after the decomposition.Such ambiguity matters if G (5) * appears during the decomposition of a larger graph state.

Figure 7 :
Figure 7: Example of the determination of the fusion order with the min-weight-maximum-matching-first method.We assume p succ = 1/2.Each step is an intermediate fusion network after contracting links (orange bold lines) in the previous step.The numbers inside the nodes indicate their weights.The obtained resource overhead is Q = 64, which is the weight of the last remaining node.

Figure 8 :
Figure 8: Distribution of the optimized resource overhead Q opt for random graphs.Random graphs are sampled with fixed numbers of vertices (|V |) and edges (|E|) by the Erdős-Rényi model [55].Two different fusion success rates are considered: p succ ∈ {0.5, 0.75}.|E| max = |V |(|V | − 1)/2 is the maximal possible number of edges for the given vertex number.For each combination of (p succ , |V |, |E|), we sample 100 random graphs and obtain the distribution of Q opt through the adaptive iteration method of m init = 600.The median of the distribution is indicated as a dot and its total range is shown as a shaded region.

6 Figure 9 :
Figure 9: Comparison of the distributions of the optimized resource overhead Q opt for different optimization strategies.Three strategies are considered: the strategy without unraveling (s1), the strategy with random selection of the fusion order (s2), and our full strategy.The subplots correspond to different values of |V | ∈ {12, 18, 24} and |E|/|E| max ∈ {0.2, 0.6}.For each setting, 100 graphs are sampled by the Erdős-Rényi model and 1200 iterations are done for each graph.(The adaptive iteration method is not used for fair comparisons.)The distribution of Q opt is visualized as a box plot, where the red line indicates the median, the box extends from the first quartile (Q1) to the third quartile (Q3), and the whisker covers the entire range of the values.

Figure 10 :
Figure 10: Rule for converting an (n, m) parityencoded graph state into a physical-level graph state.A dashed box with a text "×N " (for an integer N ) indicates a bundle of recurrent subgraphs.Namely, the subgraph inside the box is repeated N times and, for each edge crossing the border of the box, an edge of the same format exists for every repeated subgraph.See Ref.[35] for more details.

Figure 11 :
Figure 11: Success probabilities of graph state generation as functions of the number of provided basic resource states.The solid lines respectively indicate the success probabilities P succ (c) for the graph states of (a) the repeater graph with m = 6, (b) (4, 4) parityencoded 3-star, (c) (4, 4)-lattice, and (d) (4, 4) parityencoded 6-cycle.Each dashed line represents the corresponding resource overhead Q, which is the expected value of the resource count when P succ is the cumulative mass function.

Figure 12 :
Figure 12: (4, 4)-lattice graph and its unraveled graph and fusion network obtained by our strategy.The unraveled graph and fusion network give the resource overhead of 7680 when p succ = 0.5.See Appendix A for their interpretation.

Figure 13 :
Figure 13: Repeater graph with m = 4 and its unraveled graph and fusion network obtained by our strategy.The unraveled graph and fusion network give the resource overhead of 208 when p succ = 0.5.See Appendix A for their interpretation.In the unraveled graph, the qubits at the orange vertices are subjected to non-trivial Clifford gates: R X (π/2) := exp i(π/4) X to qubit 16 and R Z (π/2) := exp i(π/4) Ẑ to the others.In the fusion network,

Figure 14 :
Figure 14: (2, 2) parity-encoded 6-cycle graph and its unraveled graph and fusion network obtained by our strategy.The unraveled graph and fusion network give the resource overhead of 1280 when p succ = 0.5.See Appendix A for their interpretation.In the original and unraveled graphs, the qubits at the orange vertices are subjected to the Hadamard gate.

1 .
Generalization of unraveling.For a given graph state |G⟩, how can we identify another graph state |G ′ ⟩ such that |G⟩ can be generated from |G ′ ⟩ using a combination of fu-While preparing larger basic resource state might be challenging, it can reduce the resource overhead.We anticipate that the reduction would be approximately proportional to the original overhead of the new basic resource state.For instance, employing G