Characterization of solvable spin models via graph invariants

Exactly solvable models are essential in physics. For many-body spin-1/2 systems, an important class of such models consists of those that can be mapped to free fermions hopping on a graph. We provide a complete characterization of models which can be solved this way. Specifically, we reduce the problem of recognizing such spin models to the graph-theoretic problem of recognizing line graphs, which has been solved optimally. A corollary of our result is a complete set of constant-sized commutation structures that comprise the obstructions to a free-fermion solution. We find that symmetries are tightly constrained in these models. Pauli symmetries correspond to either: (i) cycles on the fermion hopping graph, (ii) the fermion parity operator, or (iii) logically encoded qubits. Clifford symmetries within one of these symmetry sectors, with three exceptions, must be symmetries of the free-fermion model itself. We demonstrate how several exact free-fermion solutions from the literature fit into our formalism and give an explicit example of a new model previously unknown to be solvable by free fermions.


Introduction
Exactly solvable models provide fundamental insight into physics without the need for difficult numerical methods or perturbation theory. In the particular setting of many-body spin-1 /2 systems, a remarkable method for producing exact solutions involves finding an effective description of the system by noninteracting fermions. This reduces the problem of solving the n-spin system over its full 2 n -dimensional Hilbert space to one of solving a single-particle system hopping on a lattice of O(n) sites. The paradigmatic example of this method is the exact solution for the XY model [1], where the Jordan-Wigner transformation [2] is employed to describe the model in terms of free fermions propagating in one spatial dimension. These fermions are resolved as nonlocal Pauli operators in the spin picture, and the nonlocal nature of this mapping may suggest that finding generalizations to this mapping for more complicated spin systems is a daunting task. Of the many generalizations that Adrian Chapman: adrian.chapman@sydney.edu.au have since been proposed [3][4][5][6][7][8], a particularly interesting solution to this problem is demonstrated in the exact solution of a 2-d spin model on a honeycomb lattice introduced by Kitaev [9]. For this model, the transformation to free-fermions can be made localitypreserving over a fixed subspace through the use of local symmetries.
The dynamics of free-fermion systems are generated by Gaussian-fermionic Hamiltonians and correspond to the class of so-called matchgate circuits. This circuit class coincides with the group of free-fermion propagators generated by arbitrarily time-dependent single-particle Hamiltonians [10,11] and has an extensive complexity-theoretic characterization. In general, matchgate circuits can be efficiently simulated classically with arbitrary single-qubit product-state inputs and measurement [12,13]. However, they become universal for quantum computation with the introduction of non-matchgates such as the SWAP gate [14,15], certain measurements and resource inputs [16,17], and when acting on nontrivial circuit geometries [18]. Furthermore, these circuits share an interesting connection to the problem of counting the number of perfect matchings in a graph, which is the context in which they were first developed [19][20][21][22]. This problem is known to be very hard computationally (it is #P-complete [23]), but is efficiently solved for planar graphs using the so-called Fisher-Kasteleyn-Temperley algorithm [24,25].
In this work, we develop a distinct connection between free-fermion systems and graph theory by using tools from quantum information science. The central object of our formalism is the frustration graph. This is a network quantifying the anticommutation structure of terms in the spin Hamiltonian when it is expanded in the basis of Pauli operators [26]. This graph has been invoked previously in the setting of variational quantum eigensolvers [27][28][29][30][31][32][33][34], commonly under the name "anti-compatibility graph". We show that the problem of recognizing whether a given spin model admits a free-fermion solution is equivalent to that of recognizing whether its frustration graph is a line graph, which can be performed optimally in linear time [35][36][37]. From the definition of a line graph, it will be clear that such a condition is necessary, but we will show that it is also sufficient. When the condition is met, we provide an explicit solution to the model.
Line graphs have recently emerged as the natural structures describing the effective tight-binding models for superconducting waveguide networks [38][39][40].
In this setting, the line graph corresponds to the physical hopping graph of photons in the network. We will see how this scenario is a kind of "inverse problem" to the one we consider, wherein fermions are hopping on the root of the line graph. It is clear from both scenarios that the topological connectivity structure of many-body systems plays a central role in their behavior, and it is remarkable that this is already being observed in experiments. We expect that further investigation of the graph structure of manybody Hamiltonians will continue to yield important insights into their physics.

Summary of Main Results
Here we give a brief summary of the main results. We first define the frustration graph of a Hamiltonian, given in the Pauli basis, as the graph with nonzero Pauli terms as vertices and an edge between two vertices if their corresponding terms anticommute. A line graph G of a graph R is the intersection graph of the edges of R as two-element subsets of the vertices of R.
With these simple definitions, we can informally state our first main result, which we call our "fundamental theorem:" Result 1 (Existence of free-fermion solution; Informal version of Thm. 1). Given an n-qubit Hamiltonian in the Pauli basis for which the frustration graph G is the line graph of another graph R, then there exists a free-fermion description of H.
From this description, an exact solution for the spectrum and eigenstates of H can be constructed. This theorem illustrates a novel connection between the physics of quantum many-body systems and graph theory with some surprising implications. First, it gives the exact correspondence between the spatial structure of a spin Hamiltonian and that of its effective free-fermion description. As we will see through several examples, this relationship is not guaranteed to be straightforward. Second, the theorem gives an exact condition by which a spin model can fail to have a free-fermion solution, the culprit being the presence of forbidden anticommutation structures in the frustration graph of H.
Some caveats to Result 1 (that are given precisely in the formal statement, Theorem 1) involve cases in which this mapping between Pauli terms in H and fermion hopping terms is not one-to-one. In particular, if we are given a Hamiltonian whose frustration graph is not a line graph, then a free-fermion solution may still be possible via a non-injective mapping over a subspace defined by fixing stabilizer degrees of freedom. Additionally, it is possible for a given spin Hamiltonian to describe multiple free-fermion models simultaneously, each generating dynamics over an independent stabilizer subspace of the full Hilbert space as for the Kitaev honeycomb model [9]. Finally, it may be the case that the free-fermion model contains states which are nonphysical in the spin-Hamiltonian picture, and so these must be removed by fixing a symmetry as well. Luckily, all of these cases manifest as structures in the frustration graph of H. The first, regarding when a non-injective free-fermion solution is required, is signified by the presence of so-called twin vertices, or vertices with the same neighborhood. We deal with this case in our first lemma. The next two cases are covered by our second theorem: Result 2 (Graphical symmetries; Informal version of Thm. 2). Given an n-qubit Hamiltonian in the Pauli basis for which the frustration graph G is the line graph of another graph R, then Pauli symmetries of H correspond to either: (ii) A T-join of R, associated to the fermion-parity operator; (iii) Logically encoded qubits; and these symmetries generate an abelian group.
We then prove that we can always fix all of the cycle symmetries by choosing an orientation of the root graph R. Our results also relate the more general class of Clifford symmetries to the symmetries of the singleparticle free-fermion Hamiltonian. We show that with exactly three exceptions, Clifford symmetries of the spin model, in a subspace defined by fixing the symmetries listed above, must also be symmetries of the single-particle Hamiltonian (see Corollary 1.2 for a precise statement). Finally, we illustrate these ideas with several examples: 1-and 2-qubit systems, the 1-dimensional anisotropic XY model in a transverse field and its nearest-neighbor solvable generalization, the Kitaev honeycomb model, the 3-dimensional frustrated hexagonal gauge color code [41], and the Sierpinski-Hanoi model. To the best of our knowledge, this last model was previously not known to be solvable.
The remainder of the paper is organized as follows. In Section 2, we will introduce notation and give some background on the formalism of free-fermions and frustration graphs. In Section 3, we will formally state Theorem 1 and some general implications thereof. In Section 4, we elaborate on the structure of symmetries which can be present in our class of solvable models. In Section 4.1, we will use the theorems of the previous two sections to outline an explicit solution method. We close by demonstrating how the examples of free-fermion solutions listed above fit into this formalism in Section 5.

Frustration Graphs
The models we consider are spin-1 /2 (qubit) Hamiltonians written in the Pauli basis where j ≡ (a, b), with a, b ∈ {0, 1} ×n labeling an n-qubit Pauli operator as The exponent of the phase factor, a · b, is the Euclidean inner product between a and b. This phase is chosen such that the overall operator is Hermitian, and such that a k = b k = 1 means that σ j acts on qubit k by a Pauli-Y operator. We denote the full n-qubit Pauli group by P, and V ⊆ P is the set of Pauli terms in H (i.e. h j = 0 for all j / ∈ V ). Let the Pauli subgroup generated by this set be denoted P H .
For our purposes, what is important is not the explicit Pauli description of the Hamiltonian, but rather the commutation relations between its terms. As Pauli operators only either commute or anticommute, a useful quantity is their scalar commutator [[·, ·]], which we define implicitly as The scalar commutator thus only takes the values ±1. Additionally, the scalar commutator distributes over multiplication in each argument, e.g.
For n-qubit Paulis, the scalar commutator can thus be read off from the Pauli labels as Here, j, k is the symplectic inner product where naturally j ≡ (a j , b j ) and k ≡ (a k , b k ). 0 n is the n × n all-zeros matrix, and I n is the n × n identity matrix. Eq. (5) captures the fact that a factor of −1 is included in the scalar commutator for each qubit where the operators σ j and σ k differ and neither acts trivially. Since the inner product appears as the exponent of a sign factor, without loss of generality, we can replace it with the binary symplectic inner product j, k 2 ≡ j, k mod 2.
H j∈{x,y,z}  [26,43]. Colored are the size-five cliques corresponding to the degree-five vertices of the root graph. This mapping implies the existence of a free-fermion solution for general two-qubit Hamiltonians by six fermions, reflecting the accidental Lie-algebra isomorphism su(4) spin(6) (see Section 5.1).
Through the binary symplectic inner product, the scalar commutator defines a symmetric binary relation between terms in the Hamiltonian, to which we associate the adjacency matrix of a graph. Denote the frustration graph for a Hamiltonian of the form in Eq. (1) by G(H) ≡ (V, E) with vertex set given by the Pauli terms appearing in H, and edge set That is, two Pauli terms correspond to neighboring vertices in G(H) if and only if they anticommute. Without loss of generality, we can assume that G(H) is connected, as disconnected components of this graph correspond to commuting collections of terms in the Hamiltonian and can thus be independently treated. As such, we will further assume that H has no identity component in the expansion (1)rendering it traceless-since this will only contribute an overall energy shift to the system with no effect on dynamics.

Majorana Fermions
A related set of Hermitian operators which only either commute or anticommute is that of the Majorana fermion modes {c µ } µ , which satisfy the canonical an-ticommutation relations and for which c † µ = c µ . A familiar way of realizing these operators in terms of n-qubit Pauli observables is through the Jordan-Wigner transformation The Pauli operators on the right can easily be verified to constitute 2n operators satisfying Eq. (9). Of course, we will explore the full set of generalizations to this transformation in this work. We seek to identify those qubit Hamiltonians which can be expressed as quadratic in the Majorana modes. Such free-fermion Hamiltonians are written as where c is a row-vector of the Majorana operators, and h is the single-particle Hamiltonian. Without loss of generality, h can be taken as a real antisymmetric matrix, as we can similarly assume H is traceless, and the canonical anticommutation relations Eq. (9) guarantee that any symmetric component of h will not contribute to H. E is the edge-set of the fermionhopping graph R ≡ ( V , E) on the fermion modes V . That is, h jk = 0 for those pairs (j, k) / ∈ E, and the factor of two in the rightmost expression accounts for the fact that each edge in E is included only once in the sum.
As a result of the canonical anticommutation relations (9), the individual Majorana modes transform covariantly under the time evolution generated by H Since h is antisymmetric and real, e 4ht ∈ SO(2n, R). Thus, h can be block-diagonalized via a real orthogonal matrix, W ∈ SO(2n, R), as We can represent W as the exponential of a quadratic Majorana fermion operator as well, by defining H is therefore diagonalized as Note that the exact diagonalization can be performed with reference to the quadratics in the Majorana fermion modes only. To completely solve the system, it is only necessary to diagonalize h classically, find a generating matrix w, and diagonalize H using an exponential of quadratics with regard to some fermionization like Eq. (10). Eigenstates of H can be found by acting e c·w·c T on a computational basis state |x for x ∈ {0, 1} ×n . The associated eigenvalue is Therefore, systems of the form in Eq. (11) may be considered exactly solvable classically, since their exact diagonalization is reduced to exact diagonalization on a poly(n)-sized matrix h.

Fundamental Theorem
As mentioned previously, we seek to characterize the full set of Jordan-Wigner-like transformations, generalizing Eq. (10). To be more precise, we ask for the conditions under which there exists a mapping φ : V → V ×2 , for some set V (the fermion modes), effecting for φ 1 (j), φ 2 (j) ∈ V , and such that for all pairs, j and k. Such a mapping induces a termby-term free-fermionization of the Hamiltonian (1) to one of the form (11) such that

Again, G(H) is the frustration graph of H.
From the canonical anticommutation relations, Eq. (9), and the distribution rule Eq. (4), we see that scalar commutators between quadratic Majoranafermion operators are given by Eqs. (22) and (23) can be restated graph theoretically as saying that G(H) is the graph whose vertex set is the edge set of the fermion hopping graph R, and vertices of G(H) are neighboring if and only if the associated edges of R share exactly one vertex. Such a graph is called the line graph of R.
is the graph whose vertex set is the edge set of R and whose edge set is given by where R is the hopping graph of the free-fermion solution.
The proof of Theorem 1 can be found in Section 6.1. This result reveals a correspondence between a characterization of line graphs and a characterization of free-fermion spin models, as not every graph can be expressed as the line graph of some root. We must however note that, strictly speaking, the existence of this mapping alone does not guarantee a free-fermion solution, since the "Lie-homomorphism" constraint, Eq. (21), does not fix the sign of the terms in the free-fermion Hamiltonian. Choosing a sign for each term is equivalent to orienting the root graph, since multiplying by a sign is equivalent to making the exchange φ 1 (j) ↔ φ 2 (j) in Eq. (20). Different orientations may not faithfully reproduce the properties of H, but we will see that such an orientation can always be chosen. The line graph condition in Eq. (25) is therefore necessary and sufficient for a free-fermion solution to exist. Before turning to further implications of Theorem 1, let us first detail some properties of line graphs. Line graphs are closely related to so-called intersection graphs, originally studied by Erdős [47] and others (see, for example, Ref. [48]). An intersection graph G ≡ (V, E) is a graph whose vertex set, V ⊆ 2 S , consists of distinct subsets of some set S. Two vertices, u and v, are neighboring in G if their intersection is nonempty (|v ∩ w| = 0). A line graph is a special case of an intersection graph where every vertex corresponds to a subset of size at most two. When we specify that φ be injective, we are requiring that no distinct vertices have identical subsets, and our definition of a free-fermion solution Eq. (25) identically coincides with that of a line graph. Since terms in H can thus intersect by at most one Majorana mode, collections of terms containing a given mode are all neighboring in G(H), so this mode corresponds to a clique, or complete subgraph, of G(H). This characterization of line graphs was first given by Krausz [49] and bears stating formally.

Definition 2 (Krausz decomposition of line graphs). Given a line graph G L(R), there exists a partition of the edges of G into cliques such that every vertex appears in at most two cliques.
Cliques in G(H) can therefore be identified with the individual Majorana modes in a free-fermion solution of H. If a term belongs to only one clique, we can ensure our resulting fermion Hamiltonian is quadratic by taking the second clique for that term to be a clique of no edges, as we will see in several examples below. The existence of a Krausz decomposition is utilized in a linear-time algorithm to recognize line graphs by Roussopoulos [35], though the earliest such algorithm for line-graph recognition was given by Lehot [36]. A dynamic solution was later given by Degiorgi and Simon [37]. These algorithms are optimal and constructive, and so can be applied to a given spin model to provide an exact free-fermion solution.
We next turn to the hereditary property of line graphs, for which we require the following definition: An induced subgraph of G can be constructed by removing the subset of vertices V /V from G, together with all edges incident to any vertex in this subset. Line graphs are a hereditary class of graphs in the sense that any induced subgraph of a line graph is also a line graph. This coincides with our intuition that removing a term from a free-fermion Hamiltonian does not change its free-fermion solvability. Conversely, Hamiltonians for which no free-fermion solution exists are accompanied by "pathological" structures in their frustration graphs, which obstruct a free-fermion description no matter how we try to impose one. This is captured by the forbidden subgraph characterization of Beineke [44] and later refined by others [45,46]. Table 2, (a) (d) (e), as an induced subgraph.

Corollary 1.1 (Beineke no-go theorem). A given spin Hamiltonian H has a free-fermion solution if and only if its frustration graph G(H) does not contain any of nine forbidden subgraphs, shown in
These forbidden subgraphs above can be interpreted as collections of "frustrating" terms. At least one of the terms must be assigned to a fermion interaction in every possible assignment from Pauli operators to fermions. Correspondingly, ignoring these terms by removing their corresponding vertices from the frustration graph may remove a forbidden subgraph and cause the Hamiltonian to become solvable. The terms   [44]. Of these nine graphs, the three in (a) contain twin vertices, highlighted. If these three graphs are induced subgraphs of a frustration graph such that these highlighted vertices are twins in the larger graph, then the twins can be removed by restricting onto a fixed mutual eigenspace of their products, which correspond to constants of motion of the Hamiltonian. (b) The twin-free restrictions of the graphs in (a), with all but one highlighted vertex from (a) removed. These graphs are the line graphs of the graphs in (c). In Ref. [45], it was shown that only five graphs contain the forbidden subgraphs in (e) and none of those in (a) or (d). Finally, this set was further refined in Ref. [46] to a set of three forbidden subgraphs for 3-connected line graphs of minimum degree at least seven, though we do not display these graphs here.
which we need to remove in this way need not be unique. In the next section, we discuss one such strategy for removing vertices such that our solution will remain faithful to the original spin Hamiltonian by exploiting symmetries.

Symmetries
An important class of symmetries involves twin vertices in the frustration graph.

Definition 4 (Twin Vertices). Given a graph
Twin vertices have exactly the same neighborhood, and are thus never neighbors in a frustration graph, which contains no self edges due to the fact that every operator commutes with itself. Sets of twin vertices are the subject of our first lemma.

Lemma 1 (Twin vertices are constants of motion).
Suppose a pair of terms σ j and σ k in H correspond to twin vertices in G(H), then the product σ j σ k is a nontrivial Pauli operator commuting with every term in the Hamiltonian. Distinct such products therefore commute with each other.
Proof. The statement follows straightforwardly from the definition of twin vertices: every term in H (including σ j and σ k themselves) either commutes with both σ j and σ k or anticommutes with both of these operators. Terms in H therefore always commute with the product σ j σ k . This product is furthermore a nontrivial Pauli operator, for if σ j σ k = I, then j = k, and we would not identify these Paulis with distinct vertices in G(H). Constants of motion generated this way must commute with one another, since they commute with every term in the Hamiltonian and are themselves products of Hamiltonian terms. They therefore generate an abelian subgroup of the symmetry group of the Hamiltonian.
Let the symmetry subgroup generated by products of twin vertices in this way be denoted S. We can leverage these symmetries to remove twin vertices from the frustration graph G(H). To do this, choose a minimal generating set {σ s } of Pauli operators for S and choose a ±1 eigenspace for each. Let (−1) xs be the eigenvalue associated to the generator σ s ∈ S, for x s ∈ {0, 1}. We restrict to the subspace defined as the mutual +1 eigenspace of the stabilizer group For a pair of twin vertices corresponding to Hamiltonian terms σ j and σ k , we let where d j,k ∈ {0, 1} specifies the appropriate sign factor, and S j,k is the subset of generators of S such that where "⊕" denotes addition modulo 2 here. In the stabilizer subspace of S x , we can make the substitution (29) effectively removing the vertex k from G(H).
Twin vertices capture the cases where a freefermion solution for H exists, but is necessarily noninjective. Indeed, note that we are careful in our statement of Theorem 1 to specify that our condition Eq. (25) is necessary and sufficient when φ is injective. If we instead relax our requirement that vertices of a line graph correspond to distinct subsets of size two in our earlier discussion of intersection graphs, then we are allowing for line graphs of graphs with multiple edges, or multigraphs. However, our definition of G( H) will differ from the line graph of a multigraph for pairs of vertices corresponding to identical edges, which must be adjacent in the line graph of a multigraph, but will be nonadjacent in G( H) from Eq. (23). Such vertices will nevertheless be twin vertices in G( H) due to the graph-isomorphism constraint, Eq. (22). Therefore, if no injective mapping φ satisfying Theorem 1 exists, a many-to-one freefermion solution exists only when twin vertices are present. Lemma 1 allows us to deal with this noninjective case by removing twin vertices until we obtain the line graph of a simple graph when possible. The particular way we choose to perform this removal cannot affect the overall solvability of the model, since the frustration graph with all twin vertices removed is an induced subgraph of any frustration graph with only a proper subset of such vertices removed. A model which is solvable by free fermions this way is therefore solvable in all of its symmetry sectors.
Finally, we can see when a non-injective freefermion solution may be possible from the forbidden subgraph characterization, Corollary 1.1. As seen in Table 2, some of the forbidden subgraphs shown in (a) themselves contain twin vertices. If these forbidden subgraphs are connected to the global frustration graph such that their twin vertices remain twins in the larger graph, then they may be removed, possibly allowing for a solution of the full Hamiltonian by free fermions. When the twins are removed from the forbidden subgraphs, they become line graphs as shown in Table 2 (b) and (c). An example of a model which can be solved this way is the Heisenberg-Ising model introduced in Ref. [1].
We next proceed to identify the remaining Pauli symmetries for a Hamiltonian satisfying Theorem 1. For this, we invoke the natural partition of the Pauli group P into the subgroup P H , again defined as that generated by Hamiltonian terms {σ j } j∈V , and the Pauli operators outside this subgroup, P ⊥ ≡ P/P H . Note that the latter set does not form a group in general, as for example, single-qubit Paulis may be outside of P H yet may be multiplied to operators in P H .
A subgroup of the symmetries of the Hamiltonian is the center Z(P H ) of P H , the set of n-qubit Pauli operators in P H which commute with every element of P H and therefore with every term in the Hamiltonian. To characterize this group, we need two more definitions.

Definition 5 (Cycle subgroup). A cycle of a graph
Since which commutes with every term in the Hamiltonian since each term is quadratic in the Majorana modes. The phase factor is chosen such that P is Hermitian. Here, we define this operator in terms of Pauli Hamiltonian terms through a combinatorial structure known as a T-join.

Definition 6 (Parity operator).
A T-join of a graph G ≡ (V, E) is a subset of edges, T ⊆ E, such that an odd number of edges from T is incident to every vertex in V . If a Pauli Hamiltonian satisfies Eq. (25) for some root graph R such that the number of vertices in R is even, we define the parity operator as where the product is taken over a T-join of R, and d ∈ {0, 1, 2, 3} specifies the phase necessary to agree with Eq. (32).
Here we have since every fermion mode will be hit an odd number of times in the T-join. Unlike with the cycle subgroup, P is never proportional to the identity in the fermion description, though it may still be proportional to the identity in the Pauli description (up to stabilizer equivalences). In this case, only solutions for the free-fermion Hamiltonian in a fixed-parity subspace will be physical. We will see several examples of this in the next section. When no T-join exists, we cannot form P as a product of Hamiltonian terms. In fact, P ∈ Z(P H ) only when | V | is even. Now with these definitions in hand, we are ready to state our second theorem.
Theorem 2 (Symmetries are cycles and parity). Given a Hamiltonian satisfying Eq. (25) such that the number of vertices | V | in the root graph is odd, then we have If the number of vertices in the root graph is even, then we have The proof of Theorem 2 can be found in Section 6.2.
The Pauli symmetries of the Hamiltonian outside of Z(P H ) may be thought of as "logical" or "gauge" qubits, and this characterization allows for a simple accounting of these qubits. Suppose we express a spin Hamiltonian H on n qubits as a free-fermion Hamiltonian on the hopping graph R = ( V , E), and let |Z(P H )| be the number of independent generators of Z(P H ). The number of logical qubits n L of the model is given by This follows from the fact that the rank of the adjacency matrix of G(H) is twice the number of logical qubits in the model, and also the number of vertices of the root graph R. Finally, we note that there may be additional symmetries, such as translation invariance, if the coefficients h j themselves satisfy a symmetry. Our characterization will allow us to say something about this situation when the associated symmetry transformation is a Clifford operator-that is, a unitary operator in the normalizer of the Pauli group-commuting with the Pauli symmetries in Z(P H ), such as, e.g., a spatial translation. The following statement follows from a theorem by Whitney [42] (and extended to infinite graphs in [50]). fixed symmetry sector of Z(P H ). Then any unitary Clifford symmetry U such that U † HU = H induces a signed permutation symmetry u such that h = u T · h · u, except for when U induces one of the three edge isomorphisms shown in Table 3.

R L(R)
Proof. This follows from the Whitney isomorphism theorem: except for the three cases shown in Table 3, any adjacency-preserving permutation of the vertices of G( H) is induced by an adjacency-preserving permutation of the vertices of R. A Clifford symmetry U acts as a signed permutation of the Hamiltonian terms which preserves H. Suppose the associated unsigned permutation is not one of the exceptional cases, and so is induced by a permutation π on the vertices of R. This gives where x j ∈ {0, 1} designates the sign associated to the permutation of vertex j ∈ V . By unitarity, this sign must depend on j alone, since U † c j U can only depend on j. Let u be a single-particle transition matrix defined as Then we can reinterpret Eq. (40) in the single-particle picture as By linear independence, Eq. (42) therefore implies and the claim follows.
See section 5.1 for a simple example of an exceptional Hamiltonian realizing a frustration graph shown in Table 3. We now complete our characterization of free-fermion solutions by choosing an orientation for every edge in the root graph over a restricted subspace determined by the constants of motion.

Orientation and Full Solution
As discussed previously, the Lie-homomorphism condition Eq. (21) does not fully constrain the freefermion solution of a given Pauli Hamiltonian. This is because we are free to choose a direction to each edge in the root graph by exchanging φ 1 (j) ↔ φ 2 (j), which is equivalent to changing the sign of the term ic φ1(j) c φ2 (j) in H corresponding to σ j in H. A related ambiguity corresponds to the cycle symmetry subgroup Z H : we are free to choose a symmetry sector over which to solve the Hamiltonian H by choosing a mutual ±1-eigenspace of independent nontrivial generators of this group. It will turn out that both ambiguities are resolved simultaneously.
First suppose we have a Hamiltonian H satisfying Eq. (25) for some root graph R ≡ ( V , E). Construct a spanning tree Υ ≡ ( V , E ) of R, defined as: Definition 7 (Spanning Tree). Given a connected graph G ≡ (V, E), a spanning tree Υ ≡ (V, E ) ⊆ G is a connected subgraph of G such that E contains no cycles.
This can be performed in linear time in | V |. Designate a particular vertex v ∈ V as the root of this tree. Each vertex u ∈ V has a unique path p(u, v) ⊆ E in Υ to the root, the path p(v, v) being empty. Choose an arbitrary direction for each edge in E (we will see shortly to what extent this choice is important).
Our choice of spanning tree determines a basis of fundamental cycles for the binary cycle space of R and thus a generating set of Paulis for the cycle subgroup Z H . To see this, note that for each edge φ(j) ∈ E/ E , there is a unique cycle of R given by Let σ y(j) be the cycle subgroup generator associated to Y j , defined by (45) such that where d ∈ {0, 1, 2, 3} again designates the appropriate phase. The set of such Y j contains | E| − | V | + 1 cycles and forms an independent generating set for all the cycles of R under symmetric difference. The corresponding set of σ y(j) is therefore an independent generating set of the cycle subgroup up to signs, since individual Pauli operators either commute or anticommute and square to the identity. In a similar fashion as with twin-vertex symmetries, we restrict to a mutual ±1 eigenspace of the cycle-subgroup generators, designated by a binary string x ∈ {0, 1} ×| E|+| V |+1 over the j such that φ(j) ∈ E/ E . That is, we restrict to the mutual +1 eigenspace of the stabilizer group If Eq. (45) gives y(j) = 0 for any j, then we take the corresponding x j = 0. We then simply choose the direction for the edge φ(j) such that where d is as defined in Eq. (46). This ensures that the product of Majorana hopping terms around a fundamental cycle Y j agrees with the corresponding Pauli product over the restricted subspace (i.e. up to equivalencies by stabilizers in the group Z H,x ). By the Lie-homomorphism constraint Eq. (21), all products of Majorana hopping terms around a cycle of R therefore agree with their corresponding Pauli products over this subspace, and so the multiplication relations of the Paulis are respected by their associated fermion hopping terms up to stabilizer equivalencies. Since we have exactly as many elements Y j in our fundamental cycle basis as undirected edges φ(j), such an orientation can always be chosen. Why are we free then, to choose an arbitrary sign for each free-fermion term in our original spanning tree? This choice is actually equivalent to a choice of signs on the definitions of the individual Majorana modes themselves and so amounts to a choice of orientation for the coordinate basis in which we write h. To see this, choose a fiducial orientation for R satisfying Eq. (48), and suppose our particular freefermion solution-not necessarily oriented this waycorresponds to the mapping Table 4: (Left) Fermionization of the two-qubit Pauli algebra P2 = {σ i 1 ⊗ σ j 2 } (i,j) =(0,0) by six fermion modes. The graph isomorphism G(P2) L(K6) reflects the Lie-algebra isomorphism between su(4) and spin (6). Though the scalar-commutation relations are reproduced by quadratics in {cµ} 6 µ=1 , the one-sided multiplication relations are only recovered upon projecting onto the +1 eigenspace of P ≡ ic1c2c3c4c5c6 on the fermion side of the mapping. (Right) The graph L(K6), with vertices labeled by a particular satisfying Pauli assignment. Edges are colored to identify the six K5 subgraphs in the Krausz decomposition of this graph, corresponding to the six fermion modes. Each vertex belongs to exactly two such subgraphs, as must be the case for a line graph. This graphical correspondence was first observed in Ref. [43] in the language of the Dirac algebra.
for φ(j) ∈ E and with x j ∈ {0, 1} designating the edge-direction of φ(j) relative to the fiducial orientation. We have where Since the symmetric difference of p[φ 1 (j) , v] and p[φ 2 (j), v] is the edge φ(j) ∈ E , all sign factors on the right side of Eq. (50) cancel except for (−1) x j . We can then absorb (−1) r φ 1 (j) and (−1) r φ 2 (j) onto the definitions of c φ1(j) and c φ2(j) , respectively. We furthermore see that imposing Eq. (48) gives an edgedirection for φ(j) ∈ E/ E that differs from that of the fiducial orientation by the associated sign factor (−1) r φ 1 (j) +r φ 2 (j) , which remains consistent with a redefinition of the signs on the individual Majorana modes. Letting h be the single-particle Hamiltonian for the fiducial orientation, such a redefinition corresponds to conjugating h by a ±1 diagonal matrix. As no scalar quantity of h can depend on this choice, this redefinition corresponds to a gauge freedom. Proceeding this way, we can solve the effective sector-by-sector over each stabilizer eigenspace designated by x. If we also need to remove twin vertices from G(H) before it is a line graph, we project onto the mutual +1 eigenspace of the stabilizer group S x defined previously in Section 4 as well. Finally, if the parity operator P is trivial in the Pauli description, then only a fixed-parity eigenspace in the fermion description will be physical.
In the next section, we will see how known freefermion solutions fit into this characterization and demonstrate how our method can be used to find new free-fermion solvable models, for which we give an example.

Small Systems
The frustration graph of single-qubit Paulis X, Y, Z is K 3 , the complete graph on three vertices. This graph is the line graph of not one, but two non-isomorphic graphs: the so-called 'claw' graph K 1,3 , and K 3 itself (see Table 1). By the Whitney isomorphism theorem [42], K 3 is the only graph which is not the line graph of a unique graph. This ambiguity results in the existence of two distinct free-fermion solutions of a single qubit Hamiltonian, which we will hereafter refer to as "even" (labeled "0") and "odd" (labeled "1") fermionizations In the even fermionization, no T-join of the root graph K 3 exists since there are only three fermion modes {c 0 , c 1 , c 2 }. The orientation of the root graph is constrained by the identity XY Z = iI. In the odd fermionization, there are four fermion modes {c 0 , c 1 , c 2 , c 3 }, and so a T-join does exist for the root graph K 1,3 . It is the set of all edges of this graph. The parity operator is trivial in the Pauli description however, and so the constraint XY Z = iI is enforced by restricting to the +1 eigenspace of P ≡ −c 0 c 1 c 2 c 3 in the fermion description. We are free to choose the orientation of the root graph K 1,3 however we like in this case, since it contains no cycles, though this choice will affect what we call the physical eigenspace of P . By virtue of the line-graph construction and our choice of orientation, both fermionizations respect the single-qubit Pauli multiplication relations, up to stabilizer equivalencies in some cases.
We have made the choice to label the Paulis in the two fermionizations in a compatible way, such that This gives where m ∈ {0, 1} and ε is the Levi-Civita tensor.
Since an even number of parity-operator factors appear on the left side of Eq. (55), the commutator between two Paulis in either fermionization is always a Pauli in the even fermionization. We can additionally write multiplication relations between the two fermionizations concisely, as Another exceptional situation arises for 2 qubits, for which the full frustration graph is the line graph of K 6 , again depicted graphically in Table 1. This reveals a free-fermion solution for all 2-qubit Hamiltonians by six fermion modes, listed explicitly in Table 4. We again choose our orientation by picking a spanning tree of the root graph (for example all terms containing the mode c 5 ), choosing an arbitrary orientation on this tree, and choosing the remaining orientations by enforcing the condition in Eq. (48). Since K 6 has an even number of vertices, there exists a T-join for this graph, e.g. the terms {XX, Y Y, ZZ}. The associated parity operator is trivial however, as (XX)(Y Y )(ZZ) = −I, and so only the +1 eigenspace of P in the fermion description will be physical. This solution reflects the exceptional Lie algebra isomorphism, su(4) spin (6).
Finally, we give an example of a three-qubit Hamiltonian with an exceptional symmetry, namely This Hamiltonian has the frustration graph shown in the top right entry of Table 3, and thus is an exceptional case to Corollary 1.2. A symmetry transformation exchanging e and e for this Hamiltonian is the Hadamard gate applied to the second and third qubits, which exchanges the third and fourth terms, but cannot be realized as any permutation of the individual Majorana modes in its free-fermion description.

1-dimensional chains
Shown in Figure 1 Cliques are colored according to the Krausz decomposition of this graph, which is easily seen by the freefermion description. The fermion hopping graph, R, is shown below. Note that the cycle symmetry subgroup Z H for this model is trivial, as every product of Hamiltonian terms along a cycle in R is the identity. Since the number of vertices in R is even, a T-join does exist, and the parity operator is in-fact P = Z ⊗n . Therefore, we have |Z(P H )| = 1.
An example spanning tree for the root graph is highlighted, taken simply to be the path along edges (j, j +1) from c 1 to c 2n . Including any additional edge in this tree will form a cycle. A natural orientation for this tree is to direct every edge from vertex j +1 to vertex j. Note that we can recover the Jordan-Wigner transformation from this graphical description alone. We first adjoin a single fictitious qubit and a single coupling term to the Hamiltonian, as Since the remaining qubits only couple to qubit "0" along the X-direction, all operators in P H commute on this qubit. Furthermore, this new term adds one vertex to the black clique at left boundary of the chain in Fig. 1. It thus extends the spanning tree of R by one vertex -which we label c 0 -due to the fact that this new term only belongs to one clique (so we take its additional Majorana mode to be a clique of size zero). It can be easily verified that products of Hamiltonian terms from this new vertex to any vertex along the chosen spanning tree have the form All such operators share c 0 , so their commutation relations are unchanged by truncating c 0 . Furthermore, since all operators in P H commute on qubit-0, we may truncate this qubit as well without changing the commutation relations of the operators above to obtain the Jordan-Wigner transformation In principle, a similar trick would work in general, but we find it generally simpler to define Majorana quadratic operators to avoid truncating at a boundary. Finally, we see that this model contains no logical qubits via as we might expect.

The Kitaev honeycomb model
Next we consider the Kitaev honeycomb model in two dimensions [9]. This model has the Hamiltonian H = α∈{x,y,z} α−links j J j α σ α j σ α j+α (63) where each of the α links correspond to one of the compass directions of the edges of a honeycomb lattice. Once again, the frustration graph with shaded cliques according to the Krausz decomposition is shown in Fig.2. Interestingly, the root graph of this model's frustration graph is again the honeycomb lattice. By going backwards, we can see that indeed, any free-fermion model with trivalent hopping graph can be embedded in a 2-body qubit Hamiltonian with the same interaction graph. This is because we can find a set of Pauli operators satisfying any frustration graph whose edges can be partitioned into triangles by assigning a different single-qubit Pauli to each of the vertices of every triangle. A term in the Hamiltonian is then the tensor product of all of the Pauli operators from the triangles to which its vertex in G(H) belongs. Unlike in the one-dimensional example, the cycle subgroup of this model, Z H , is nontrivial. This subgroup is generated by the products of Hamiltonian terms around a hexagonal plaquette of the honeycomb lattice, denoted W p for plaquette p. These cycles are not independent, however, with constraints between In this case, the cycles of the honeycomb lattice are not independent, since they similarly multiply to the identity. There are thus L x L y − 1 independent plaquettes on the lattice. There are additionally two homotopically nontrivial cycles, which are independent as well. Notice that the edges of the honeycomb lattice itself form a T-join, and so the above constraint is also the statement that P is furthermore trivial. Therefore, we have |Z(P H )| = L x L y − 1 + 2 = L x L y + 1 (65) and once again (as first computed in Ref. [51]) This example also illustrates that quite a large number of symmetries could be present, and in general this will complicate finding, e.g., the symmetry sector that contains the ground state.

Frustrated Hexagonal Gauge 3D Color Code
The frustrated hexagonal gauge 3d color code is a noncommuting Hamiltonian whose terms consist of the stabilizer generators and a subset of the gauge generators from the gauge color code. The gauge color code [52][53][54][55] has a Hamiltonian that is defined in terms of a natural set of gauge generators as where " " and " " denote the sets of square and hexagonal faces on the lattice in Fig. 3, respectively (see Ref. [56] for a detailed description of this lattice).
Here the qubits live on the vertices of the lattice. Nontrivial boundary conditions are required to restrict the logical space of this code to a single qubit. We will ignore these boundary conditions and consider only gauge generators in the bulk of the lattice. The stabilizers for this model are given by products of X or Z around every elementary cell, either a cube or a "ball". We consider a model where we partially restore some of these symmetries. Namely, we will consider the cube and balls to be "restored" symmetries of the model, and we will remove the square generators. This leads to the following gauge Hamiltonian that sums over only hexagonal faces, balls, and cubes, The cube and ball terms commute with all of the hexagon terms, and so constitute symmetries of the model. Once we fix a sector for these terms, we can solve the remaining model by mapping to freefermions as follows [41].
In Figure 3, we represent a subsection of the qubit lattice of this code, where qubits live at the tetravalent vertices. Because the cube and ball terms commute with everything, the frustration graph depends only  [41]. This model is based on the 3d gauge color code, whose qubits live on the vertices of the lattice shown. Gauge generators for the 3d gauge color code consist of Pauli-Z and Pauli-X operators around both the square and hexagonal faces of the lattice. Stabilizers of of the 3d gauge color code consist of Pauli-Z and Pauli-X operators on both the cube and "ball" cells. The frustrated hexagonal gauge 3D color code is given by taking the stabilizers of the gauge color code together with the hexagonal gauge generators, which commute with the stabilizers, but not with each other. We see from the colored hexagonal faces above that the frustration graph of these gauge generators is a set of disconnected path graphs. Every hexagonal plaquette term anticommutes with exactly two others-the plaquette terms of the other Pauli type intersecting it at exactly one qubit-and commutes with all other terms in the Hamiltonian.
on the hexagonal faces, several of which are colored in Figure 3. We see that some of these faces intersect at exactly one vertex, and so the X-and Z-type gauge generators will anticommute on the associated qubit. These intersection patterns only occur in 1D chains along the cardinal axes of the lattice. In particular, every hexagonal face only overlaps with two other hexagonal faces along these chains and otherwise intersects the other faces at an even number of qubits. The frustration graph of this model thus decouples into a set of disconnected paths, which are line graphs, and in fact they are the frustration graph of the XY-model [1] and the 1-d Kitaev wire [57]. A free-fermion mapping therefore exists for this model, and this demonstrates an example of how one might construct subsystem codes with a free-fermion solution to obtain desired spectral properties. In particular, when |J x | = |J z | the model in Eq. (68) is gapped. We note that this observation was made previously in Ref. [41] in the context of quantum error correcting codes.

Sierpinski-Hanoi model
Finally, we introduce our own example of a solvable spin model, which was previously unknown to the best of our knowledge. This model consists of 3body XY Z-interaction terms on the shaded cells of the Sierpinski triangle, all with the same orientation, as depicted in Fig. 4. Explicitly, the Hamiltonian for this model is given by where (i, j, k) is an ordered triple of qubits belonging to a particular shaded cell on the lattice and we will define additional on-site terms H local in Eq. (74).
An instance of the model is parameterized by k, the fractal recursion depth of the underlying Sierpinski lattice, where k = 1 is taken to be a single 3-qubit interaction.
Let us first consider the simplified model where J = 0. Then the frustration graph of this model is the socalled Hanoi graph H k−1 3 . The vertices of this graph are labeled by states of the towers of Hanoi problem with k − 1 discs, and two vertices are neighboring if transitioning between the corresponding states is an allowed move in the problem. Perhaps surprisingly, this graph is a line graph, with root and highlighted spanning tree shown in Fig. 4. Furthermore, the root graph contains H k−2 3 as a topological minor, obtained by removing the vertices of degree one and contracting the vertices of degree two each along one of their two edges.
This model contains physical qubits, and its root graph contains vertices. A T-join for this graph therefore exists only for even k and k = 1, and the parity operator is never trivial when a T-join exists. The root graph also contains fundamental cycles. None of the generators of the cycle subgroup are trivial since every qubit is acted upon by at most two anti-commuting operators. The number of logical qubits in this model is therefore and so this Hamiltonian encodes logical qubits at a constant rate of 11 18 in the infinite k limit. Perhaps unsurprisingly, these logical qubits live on the boundaries of the fractal, and we can obtain a set of generators for the logical Pauli group of this model as shown in Fig. 4. We can encode logical quantum information in this model by picking symplectic pairs of generators from this group, which anticommute with one another yet commute with the remaining generators in the group. The remaining such generators can be used as gauge qubits for the logical qubit we wish to protect, and the free-fermion Hamiltonian of the model can be used for error suppression.
We are also free to add an anisotropic local-field term to a subset of the qubits without breaking solvability The sum is taken over all qubits corresponding to black edges connecting two shaded cells in Fig. 4. j i is the third Pauli type from the two Paulis acting on qubit i by the interaction terms. The effect of these local-field terms is to couple every black vertex in the root graph shown in Fig. 4, except for those at the three corners, to a dedicated fermion mode. We do not depict these additional modes to avoid cluttering the figure. These terms also do not affect the symmetries of the model, except possibly to add the parity operator to Z(P H ) when the number of vertices in the original graph was odd, as the number of vertices in the graph with local field terms present will always be even. The parity operator can then be constructed as the product of all of the Hamiltonian terms, since the root graph only has vertices of degrees 1 and 3.
In Fig. 5, we display the single-particle spectrum of the Sierpinski-Hanoi model as a function of the local field J for k = 5 in the sector for which all of the cycle symmetries are in their mutual +1 eigenspace. We highlight two critical points where excited energy levels become degenerate to within our numerical precision. We observe that the locations of these points are not system-size-independent, but rather asymptotically approach J = 0 as the system size is increased. We conjecture that this is connected to the emergence of scale symmetry, which the model possesses in the thermodynamic limit, yet not for any finite size. It would be intriguing if certain physical features of this symmetry could be realized at the critical points at finite size, potentially opening the door to simulating scale-invariant systems on a finite-sized quantum computer.
where R is the hopping graph of the free-fermion solution.
If there exists a graph R ≡ (V, E) such that G L(R), take the Krausz decomposition of G(H). Namely, partition the edges of G(H) as F = {C 1 , . . . , C |V | }, where each C i constitutes a clique in G and such that every vertex in G appears in at most two C i . The cliques in this partitioning correspond to the vertices V of R. For each vertex j, define φ(j) to be the pair of cliques in which j appears. Since the cliques partition the edges of G, then if vertices j and k are neighboring in G, they must appear in exactly one clique together, and thus |(φ 1 (j), φ 2 (j)) ∩ (φ 1 (k), φ 2 (k))| = 1. Thus, φ satisfies Eq. (21). Furthermore, φ is injective, since if there are two vertices j, k ∈ G such that φ(j) = φ(k), then j and k appear in the same two cliques, but since the Krausz decomposition is a partition of the edges, this would require that j and k neighbor by two edges. However, the definition of G guarantees that pairs of vertices can only neighbor by at most one edge, and so this is impossible. Therefore φ is injective.

Proof of Theorem 2
Once again, we restate our theorem for convenience quantum computation. We expect our characterization to shed some light on the inverse problem of finding fermion-to-qubit mappings, such as the Bravyi-Kitaev superfast encoding [59], Bravyi-Kitaev transform [60], and generalized superfast encoding [61]. It is possible to achieve further encodings by introducing ancillary fermion modes, as seen in the Verstraete-Cirac mapping [7] and the contemporaneous mapping introduced by Ball [62]. Encodings can be further improved through tailoring to specific symmetries [63], connectivity structures [64,65], and through the application of Fenwick trees [66]. Recently, a treelike mapping was shown to achieve optimal average-case Pauli-weight in Ref [67]. In their "Discussion" section, the authors remark that an interesting future direction for their work would involve introducing ancillary qubits to their mapping. We expect our classification of the symmetries of free-fermion spin models to help guide this investigation, though further work is required to fully characterize the logical symmetry groups which can be realized by these models. Finally, our characterization highlights the possibility of a "free-fermion rank" for Hamiltonians as an important measure of classical simulability. Namely, if there is no free-fermion solution for a given Hamiltonian, we can still group terms into collections such that each collection independently has such a solution. An interesting natural question for future work is whether the minimal number of such collections required can be interpreted as a quantum resource in an analogous way to the fermionic Gaussian rank [68] or stabilizer rank [69] for states.