# Simulating Quantum Computations with Tutte Polynomials

We establish a classical heuristic algorithm for exactly computing quantum probability amplitudes. Our algorithm is based on mapping output probability amplitudes of quantum circuits to evaluations of the Tutte polynomial of graphic matroids. The algorithm evaluates the Tutte polynomial recursively using the deletion-contraction property while attempting to exploit structural properties of the matroid. We consider several variations of our algorithm and present experimental results comparing their performance on two classes of random quantum circuits. Further, we obtain an explicit form for Clifford circuit amplitudes in terms of matroid invariants and an alternative efficient classical algorithm for computing the output probability amplitudes of Clifford circuits.

## Authors

• 5 publications
• ### Pseudo-dimension of quantum circuits

We characterize the expressive power of quantum circuits with the pseudo...
02/04/2020 ∙ by Matthias C. Caro, et al. ∙ 0

• ### Classically Simulating Quantum Circuits with Local Depolarizing Noise

We study the effect of noise on the classical simulatability of quantum ...
01/23/2020 ∙ by Yasuhiro Takahashi, et al. ∙ 0

• ### Efficient classical simulation of Clifford circuits with nonstabilizer input states

We investigate the problem of evaluating the output probabilities of Cli...
02/28/2019 ∙ by Kaifeng Bu, et al. ∙ 0

• ### On the Complexity of Random Quantum Computations and the Jones Polynomial

There is a natural relationship between Jones polynomials and quantum co...
11/02/2017 ∙ by Ryan L. Mann, et al. ∙ 0

• ### Probabilistic Modeling with Matrix Product States

Inspired by the possibility that generative models based on quantum circ...
02/19/2019 ∙ by James Stokes, et al. ∙ 0

• ### Multi-objective evolutionary algorithms for quantum circuit discovery

Quantum hardware continues to advance, yet finding new quantum algorithm...
12/11/2018 ∙ by Václav Potoček, et al. ∙ 0

• ### On the classical complexity of quantum interference of indistinguishable bosons

The classical complexity of sampling from the probability distribution o...
04/03/2019 ∙ by Valery Shchesnovich, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## I Introduction

There is a natural relationship between quantum computation and evaluations of Tutte polynomials [1, 2]. In particular, quantum probability amplitudes are proportional to evaluations of the Tutte polynomial of graphic matroids. In this paper we use this relationship to establish a classical heuristic algorithm for exactly computing quantum probability amplitudes. While this problem is known to be #P-hard in general [3], our algorithm focuses on exploiting structural properties of an instance to achieve an improved runtime over traditional methods. Previously it was known that this problem can be solved in time exponential in the treewidth of the underlying graph [4].

The basis of our algorithm is a mapping between output probability amplitudes of quantum circuits and evaluations of the Tutte polynomial of graphic matroids [5, 2, 6]. Our algorithm proceeds to evaluate the Tutte polynomial recursively using the deletion-contraction property. At each step in the recursion, our algorithm computes certain structural properties of the matroid in order to attempt to prune the computational tree. This approach to computing Tutte polynomials was first studied by Haggard, Pearce, and Royle [7]. Our algorithm can be seen as an adaption of their work to special points of the Tutte plane where we can exploit additional structural properties.

The performance of algorithms for computing Tutte polynomials based on the deletion-contraction property depends on the heuristic used to decide the ordering of the recursion [8, 7, 9]. We consider several heuristics introduced by Pearce, Haggard, and Royle [8] and a new heuristic, which is specific to our algorithm. We present some experimental results comparing the performance of these heuristics on two classes of random quantum circuits corresponding to dense and sparse instances.

The correspondence between output probability amplitudes of quantum circuits and evaluations of Tutte polynomials also allows us to obtain an explicit form for Clifford circuit amplitudes in terms of matroid invariants by a theorem of Pendavingh [10]. This gives rise to an alternative efficient classical algorithm for computing output probability amplitudes of Clifford circuits.

This paper is structured as follows. We introduce matroid theory in Section II and the Tutte polynomial in Section III. In Sections IV, V, and VI, we establish a mapping between output probability amplitudes of quantum circuits and evaluations of the Tutte polynomial of graphic matroids. This is achieved by introducing the Potts model partition function in Section IV, Instantaneous Quantum Polynomial-time circuits in Section V, and a class of universal quantum circuits in Section VI. In Section VII, we use this mapping to obtain an explicit form for Clifford circuit amplitudes in terms of matroid invariants. We also obtain an efficient classical algorithm for computing the output probability amplitudes of Clifford circuits. We describe our algorithm in Section VIII and present some experimental results in Section IX. Finally, we conclude in Section X.

## Ii Matroid Theory

We shall now briefly introduce the theory of matroids. The interested reader is referred to the classic textbooks of Welsh [11] and Oxley [12] for a detailed treatment. Matroids were introduced by Whitney [13] as a structure that generalises the notion of linear dependence. There are many equivalent ways to define a matroid. We shall define a matroid by the independence axioms. [Matroid] A matroid is a pair consisting of a finite set , known as the ground set, and a collection of subsets of , known as the independent sets, such that the following axioms are satisfied.

1. The empty set is a member of .

2. Every subset of a member of is a member of .

3. If and are members of and , then there exists an such that is a member of .

The rank of a subset of is given by the rank function of the matroid defined by . The rank of a matroid , denoted , is the rank of the set .

The archetypal class of matroids are vector matroids

. A vector matroid

is a matroid whose ground set is a subset of a vector space over a field and whose independent sets are the linearly independent subsets of . The rank of a subset of a vector matroid is the dimension of the subspace spanned by the corresponding vectors. We say that a matroid is -representable if it is isomorphic to a vector matroid over the field . A matroid is a binary matroid if it is -representable and is a ternary matroid if it is -representable. A matroid that is representable over every field is called a regular matroid.

Every finite graph induces a matroid as follows. Let the ground set be the set of edges and let the independent sets be the subsets of that are a forest, i.e., they do not contain a simple cycle. It is easy to check that satisfies the independence axioms. The rank of a subset of a cycle matroid is , where denotes the number of connected components of the subgraph with edge set . The rank of the cycle matroid , denoted or simply , is the rank of the set . The matroid is called the cycle matroid of . We say that a matroid is graphic if it is isomorphic to the cycle matroid of a graph.

Graphic matroids are regular. To see this consider assigning to the graph an arbitrary orientation , that is, for each edge in , we choose one of and to be the positive end and the other one to be the negative end. Then construct the oriented incidence matrix of with respect to the orientation . [Oriented incidence matrix] Let be a graph and let be an orientation of . Then the oriented incidence matrix of with respect to is the matrix whose entries are

 (1)

The rows of the oriented incidence matrix correspond to the vertices of and the columns correspond to the edges of . Each column contains exactly one and exactly one representing the positive and negative ends of the corresponding edge. If the column space of is the ground set of a vector matroid, then it is easy to see that a subset is independent if and only if it is a forest in . Hence, the oriented incidence matrix provides a representation of a graphic matroid over every field.

A minor of a matroid is a matroid that is obtained from by a sequence of deletion and contraction operations. [Deletion] Let be a matroid and let be an element of the ground set. Then the deletion of with respect to is the matroid whose ground set is and whose independent sets are . The deletion of an element from the cycle matroid of a graph corresponds to removing an edge from the graph. [Contraction] Let be a matroid and let be an element of the ground set. Then the contraction of with respect to is the matroid whose ground set is and whose independent sets are . The contraction of an element from the cycle matroid of a graph corresponds to removing an edge from the graph and merging its two endpoints.

An element of a matroid is said to be a loop if is not an independent set and said to be a coloop if is contained in every maximally independent set. If an element of a matroid is either a loop or a coloop then the deletion and contraction of are equivalent.

## Iii The Tutte Polynomial

We shall now briefly introduce the Tutte polynomial, which is a well-known invariant in matroid and graph theory. [Tutte polynomial of a matroid] Let be a matroid with rank function . Then the Tutte polynomial of is the bivariate polynomial defined by

 T(M;x,y)\coloneqq∑A⊆S(x−1)r(M)−r(A)(y−1)\absA−r(A). (2)

The Tutte polynomial may also be defined recursively by the deletion-contraction property. [Deletion-contraction property] Let be a matroid. If is the empty matroid, i.e., , then

 T(M;x,y)=1. (3)

Otherwise, let be an element of the ground set. If is a loop, then

 T(M;x,y)=yT(M∖{e};x,y). (4)

If is a coloop, then

 T(M;x,y)=xT(M/{e};x,y). (5)

Finally, if is neither a loop nor a coloop, then

 T(M;x,y)=T(M∖{e};x,y)+T(M/{e};x,y). (6)

The deletion-contraction property immediately gives an algorithm for recursively computing the Tutte polynomial. This algorithm is in general inefficient, but the performance may be improved by using isomorphism testing to reduce the number of recursive calls [14]. The performance of this algorithm depends on the heuristic used to choose elements of the ground set [8, 7, 9]. Björklund et al. [15] showed that the Tutte polynomial can be computed in time exponential in the number of vertices.

The Tutte polynomial of a graph may be recovered by considering the Tutte polynomial of the cycle matroid of a graph and using the fact that the rank of a subset of a cycle matroid is , where denotes the number of connected components of the subgraph with edge set . [Tutte Polynomial of a graph] Let be a graph and let denote the number of connected components of the subgraph with edge set . Then the Tutte polynomial of is a polynomial in and , defined by

 T(G;x,y)\coloneqq∑A⊆E(x−1)κ(A)−κ(E)(y−1)κ(A)+\absA−\absV. (7)

The Tutte polynomial is trivial to evaluate along the hyperbola for any matroid. In the case of graphic matroids, Jaeger, Vertigan, and Welsh [16] showed that the Tutte polynomial is #P-hard to evaluate, except along this hyperbola and when equals one of nine special points. [Jaeger, Vertigan, and Welsh [16]] The problem of evaluating the Tutte polynomial of a graphic matroid at an algebraic point in the -plane is #P-hard except when or when equals one of , , , , , , , , or , where . In each of these exceptional cases the evaluation can be done in polynomial time. Vertigan [17] extended this result to vector matroids. [Vertigan [17]] The problem of evaluating the Tutte polynomial of a vector matroid over a field at an algebraic point in the -plane is #P-hard except when , equals , or when

1. and equals one of , , , , or ;

2. and equals one of or , where ; or

3. and equals .

In each of these exceptional cases, except when equals , the evaluation can be done in polynomial time. Snook [18] showed that when equals and is either a finite field of fixed characteristic or a fixed infinite field, then evaluating the Tutte polynomial is #P-hard. It is an open problem to understand the complexity of evaluating the Tutte polynomial at over any fixed field.

## Iv The Potts Model Partition Function

The Potts model is a statistical physical model described by an integer and a graph , with the vertices representing spins and the edges representing interactions between them. A set of edge weights characterise the interactions and a set of vertex weights characterise the external fields at each spin. A configuration of the model is an assignment of each spin to one of possible states. The Potts model partition function is defined as follows. [Potts model partition function] Let be an integer and let be a graph with the weights assigned to its edges and the weights assigned to its vertices. Then the -state Potts model partition function is defined by

 ZPotts(G;q,Ω,Υ)\coloneqq∑σ∈ZVqwG(σ), (8)

where

 wG(σ)=exp⎛⎝∑{u,v}∈Eω{u,v}δ(σu,σv)+∑v∈Vυvδ(σv)⎞⎠. (9)

The Potts model partition function with an external field is equivalent to the zero-field case on an augmented graph . To construct from , for each of the connected components of add a new vertex and for every vertex add an edge with the weight assigned to it. Then we have the following proposition. [restate=[name=restatement]PottsModelPartitionFunctionExternalField]

 ZPotts(G;q,Ω,Υ)=q−κ(E)ZPotts(G′;q,Ω∪Υ,0). (10)

A similar proposition appears in Welsh’s monograph [19]; we prove Proposition IV in Appendix A.

It will be convenient to consider the Potts model with weights that are all positive integer multiples of a complex number . We shall implement this model on the augmented graph with all weights equal to by replacing each edge with the appropriate number of parallel edges. Let us denote the partition function of this model by . Then, we have the following proposition relating the partition function of this model to the Tutte polynomial of the augmented graph .

 ZPotts(G′;q,θ)=qκ(E′)(eθ−1)r(G′)T(G′;x,y), (11)

where and . In particular, the -state Potts model partition function is related to the Tutte polynomial along the hyperbola . For a proof of Proposition IV, we refer the reader to Welsh’s monograph [19, Section 4.4].

The -state Potts model partition function specialises to the Ising model partition function. [Ising model partition function] Let be a graph with the weights assigned to its edges and the weights assigned to its vertices. Then the Ising model partition function is defined by

 ZIsing(G;Ω,Υ)\coloneqq∑σ∈{−1,+1}VwG(σ), (12)

where

 wG(σ)=exp⎛⎝∑{u,v}∈Eω{u,v}σuσv+∑v∈Vυvσv⎞⎠. (13)
 ZPotts(G;2,Ω,Υ)=wGZIsing(G;Ω2,Υ2), (14)

where .

###### Proof.

The proof follows from some simple algebra. ∎

## V Instantaneous Quantum Polynomial Time

We shall now briefly introduce the class of commuting quantum circuits, known as Instantaneous Quantum Polynomial-time (IQP) circuits [5]. These circuits exhibit many interesting mathematical properties. In particular, the output probability amplitudes of IQP circuits are proportional to evaluations of the Tutte polynomial of binary matroids [2]. IQP circuits comprise only gates that are diagonal in the Pauli-X basis and are described by an X-program. [X-program] An X-program is a pair , where is a binary matrix and is a real angle. The matrix is used to construct a Hamiltonian of commuting terms acting on qubits, where each term in the Hamiltonian is a product of Pauli-X operators,

 H(P,θ)\coloneqq−θm∑i=1n⨂j=1Xpijj. (15)

Thus, the columns of correspond to qubits and the rows of correspond to interactions in the Hamiltonian.

An X-program induces a probability distribution

known as an IQP distribution. [] For an X-program with , we define to be the probability distribution over binary strings , given by

 Pr[x]\coloneqq\absψ(P,θ)(x)2, (16)

where

 ψ(P,θ)(x)=⟨x|exp(−iH(P,θ))|0n⟩. (17)

The principal probability amplitude of an IQP distribution is directly related to an evaluation of the Tutte polynomial of the binary matroid whose ground set is the row space of . Let be an X-program with . Let be the binary matroid whose ground set is the row space of , then,

 ψ(P,θ)(0)=eiθ(r(M)−m)(isin(θ))r(M)T(M;x,y), (18)

where and . A similar result may be obtained for the other probability amplitudes. This can easily be seen when for , by firstly letting be the matrix obtained from by appending rows identical to , and then observing that . For a proof of Proposition V and a treatment of the general case, we refer the reader to Ref. [2, Section 3].

We shall consider X-programs that are induced by a weighted graph. [Graph-induced X-program] For a graph with the weights assigned to its edges and the weights assigned to its vertices, we define the X-program induced by to be an X-program such that

 HXG=−∑{u,v}∈Eω{u,v}XuXv−∑v∈VυvXv. (19)

Any X-program can be efficiently represented by a graph-induced X-program [5]. The principal probability amplitude of the IQP distribution generated by a graph-induced X-program is directly related to the Ising model partition function of the graph with imaginary weights. [restate=[name=restatement]IQPIsingModelPartitionFunctionRelation] Let be a graph with the weights assigned to its edges and the weights assigned to its vertices, then,

 ψXG(0\absV)=12\absVZIsing(G;iΩ,iΥ). (20)

Proposition 19 is well known [20, 21]; we provide a proof in Appendix B. It will be convenient to consider graph-induced X-programs with weights that are all positive integer multiples of a real angle . As in Section III, this model can be implemented on the augmented graph with all weights equal to by replacing each edge with the appropriate number of parallel edges. Let us denote the graph-induced X-program of this model by . Then, we have the following proposition. [restate=[name=restatement]IQPAugmentedGraphRelation]

 ψXG(θ)(0\absV)=ψXG′(θ)(0\absV′). (21)

We prove Proposition 20 in Appendix C. We also have the following proposition relating the principal probability amplitude to the Tutte polynomial of the augmented graph. [restate=[name=restatement]IQPAugmentedGraphTuttePolynomialRelation]

 ψXG′(θ)(0\absV′)=eiθ(r(G′)−\absE′)(isin(θ))r(G′)T(G′;x,y), (22)

where and . We prove Proposition 21 in Appendix D. Notice that if we let be the binary matroid whose ground set is the column space of the orientated incidence matrix of with an arbitrary orientation assigned to it, then we can use Proposition V to obtain Proposition 21.

## Vi Quantum Computation and the Tutte Polynomial

In this section we show that quantum probability amplitudes may be expressed in terms of the evaluation of a Tutte polynomial. We achieve this by showing that output probability amplitudes of a class of universal quantum circuits are proportional to the principal probability amplitude of some IQP circuit.

It will be convenient to define the following gate set. [] For a real angle , we define to be the gate set

 Gθ\coloneqq{H,eiθX,eiθXX}, (23)

where denotes the Hadamard gate. It is easy to see that the gate set generates the Clifford group and the gate set is universal for quantum computation.

In the IQP model it is easy to implement the gates and . So in order to implement the entire gate set , it remains to show that we can implement the Hadamard gate. This can be achieved by the use of postselection when for  [6]. To apply a Hadamard gate to the target state consider the following Hadamard gadget. Firstly introduce an ancilla qubit in the state and apply the gate to . Then measure qubit in the computational basis and postselect on an outcome of . The output state of this gadget is then .

We shall consider quantum circuits that comprise gates from the set for an integer . Let denote such a circuit that acts on qubits and comprises Hadamard gates. Further let denote the graph-induced X-program that implements the circuit by replacing each of the Hadamard gates with the Hadamard gadget. Then we have the following proposition.

 ⟨0n|Ck,n,m|0n⟩=√2mψXG(Ck,n,m)(0n+m). (24)
###### Proof.

The proof follows immediately from the application of the Hadamard gadgets. ∎

Any quantum amplitude may therefore be expressed as the evaluation of a Tutte polynomial by Proposition 20, Proposition 21, and Proposition VI.

## Vii Efficient Classical Simulation of Clifford Circuits

In this section we show how the correspondence between quantum computation and evaluations of the Tutte polynomial provides an explicit form for Clifford circuit amplitudes in terms of matroid invariants; namely, the bicycle dimension and Brown’s invariant. This gives rise to an efficient classical algorithm for computing the output probability amplitudes of Clifford circuits. We note that it was first observed by Shepherd [2] that to compute the probability amplitude of a Clifford circuit, it is sufficient to evaluate the Tutte polynomial of a binary matroid at the point equals , which can be efficiently computed by Vertigan’s algorithm [17]. We proceed with some definitions.

Let be a linear subspace of . The bicycle dimension and Brown’s invariant are defined as follows. [Bicycle dimension] The bicycle dimension of is defined by

 d(V)\coloneqqdim(V∩V⊥). (25)

[Brown’s invariant] If for all , then Brown’s invariant is defined to be the smallest integer such that

 ∑x∈Vi\abssupp(x)=√2d(V)+dim(V)eiπ4σ(V). (26)

The following theorem of Pendavingh [10] provides an explicit form for the Tutte polynomial of a binary matroid at in terms of the bicycle dimension and Brown’s invariant. [Pendavingh [10]] Let be a linear subspace of and let be the corresponding binary matroid with ground set . If for all , then,

 T(M(V);−i,i)=√2d(V)eiπ4(2\absS−3r(M)−σ(V)). (27)

Otherwise, . Further, can be evaluated in polynomial time. As an immediate consequence of Theorem VII, we obtain an explicit form for Clifford circuit amplitudes in terms the bicycle dimension and Brown’s invariant of the corresponding matroid. Furthermore, we obtain an efficient classical algorithm for computing the output probability amplitudes of Clifford circuits. For similar results of this flavour see Refs. [22, 23].

## Viii Algorithm Overview

We shall now use the correspondence between quantum computation and evaluations of the Tutte polynomial to establish a heuristic algorithm for computing quantum probability amplitudes. To compute a probability amplitude, it is sufficient to compute the Tutte polynomial of a graphic matroid at and for an integer  [5, 2, 6]. Our algorithm will use the deletion-contraction property to recursively compute the Tutte polynomial. At each step in the recursion, the algorithm will compute certain structural properties of the graph in order to attempt to prune the computational tree. Our algorithm can be seen an adaption of the work of Haggard, Pearce, and Royle [7] to special points of the Tutte plane. We proceed by describing the key aspects of our algorithm.

### viii.1 Multigraph Deletion-Contraction Formula

To improve the performance of our algorithm, we shall use the following deletion-contraction formula for multigraphs.

Let be a multigraph and let be a multiedge of with multiplicity . If is a loop, then

 T(G;x,y)=y\abseT(G∖{e};x,y). (28)

If is a coloop, then

 T(G;x,y)=⎛⎝x+\abse−1∑i=1yi⎞⎠T(G/{e};x,y). (29)

Finally, if is neither a loop nor a coloop, then

 T(G;x,y)=T(G∖{e};x,y)+⎛⎝\abse−1∑i=0yi⎞⎠T(G/{e};x,y). (30)

Proposition VIII.1 can easily be proven from the deletion-contraction formula by induction; we omit the proof.

If is the underlying graph of , then the number of recursive calls may be bounded by . Alternatively, we may bound the number of recursive calls in terms of the number of vertices plus the number of edges in the underlying graph. The number of recursive calls is then bounded by , which is precisely the Fibonacci recurrence. Hence the number of recursive calls is bounded by , where is the golden ratio [24]. A careful analysis shows that the number of recursive steps is bounded by , where denotes the number of spanning trees in  [14].

At each step in the recursion, we use the multigraph deletion-contraction formula to remove all multiedges that correspond to either a loop or a coloop in the underlying graph. This process contributes a multiplicative factor to the proceeding evaluation. Notice that when is a graph whose underlying graph is a looped forest, then every edge in the underlying graph is either a loop or a coloop. Hence, we obtain the following formula for the Tutte polynomial of . Let be a multigraph whose underlying graph is a looped forest. Further, for each edge in , let denote its multiplicity in . Then,

 T(G;x,y)=∏e∈E(U)loopy\abse∏e∈E(U)coloop⎛⎝x+\abse−1∑i=1yi⎞⎠. (31)
###### Proof.

The proof follows immediately from Proposition VIII.1. ∎

### viii.2 Graph Simplification

There are a number of techniques that we can use to simplify the graph at each step in the recursion. Firstly, we may remove any isolated vertices, since they do not contribute to the evaluation.

Secondly, when and for an integer , we may replace each multiedge with a multiedge of equal multiplicity modulo . To account for this, we multiply the proceeding evaluation by a efficiently computable factor. Specifically, we invoke the following proposition. [restate=[name=restatement]GraphEdgeSimplification] Fix . Let be a multigraph and let be the graph formed from by taking the multiplicity of each multiedge in modulo . Then,

 T(G;x,y)=(ieiπ4ksin(π4k))κ(E)−κ(E′)T(G′;x,y), (32)

where and . We prove Proposition VIII.2 in Appendix E.

### viii.3 Vertigan Graphs

The Tutte polynomial of a multigraph whose edge multiplicities are all integer multiples of an integer may be evaluated at the point and in polynomial time. This can be seen by the following proposition. [restate=[name=restatement]TuttePolynomialVertiganGraph] Fix . Let be a multigraph whose edge multiplicities are all integer multiples of . Further let be the graph formed from by taking the multiplicity of each multiedge in divided by . Then,

 T(G;x,y)=(√2eiπ(1−k)4ksin(π4k))−r(G)T(G′;−i,i), (33)

where and . We prove Proposition VIII.3 in Appendix F and note that this is a special consequence of the -thickening approach of Jaeger, Vertigan, and Welsh [16]. The Tutte polynomial may then be efficiently computed by Vertigan’s algorithm [17]; we call such a multigraph a Vertigan graph. We may therefore prune the computational tree whenever the graph is a Vertigan graph with respect to . Note that this corresponds to quantum circuits comprising gates from the Clifford group.

### viii.4 Connected Components

The Tutte polynomial factorises over components. Let be a graph with connected components , then,

 T(G;x,y)=k∏i=1T(Ci;x,y). (34)

Proposition VIII.4 can easily be proven from the deletion-contraction formula; we omit the proof. At each step in the deletion-contraction recursion, if the graph is disconnected, then we may use this property to prune the computational tree and hence improve performance.

### viii.5 Biconnected Components

An identical result holds for biconnected components. [Tutte [25]] Let be a graph with biconnected components , then,

 T(G;x,y)=k∏i=1T(Bi;x,y). (35)

Proposition VIII.5 can easily be proven from the deletion-contraction formula. For a proof, we refer the reader to Ref. [25, Section 3]. Similarly to the connected component case, we may use this property to prune the computational tree and improve performance. Note that the biconnected components of a graph may be listed in time linear in the number of edges via depth-first search [26].

### viii.6 Multi-Cycles

The Tutte polynomial of a multigraph whose underlying graph is a cycle may be computed in polynomial time by invoking the following proposition. [Haggard, Pearce, and Royle [7]] Let be a multigraph whose underlying graph is an -cycle with edges indexed by the positive integers. Further, for each edge in , let denote its multiplicity in . Then,

 T(G;x,y) =n−2∑k=1⎛⎝n∏j=k+1yx(\absej)k−1∏j=1y1(\absej)⎞⎠ +yx(\absen+\absen−1)n−2∏j=1y1(\absej),

where . Proposition VIII.6 can easily be proven from the deletion-contraction formula. For a proof, we refer the reader to Ref. [7, Theorem 4]. We may use this proposition to prune the computational tree whenever the underlying graph is a cycle.

### viii.7 Planar Graphs

The Tutte polynomial of a planar graph along the hyperbola may be evaluated in polynomial time via the Fisher-Kasteleyn-Temperley (FKT) algorithm [27, 28, 29]. We may therefore use this algorithm to prune the computational tree whenever the underlying graph is planar. Note that we may test whether a graph is planar in time linear in the number of vertices [30].

### viii.8 Edge-Selection Heuristics

The performance of our algorithm depends on the heuristic used to select edges. We shall consider six edge-selection heuristics: vertex order, minimum degree, maximum degree, minimum degree sum, maximum degree sum, and non-Vertigan. These edge-selection heuristics were first studied by Pearce, Haggard, and Royle [8], with the exception of non-Vertigan, which is specific to our algorithm.

Vertex order: The vertices of the graph are assigned an ordering. A multiedge is selected from those incident to the lowest vertex in the ordering and whose other endpoint is also the lowest vertex of any incident in the ordering. For contractions, the vertex inherits the lowest of the positions in the ordering.

Minimum degree: A multiedge is selected from those incident to a vertex with minimal degree in the underlying graph.

Maximum degree: A multiedge is selected from those incident to a vertex with maximal degree in the underlying graph.

Minimum degree sum: A multiedge is selected from those whose sum of degrees of its endpoints is minimal in the underlying graph.

Maximum degree sum: A multiedge is selected from those whose sum of degrees of its endpoints is maximal in the underlying graph.

Non-Vertigan: A multiedge is selected from those whose multiplicity is not an integer multiple of ; we call such a multiedge non-Vertigan. Using this edge-selection heuristic, the number of recursive calls may be bounded by , where denotes the number of non-Vertigan multiedges in . This is due to the fact that both the deletion and contraction operation reduce the number of non-Vertigan multiedges by at least one. We note that this is similar to the Sum-over-Cliffords approach studied in Refs. [31, 32, 33].

### viii.9 Other Methods

There are many other methods that may improve the performance of our algorithm, which we do not study. We shall proceed by discussing some of these.

Isomorphism testing: During the computation the graphs encountered and the evaluation of their Tutte polynomial is stored. At each recursive step, we test whether the graph is isomorphic to one already encountered, and if so, we use the evaluation of the isomorphic graph instead. Haggard, Pearce, and Royle [7] showed that isomorphism testing can lead to an improvement in the performance of computing Tutte polynomials. Note that this may not be as effective when the input is a multigraph.

Almost planar: At each step in the recursion, we may test whether the graph is close to being planar, and if so, select edges in such a way that the deletion and contraction operations give rise to a planar graph. For example, if the graph is apex, that is, it can be made planar by the removal of a single vertex, then we may select a multiedge incident to such a vertex. Similarly, if the underlying graph is edge apex or contraction apex [34], then we may select a multiedge such that the deletion or the contraction operation gives rise to a planar graph.

-connected components: Similarly to the connected and biconnected component case, we may compute the Tutte polynomial in terms of its -connected components [35, 36].

## Ix Experimental Results

In this section we present some experimental results comparing the performance of the edge-selection heuristics described in Section VIII.8 on two classes of random quantum circuits. Our experiments were performed using SageMath 9.0 [37]. The source code and experimental data are available at Ref. [38].

The first class we consider corresponds to random instances of IQP circuits induced by dense graphs. Specifically, an instance is an IQP circuit induced by a complete graph with edge weights chosen uniformly at random from the set . This class of IQP circuits is precisely that studied in Ref. [39], where it is conjectured that approximating the corresponding amplitudes up to a multiplicative error is #P-hard on average.

The second class we consider corresponds to random instances of IQP circuits induced by sparse graphs. Specifically, an instance is an IQP circuit induced by a random graph where each of the possible edges is included independently with probability and with edge weights chosen uniformly at random from the set .

We run our algorithm using each of the edge-selection heuristics to compute the principal probability amplitude of random instances of both the dense and sparse class on vertices. The performance of each edge-selection heuristic is measured by counting the number of leaves in the computational tree. Our experimental data is presented in Appendix G. We find that the non-Vertigan edge-selection heuristic performs particularly well for the dense class and the maximum degree sum edge-selection heuristic performs particularly well for the sparse class.

## X Conclusion & Outlook

We established a classical heuristic algorithm for exactly computing quantum probability amplitudes. Our algorithm is based on mapping output probability amplitudes of quantum circuits to evaluations of the Tutte polynomial of graphic matroids. The algorithm evaluates the Tutte polynomial recursively using the deletion-contraction property while attempting to exploit structural properties of the matroid. We considered several edge-selection heuristics and presented experimental results comparing their performance on two classes of random quantum circuits. Further, we obtained an explicit form for Clifford circuit amplitudes in terms of matroid invariants and an alternative efficient classical algorithm for computing the output probability amplitudes of Clifford circuits.

## Acknowledgements

We thank Michael Bremner, Adrian Chapman, Iain Moffatt, Ashley Montanaro, Rudi Pendavingh, and Dan Shepherd for helpful discussions. This research was supported by the QuantERA ERA-NET Cofund in Quantum Technologies implemented within the European Union’s Horizon 2020 Programme (QuantAlgo project), EPSRC grants EP/L021005/1 and EP/R043957/1, and the ARC Centre of Excellence for Quantum Computation and Communication Technology (CQC2T), project number CE170100012. Data are available at the University of Bristol data repository, data.bris, at https://doi.org/10.5523/bris.kbhgclva863q21tjkqpyr5uvq.

## Appendix A Proof of Proposition Iv

*

###### Proof.

By definition,

 qκ(E)ZPotts(G;q,Ω,Υ) =qκ(E)∑σ∈ZVqexp⎛⎝∑{u,v}∈Eω{u,v}δ(σu,σv)+∑v∈Vυvδ(σv)⎞⎠ =qκ(E)κ(E)∏i=1∑σ∈ZV(Ci)qexp⎛⎝∑{u,v}∈E(Ci)ω{u,v}δ(σu,σv)+∑v∈V(Ci)υvδ(σv)⎞⎠.

Now, by combining terms that are invariant under a symmetry, we have

 qκ(E)ZPotts(G;q,Ω,Υ) =κ(E)∏i=1∑σ∈ZV(Ci)qexp⎛⎝∑{u,v}∈E(Ci)ω{u,v}δ(σu,σv)⎞⎠∑σ′∈Zqexp⎛⎝∑v∈V(Ci)υvδ(σv,σ′)⎞⎠ =∑σ∈ZV′qexp⎛⎝∑{u,v}∈Eω{u,v}δ(σu,σv)+∑{u,v}∈E′∖Eυvδ(σu,σv)⎞⎠ =ZPotts(G′;q,Ω∪Υ,0).

This completes the proof. ∎

## Appendix B Proof of Proposition 19

*

###### Proof.

By definition,

 ψXG(0\absV) =⟨0\absV|exp⎛⎝i∑{u,v}∈Eω{u,v}XuXv+i∑v∈VυvXv⎞⎠|0\absV⟩ =⟨+\absV|exp⎛⎝i∑{u,v}∈Eω{u,v}ZuZv+i∑v∈VυvZv⎞⎠|+\absV⟩ =12\absV∑x,y∈{0,1}V⟨y|exp⎛⎝i∑{u,v}∈Eω{u,v}ZuZv+i∑v∈VυvZv⎞⎠|x⟩ =12\absV∑x∈{0,1}Vexp⎛⎝i∑{u,v}∈Eω{u,v}(−1)xu⊕xv+i∑v∈Vυv(−1)xv⎞⎠ =12\absV∑z∈{−1,+1}Vexp⎛⎝i∑{u,v}∈Eω{u,v}zuzv+i∑v∈Vυvzv⎞⎠ =12\absVZIsing(G;iΩ,iΥ).

This completes the proof. ∎

## Appendix C Proof of Proposition 20

*

###### Proof.
 ψXG(θ)(0\absV) =12\absVZIsing(G;iθ,iθ)(by \mbox{Proposition~{}???}) =12\absVe−iθ(\absE+\absV)ZPotts(G;2,2iθ,2iθ)(by \mbox{% Proposition~{}???}) =12\absV+κ(E)e−iθ(\absE+\absV)ZPotts(G′;2,2iθ,0)(by % \mbox{Proposition~{}???% }) =12\absV+κ(E)ZIsing(G′;iθ,0)(by \mbox{Proposition~{}???}) =ψXG′(θ)(0\absV′)(by \mbox{Proposition~{}???}).

This completes the proof. ∎

## Appendix D Proof of Proposition 21

*

###### Proof.
 ψXG′(θ)(0\absV′) =12\absV′ZIsing(G′;iθ,0)(by \mbox{Proposition~{}???}) =12\absV′e−iθ\absE′ZPotts(G′;2,2iθ,0)(by \mbox{% Proposition~{}???}) =12r(G′)e−iθ\absE′(e2iθ−1)r(G′)T(G′;−icot(θ),e2iθ)(by \mbox{Proposition~{}???}) =eiθ(r(G′)−\absE′)(isin(θ))r(G′)T(G′;−icot(θ),e2iθ).

This completes the proof. ∎

## Appendix E Proof of Proposition viii.2

*

###### Proof.
 T(G;x,y) =eiπ4k(\absE−r(G))(isin(π4k))−r(G)ψXG(π4k)(0\absV)(by \mbox{Proposition~{}???}) =eiπ4k(\absE−r(G))(isin(π4k))−r(G)ψXG′(π4k)(0\absV′) =eiπ4k(\absE−\absE′)(ieiπ4ksin(π4k))r(G′)−r(G)T(G′;x,y)(by \mbox{Proposition~{}???}) =(ieiπ4ksin(π4k))κ(E)−κ(E′)T(G′;x,y).

This completes the proof. ∎

## Appendix F Proof of Proposition viii.3

*

###### Proof.
 T(G;x,y) =eiπ4k(\absE−r(G))(isin(π4k))−r(G)ψXG(π4k)(0\absV)(by \mbox{Proposition~{}???}) =eiπ4k(\absE−r(G))(isin(π4k))−r(G)ψXG′(