A dichotomy for bounded degree graph homomorphisms with nonnegative weights

We consider the complexity of counting weighted graph homomorphisms defined by a symmetric matrix $A$. Each symmetric matrix $A$ defines a graph homomorphism function $Z_A(\cdot)$, also known as the partition function. Dyer and Greenhill [10] established a complexity dichotomy of $Z_A(\cdot)$ for symmetric $\{0, 1\}$-matrices $A$, and they further proved that its #P-hardness part also holds for bounded degree graphs. Bulatov and Grohe [4] extended the Dyer-Greenhill dichotomy to nonnegative symmetric matrices $A$. However, their hardness proof requires graphs of arbitrarily large degree, and whether the bounded degree part of the Dyer-Greenhill dichotomy can be extended has been an open problem for 15 years. We resolve this open problem and prove that for nonnegative symmetric $A$, either $Z_A(G)$ is in polynomial time for all graphs $G$, or it is #P-hard for bounded degree (and simple) graphs $G$. We further extend the complexity dichotomy to include nonnegative vertex weights. Additionally, we prove that the #P-hardness part of the dichotomy by Goldberg et al. [12] for $Z_A(\cdot)$ also holds for simple graphs, where $A$ is any real symmetric matrix.


Introduction
Grohe dichotomy was open. Since this dichotomy is used essentially in almost all subsequent work, e.g., [12,7], this has been a stumbling block.
Our main contribution in this paper is to resolve this 15-year-old open problem. We prove that the #P-hardness part of the Bulatov-Grohe dichotomy still holds for bounded degree graphs. It can be further strengthened to apply to bounded degree simple graphs. We actually prove a broader dichotomy for Z A,D (·), where in addition to the nonnegative symmetric edge weight matrix A there is also a nonnegative diagonal vertex weight matrix D. We will give an explicit tractability condition such that, if (A, D) satisfies the condition then Z A,D (G) is computable in polynomial time for all G, and if it fails the condition then Z A,D (G) is #P-hard even restricted to bounded degree simple graphs G. Z A (G) is the special case of Z A,D (G) when D is the identity matrix. Additionally, we prove that the #P-hardness part of the dichotomy by Goldberg et al. [12] for all real symmetric edge weight matrices A still holds for simple graphs. (Although in this case, whether under the same condition on A the #P-hardness still holds for bounded degree graphs is not resolved in the present paper.) In order to prove the dichotomy theorem on bounded degree graphs, we have to introduce a nontrivial extension of the well-developed interpolation method [24]. We use some of the wellestablished techniques in this area of research such as stretchings and thickenings. But the main innovation is an overall design of the interpolation for a more abstract target polynomial than Z A,D . To carry out the proof there is an initial condensation step where we combine vertices that have proportionately the same neighboring edge wrights (technically defined by pairwise linear dependence) into a super vertex with a combined vertex weight. Note that this creates vertex weights even when initially all vertex weights are 1. When vertex weights are present, an approach in interpolation proof is to arrange things well so that in the end one can redistribute vertex weights to edge weights. However, when edge weights are not 0-1, any gadget design must deal with a quantity at each vertex that cannot be redistributed. This dependence has the form m ζ(w) j=1 α ζ(w)j µ deg(w) ζ(w)j , resulting from combining pairwise linearly dependent rows and columns, that depends on vertex degree deg(w) in a complicated way. (We note that in the 0-1 case all µ ζ(w)j ∈ {0, 1}, making it in fact degree independent. ) We overcome this difficulty by essentially introducing a virtual level of interpolation-an interpolation to realize some "virtual gadget" that cannot be physically realized, and yet its "virtual" vertex weights are suitable for redistribution. Technically we have to define an auxiliary graph G , and express the partition function in an extended framework, called Z A ,D on G (see Definition 2.6). In a typical interpolation proof, there is a polynomial with coefficients that have a clear combinatorial meaning defined in terms of G, usually consisting of certain sums of exponentially many terms in some target partition function. Here, we will define a target polynomial with certain coefficients; however these coefficients do not have a direct combinatorial meaning in terms of Z A,D (G), but rather they only have a direct combinatorial meaning in terms of Z A ,D on G . In a suitable "limiting" sense, a certain aggregate of these coefficients forms some useful quantity in the final result. This introduces a concomitant "virtual" vertex weight which depends on the vertex degree that is "just-right" so that it can be redistributed to become part of the incident edge weight, thus effectively killing the vertex weight. This leads to a reduction from Z C (·) (without vertex weight) to Z A,D (·), for some C that inherits the hardness condition of A, thus proving the #P-hardness of the latter. This high level description will be made clearer in Section 4. The nature of the degree dependent vertex weight introduces a substantial difficulty; in particular a direct adaptation of the proof in [10] does not work.
Our extended vertex-weighted version of the Bulatov-Grohe dichotomy can be used to correct a crucial gap in the proof by Thurley [23] for a dichotomy for Z A (·) with Hermitian edge weight matrices A, where this degree dependence was also at the root of the difficulty. *

Preliminaries
In order to state all our complexity results in the strict notion of Turing computability, we adopt the standard model [16] of computation for partition functions, and require that all numbers be from an arbitrary but fixed algebraic extension of Q. We use R and C to denote the sets of real and complex algebraic numbers. Many statements remain true in other fields or rings if arithmetic operations can be carried out efficiently in a model of computation (see [5] for more discussions on this issue).
In this paper, we consider undirected graphs unless stated otherwise. Following standard definitions, the graph G is allowed to have multiple edges but no loops. (However, we will touch on this issue a few times when G is allowed to have loops.) The graph H can have multiple edges and loops, or more generally, edge weights. For the graph H, we treat its loops as edges.
An edge-weighted graph H on m vertices can be identified with a symmetric m × m matrix A in the obvious way. We write this correspondence by H = H A and A = A H . Definition 2.1. Let A ∈ C m×m be a symmetric matrix. The problem EVAL(A) is defined as follows: Given an undirected graph G = (V, E), compute The function Z A (·) is called a graph homomorphism function or a partition function. When A is a symmetric {0, 1}-matrix, i.e., when the graph H = H A is unweighted, Z A (G) counts the number of homomorphisms from G to H. In this case, we denote EVAL(H) = EVAL(A H ), and this problem is also known as the #H-coloring problem.
Theorem 2.2 (Dyer and Greenhill [10]). Let H be a fixed undirected graph. Then EVAL(H) is in polynomial time if every connected component of H is either (1) an isolated vertex, or (2) a complete graph with all loops present, or (3) a complete bipartite graph with no loops present. Otherwise, the problem EVAL(H) is #P-complete.
Bulatov and Grohe [4] extended Theorem 2.2 to EVAL(A) where A is a symmetric matrix with nonnegative entries. In order to state their result, we need to define a few notions first.
We say a nonnegative symmetric m × m matrix A is rectangular if there are pairwise disjoint nonempty subsets of [m]: T 1 , . . . , T r , P 1 , . . . , P s , Q 1 , . . . , Q s , for some r, s ≥ 0, such that A i,j > 0 iff [23], the proof of Lemma 4.22 uses Lemma 4.24. In Lemma 4.24, A is assumed to have pairwise linearly independent rows while Lemma 4.22 does not assume this, and the author appeals to a twin reduction step in [10]. However, unlike in the 0-1 case [10], such a step incurs degree dependent vertex weights. This gap is fixed by our Theorem 3.2.
We refer to T k × T k , P l × Q l and Q l × P l as blocks of A. Further, we say a nonnegative symmetric matrix A is block-rank-1 if A is rectangular and every block of A has rank one. [4]). Let A be a symmetric matrix with nonnegative entries. Then EVAL(A) is in polynomial time if A is block-rank-1, and is #P-hard otherwise.

Theorem 2.3 (Bulatov and Grohe
There is a natural extension of EVAL(A) involving the use of vertex weights. Both papers [10,4] use them in their proofs. A graph H on m vertices with vertex and edge weights is identified with a symmetric m × m edge weight matrix A and a diagonal m × m vertex weight matrix D = diag(D 1 , . . . , D m ) in a natural way. Then the problem EVAL(A) can be generalized to EVAL(A, D) for vertex-edge-weighted graphs.
Definition 2.4. Let A ∈ C m×m be a symmetric matrix and D ∈ C m×m a diagonal matrix. The problem EVAL(A, D) is defined as follows: Given an undirected graph G = (V, E), compute Note that EVAL(A) is the special case EVAL(A, I m ). We also need to define another EVAL problem where the vertex weights are specified by the degree.
Finally, we need to define a general EVAL problem, where the vertices and edges can individually take specific weights. Let A be a set of (edge weight) m×m matrices and D a set of diagonal (vertex weight) m × m matrices. A GH-grid Ω = (G, ρ) consists of a graph G = (V, E) with possibly both directed and undirected edges, and loops, and ρ assigns to each edge e ∈ E or loop an A (e) ∈ A and to each vertex v ∈ V a D (v) ∈ D. (A loop is just an edge of the form (v, v).) If e ∈ E is a directed edge then the tail and head correspond to rows and columns of A (e) , respectively; if e ∈ E is an undirected edge then A (e) must be symmetric.
Definition 2.6. The problem EVAL(A , D) is defined as follows: Given a GH-grid Ω = Ω(G), compute We remark that Z A ,D is introduced only as a tool to express a certain quantity in a "virtual" interpolation; the dichotomy theorems do not apply to this. Defintions 2.5 and 2.6 are carefully crafted in order to carry out the #P-hardness part of the proof of Theorem 3.2. Notice that the problem EVAL(A , D) generalizes both problems EVAL(A) and EVAL(A, D), by taking A to be a single symmetric matrix, and by taking D to be a single diagonal matrix. But EVAL(A, D) is not naturally expressible as EVAL(A , D) because the latter does not force the vertex-weight matrix on a vertex according to its degree.   We use a superscript (∆) and/or a subscript simp to denote the restriction of a corresponding EVAL problem to degree-∆ bounded graphs and/or simple graphs. E.g., EVAL (∆) (A) denotes the problem EVAL(A) restricted to degree-∆ bounded graphs, EVAL simp (A, D) denotes the problem EVAL(A, D) restricted to simple graphs, and both restrictions apply in EVAL for 1 ≤ i, j ≤ m. When this gadget is placed in a graph identifying u * and v * with two vertices u and v in that graph, then F is the signature matrix for the pair (u, v). Note that the vertex weights corresponding to u and v are excluded from the product in the definition of F . Similar definitions can be introduced for EVAL(A), EVAL(A, D) and EVAL(A , D).
We use ≤ P T (and ≡ P T ) to denote polynomial-time Turing reductions (and equivalences, respectively).
Two simple operations are known as thickening and stretching. Let p, r ≥ 1 be integers. A p-thickening of an edge replaces it by p parallel edges, and a r-stretching replaces it by a path of length r. In both cases we retain the endpoints u, v. The p-thickening or r-stretching of G with respect to F ⊆ E(G), denoted respectively by T (F ) p (G) and S (F ) r (G), are obtained by p-thickening or r-stretching each edge from F , respectively. Other edges, if any, are unchanged in both cases. When F = E(G), we call them the p-thickening and r-stretching of G and denote them by T p (G) and S r (G), respectively. T p e and S r e are the special cases when the graph consists of a single edge e. See Figure 1 for an illustration. Thickenings and stretchings can be combined in any order. Examples are shown in Figure 2.
For a matrix A, we denote by A p the matrix obtained by replacing each entry of A with its pth power. Clearly,

Dichotomy for bounded degree graphs
In addition to the Dyer-Greenhill dichotomy (Theorem 2.2), in the same paper [10] they also proved that the #P-hardness part of their dichotomy holds for bounded degree graphs. The bounded degree case of the Bulatov-Grohe dichotomy (Theorem 2.3) was left open, and all known proofs [4,22,13] of its #P-hardness part require unbounded degree graphs. All subsequent dichotomies that use the Bulatov-Grohe dichotomy, e.g., [12,7] also explicitly or implicitly (because of their dependence on the Bulatov-Grohe dichotomy) require unbounded degree graphs. In this paper, we extend the #P-hardness part of the Bulatov-Grohe dichotomy to bounded degree graphs.
The degree bound ∆ proved in Theorem 3.1 depends on A, as is the case in Theorem 2.2. The authors of [10] conjectured that a universal bound ∆ = 3 works for Theorem 2.2; whether a universal bound exists for both Theorems 2.2 and 3.1 is open. For general symmetric real or complex A, it is open whether bounded degree versions of the dichotomies in [12] and [7] hold. Xia [26] proved that a universal bound does not exist for complex symmetric matrices A, assuming #P does not collapse to P.
We prove a broader dichotomy than Theorem 3.1, which also includes arbitrary nonnegative vertex weights.
Theorem 3.2. Let A and D be m × m nonnegative matrices, where A is symmetric, and D is diagonal. Let A be the matrix obtained from A by striking out rows and columns that correspond to 0 entries of D on the diagonal. If A is block-rank-1, then the problem EVAL(A, D) is in polynomial time. Otherwise, for some ∆ > 0, the problem EVAL Every 0 entry of D on the diagonal effectively nullifies the corresponding domain element in [m], so the problem becomes an equivalent problem on the reduced domain. Thus, for a nonnegative diagonal D, without loss of generality, we may assume the domain has already been reduced so that D is positive diagonal. In what follows, we will make this assumption.
In Appendix A, we will prove the tractability part of Theorem 3.2. This follows easily from known results. In Appendix B, we will present two technical lemmas, Lemma B.1 and Lemma B.2 to be used in Section 4. Finally, in Appendix C we prove Theorem C.1, showing that the #Phardness part of the dichotomy for counting GH by Goldberg et al. [12] for real symmetric matrix (with mixed signs) is also valid for simple graphs.

Hardness proof
We proceed to prove the #P-hardness part of Theorem 3.2. Let A and D be m × m matrices, where A is nonnegative symmetric but not block-rank-1, and D is positive diagonal. The first step is to eliminate pairwise linearly dependent rows and columns of A. (We will see that this step will naturally create nontrivial vertex weights even if we initially start with the vertex unweighted case D = I m .) If A has a zero row or column i, then for any connected input graph G other than a single isolated vertex, no map ξ : V (G) → [m] having a nonzero contribution to Z A,D (G) can map any vertex of G to i. So, by crossing out all zero rows and columns (they have the same index set since A is symmetric) we may assume that A has no zero rows or columns. We then delete the same set of rows and columns from D, thereby expressing the problem EVAL simp (A, D) for ∆ ≥ 0 either. Having no zero rows and columns implies that pairwise linear dependence is an equivalence relation, and so we may assume that the pairwise linearly dependent rows and columns of A are contiguously arranged. Then, after renaming the indices, the entries of A are of the following form: We also rename the indices of the matrix D so that the diagonal entries of D are of the following form: Then the partition function Z A,D (·) can be written in a compressed form Then all matrices in D are positive diagonal. Note the dependence on the vertex degree deg(w) for w ∈ V (G). Since the underlying graph G remains unchanged, this way we obtain the equivalence EVAL

Gadgets P n,p and R d,n,p
We first introduce the edge gadget P n,p , for all p, n ≥ 1. It is obtained by replacing each edge of a path of length n by the gadget in Figure 5 from Lemma B.2. More succinctly P n,p is S 2 T p S n e, where e is an edge.
To define the gadget R d,n,p , for all d, p, n ≥ 1, we start with a cycle on d vertices F 1 , . . . , F d (call it a d-cycle), replace every edge of the d-cycle by a copy of P n,p , and append a dangling edge at each vertex F i of the d-cycle. To be specific, a 2-cycle has two vertices with 2 parallel edges between them, and a 1-cycle is a loop on one vertex. The gadget R d,n,p always has d dangling edges. Note that all R d,n,p are loopless simple graphs (i.e., without parallel edges or loops), for d, n, p ≥ 1. An example of a gadget R d,n,p is shown in Figure 3. For the special cases d = 1, 2, examples of gadgets R d,n,p can be seen in Figure 4.
We note that vertices in P n,p have degrees at most 2p, and vertices in R d,n,p have degrees at most 2p + 1, taking into account the dangling edges. Clearly |V (R d,n,p )| = dn(p + 1) and |E(R d,n,p )| = (2np + 1)d, including the dangling edges.
By Lemma B.2, we can fix some p ≥ 1 such that B = (A D [ [2]] A ) p is nondegenerate, where the superscript [ [2]] is from the stretching operator S 2 which creates those degree 2 vertices, and the superscript p is from the thickening operator T p , followed by S 2 , which creates those parallel paths of length 2. The edge gadget P n,p has the edge weight matrix The constraint function induced by R d,n,p is more complicated to write down. When it is placed as a part of a graph, for any given assignment to the d vertices F i , we can express the contribution of the gadget R d,n,p in terms of d copies of L (n) , together with the vertex weights incurred at the d vertices F i which will depend on their degrees.

Interpolation using R d,n,p
Assume for now that G does not contain isolated vertices. We will replace every vertex u ∈ V (G) of degree d = d u = deg(u) ≥ 1 by a copy of R d,n,p , for all n, p ≥ 1. The replacement operation can be described in two steps: In step one, each u ∈ V (G) is replaced by a d-cycle on vertices F 1 , . . . , F d , each having a dangling edge attached. The d dangling edges will be identified one-to-one with the d incident edges at u. If u and v are adjacent vertices in G, then the edge (u, v) in G will be replaced by merging a pair of dangling edges, one from the d u -cycle and one from the d v -cycle. Thus in  step one we obtain a graph G , which basically replaces every vertex u ∈ V (G) by a cycle of deg(u) vertices. Then in step two, for every cycle in G that corresponds to some u ∈ V (G) we replace each edge on the cycle by a copy of the edge gadget P n,p . Let G n,p denote the graph obtained from G by the replacement procedure above. Since all gadgets R d,n,p are loopless simple graphs, so are G n,p for all n, p ≥ 1, even if G has multiple edges (or had multiloops, if we view a loop as adding degree 2 to the incident vertex). As a technical remark, if G contains vertices of degree 1, then the intermediate graph G has loops but all graphs G n,p (n, p ≥ 1) do not. Also note that all vertices in G n,p have degree at most 2p + 1, which is independent of n.
Next, it is not hard to see that Hence the size of the graphs G n,p is polynomially bounded in the size of G, n and p.
Since we chose a fixed p, and will choose n to be bounded by a polynomial in the size of G, whenever something is computable in polynomial time in n, it is also computable in polynomial time in the size of G (we will simply say in polynomial time).
We consider Z A ,D (G), and substitute G by G n,p . We will make use of the edge weight matrix L (n) of P n,p in (4.2). The vertices F i are of degree 2p + 1 each in G n,p , so will each contribute a vertex weight according to the diagonal matrix D [[2p+1]] to the partition function, which are not included in L (n) , but now must be accounted for in Z A ,D (G n,p ).
Since Note that L (n) as a matrix is defined for any n ≥ 0, and L (0) = (D [[2p]] ) −1 , even though there is no physical gadget P 0,p that corresponds to it. However, it is precisely this "virtual" gadget we wish to "realize" by interpolation.
Clearly, B is nondegenerate as B and (D [[2p]] ) 1/2 both are, and so is J. Then all λ i = 0. We can also write L (n) ij = s =1 a ij λ n for every n ≥ 0 and some real a ij 's which depend on S, D [[2p]] , but not on J and n, for all 1 ≤ i, j, ≤ s. By the formal expansion of the symmetric matrix L (n) above, we have a ij = a ji . Note that for all n, p ≥ 1, the gadget R dv,n,p for v ∈ V (G) employs exactly d v copies of P n,p . Let t = v∈V (G) d v = 2|E|; this is precisely the number of edge gadgets P n,p in G n,p .
In the evaluation of the partition function Z A ,D (G n,p ), we stratify the vertex assignments in G n,p as follows. Denote by κ = (k ij ) 1≤i≤j≤s a tuple of nonnegative integers, where the indexing is over all s(s + 1)/2 ordered pairs (i, j). There are a total of t+s(s+1)/2−1 s(s+1)/2−1 such tuples that satisfy 1≤i≤j≤s k ij = t. For a fixed s, this is a polynomial in t, and thus a polynomial in the size of G. Denote by K the set of all such tuples κ. We will stratify all vertex assignments in G n,p by κ ∈ K, namely all assignments such that there are exactly k ij many constituent edge gadgets P n,p with the two end points (in either order of the end points) assigned i and j respectively.
For each κ ∈ K, the edge gadgets P n,p in total contribute 1≤i≤j≤s (L (n) ij ) k ij to the partition function Z A ,D (G n,p ). If we factor this product out for each κ ∈ K, we can express Z A ,D (G n,p ) as a linear combination of these products over all κ ∈ K, with polynomially many coefficient values c κ that are independent of all edge gadgets P n,p . Another way to define these coefficients c κ is to think in terms of G : For any κ = (k ij ) 1≤i≤j≤s ∈ K, we say a vertex assignment on G is consistent with κ if it assigns exactly k ij many cycle edges of G (i.e., those that belong to the cycles that replaced vertices in G) as ordered pairs of vertices to the values (i, j) or (j, i). (For any loop in G , as a cycle of length 1 that came from a degree 1 vertex of G, it can only be assigned (i, i) for some 1 ≤ i ≤ s.) Let L be any symmetric edge signature to be assigned on each of these cycle edges in G , and keep the edge signature A on the merged dangling edges between any two such cycles, and the suitable vertex weights specified by D, namely each vertex receives its vertex weight according to D [[2p+1]] . Then c κ is the sum, over all assignments consistent with κ, of the products of all edge weights and vertex weights other than the contributions by L , in the evaluation of the partition function on G . In other words, for each κ ∈ K, where E ⊆ E(G ) are the non-cycle edges of G that are in 1-1 correspondence with E(G).
In particular, the values c κ are independent of n. Thus for some polynomially many values c κ , where κ ∈ K, we have Equivalently, we have shown that we can simulate a virtual "gadget" R d,0,p replacing every occurrence of R d,n,p in G n,p in polynomial time. The virtual gadget R d,0,p has the edge signature Additionally, each F i retains the vertex-weight contribution with the matrix D [[2p+1]] in R d,0,p . We view it as having "virtual" degree 2p + 1. This precisely results in the GH-grid G 0,p .
However, even though G 0,p still retains the cycles, since (D This shows that we now can interpolate the value Z A ,P (G) using the values Z A ,D (G n,p ) in polynomial time in the size of G. The graph G is arbitrary but without isolated vertices here. We show next how to deal with the case when G has isolated vertices.
Given an arbitrary graph G, assume it has h ≥ 0 isolated vertices. Let G * denote the graph obtained from G by their removal. Then G * is of size not larger than G and h ≤ |V (G)|. Obviously, Here the integer s is a constant, so the factor s h > 0 can be easily computed in polynomial time. Thus, knowing the value Z A ,P (G * ) we can compute the value Z A ,P (G) in polynomial time. Further, since we only use the graphs G n,p , n ≥ 1 during the interpolation, each being simple of degree at most 2p + 1, combining it with the possible isolated vertex removal step, we conclude EVAL(A , P) ≤ P T EVAL (2p+1) simp (A , D). Next, it is easy to see that for an arbitrary graph G Here C is an s × s matrix with the entries C ij = A ij w i w j where 1 ≤ i, j ≤ s. Clearly, C is a nonnegative symmetric matrix. In the above chain of equalities, we were able to redistribute the weights w i and w j into the edge weights A ij which resulted in the edge weights C ij , so that precisely each edge {u, v} in G gets two factors w ζ(u) and w ζ(v) since the vertex weights at u and v were respectively. (This is a crucial step in our proof.) Because the underlying graph G is arbitrary, it follows that EVAL(A , P) ≡ P T EVAL(C). Combining this with the previous EVAL-reductions and equivalences, we obtain simp (A, D), by taking ∆ = 2p + 1. Remembering that our goal is to prove the #P-hardness for the matrices A, D not satisfying the tractability conditions of Theorem 3.2, we finally use the assumption that A is not blockrank-1. Next, noticing that all µ ij > 0, by construction A is not block-rank-1 either. Finally, because all w i > 0 nor is C block-rank-1 implying that EVAL(C) is #P-hard by Theorem 2.3. Hence EVAL We remark that one important step in our interpolation proof happened at the stratification step before (4.3). In the proof we have the goal of redistributing vertex weights to edge weights; but this redistribution is sensitive to the degree of the vertices. This led us to define the auxiliary graph G and the coefficients c κ . Usually in an interpolation proof there are some coefficients that have a clear combinatorial meaning in terms of the original problem instance. Here these values c κ do not have a clear combinatorial meaning in terms of Z A ,D (G), rather they are defined in terms of an intermediate problem instance G , which is neither G nor the actual constructed graphs G n,p . It is only in a "limiting" sense that a certain combination of these values c κ allows us to compute Z A ,D (G).

A Tractability part
The tractability part of Theorem 3.2 follows easily from known results. For completeness we outline a proof here. Let A and D be m × m matrices, where A is nonnegative symmetric block-rank-1 and D is positive diagonal.
First, Z A,D (G) can be reduced to the connected components G 1 , . . . , G t of G, so we may as well assume G is connected. We permute the rows and columns of A, D by the same permutation and then cross out zero rows and columns of A. This does not change Z A,D . We may assume that A = diag(A i ) k i=1 is block diagonal with nonzero blocks A 1 , . . . , A k , where each block A i is either a symmetric matrix of rank 1 with no zero entries, or a symmetric bipartite matrix of the form 0 B B T 0 where B has rank 1 and no zero entries. Then we can write D = diag(D i ) k i=1 where each D i is positive diagonal of the corresponding size. As A is block diagonal and G is connected, So we may as well assume that A is one of these blocks. Also let D = diag(α i ) m i=1 . 1) A is a symmetric matrix of rank 1 with no zero entries. We can write A = x T x for some positive row vector x = (x i ) m i=1 . Then has rank 1 and no zero entries. We can write B = x T y for some positive row vectors x = (x i ) i=1 and y = (y j ) m j= +1 . Since G is connected, Z A,D (G) = 0 unless G is bipartite. If G is bipartite with a vertex bipartization V 1 ∪ V 2 , then we only need to consider maps ξ : with all other maps contribute zero to Z A,D (G). Then

B Two technical lemmas
We need two technical lemmas. The following lemma is from [10] (Lemma 3.6); for the convenience of readers we give a proof here.
Lemma B.1. Let A and D be m × m matrices, where A is real symmetric with all columns nonzero and pairwise linearly independent, and D is positive diagonal. Then all columns of ADA are nonzero and pairwise linearly independent.
Proof. The case m = 1 is trivial.
. Then Π 2 = D. We have ADA = Q T Q, where Q = ΠA. Let q i denote the ith column of Q. Then Q has pairwise linearly independent columns. By the Cauchy-Schwartz inequality, Then for any 1 ≤ i < j ≤ m, the ith and jth columns of ADA contain a submatrix so they are linearly independent.
Lemma B.2. Let A and D be m × m matrices, where A is real symmetric with all columns nonzero and pairwise linearly independent, and D is positive diagonal. Then for all sufficiently large positive integers p, the matrix B = (ADA) p corresponding to the edge gadget in Figure 5 is nondegenerate.
Proof. If m = 1, then any p ≥ 1 works. Let m ≥ 2. Following the proof of Lemma B.1, we have Consider the p-thickening of A for p ≥ 1. Each term of det ((A ) p ) has the form ± m i=1 A p iσ(i) for some permutation σ of [m]. Now for 0 ≤ j ≤ m. By separating out the identity permutation and all other terms, for p ≥ ln(2m)/ ln(1/γ) + 1, we have 2mγ p < 1, and C Hardness for Z A (·) on simple graphs for real symmetric A There is a more direct approach to prove the #P-hardness part of the Bulatov-Grohe dichotomy (Theorem 2.3) for simple graphs. Although this method does not handle degree-boundedness, we can apply it more generally to the problem EVAL(A, D) when the matrix A is real symmetric and D is positive diagonal.In particular, we will prove the #P-hardness part of the dichotomy for counting GH by Goldberg et al. [12] (the problem EVAL(A) without vertex weights, where A is a real symmetric matrix) for simple graphs.
We first prove the following theorem.
Theorem C.1. Let A and D be m × m matrices, where A is real symmetric and D is positive diagonal. Then EVAL(A, D) ≤ P T EVAL simp (A, D). Proof. We may assume A is not identically 0, for otherwise the problem is trivial. Let G = (V, E) be an input graph to the problem EVAL(A, D). For any n ≥ 1, let G n = S (F ) n (G) where F ⊆ E is the subset consisting of the edges of G each of which is parallel to at least one other edge. In other words, we obtain G n by replacing every parallel edge e by its n-stretching S n e. We will refer to these as paths of length n in G n . Note that G 1 = G. Moreover, for every n ≥ 2, the graph G n is simple and loopless, and has polynomial size in the size of G and n.
A path of length n ≥ 1 has the edge weight matrix Here D 1/2 is a diagonal matrix with the positive square roots of the corresponding entries of D on the main diagonal, and D −1/2 is its inverse.
Since A is real symmetric and D is positive diagonal, the matrix A = D 1/2 AD 1/2 is real symmetric. Then A is orthogonally diagonalizable over R, i.e., there exist a real orthogonal matrix S and a real diagonal matrix J = (λ i ) m i=1 such that A = S T JS. If A has rank r, then 1 ≤ r ≤ m, and we may assume that λ i = 0 for 1 ≤ i ≤ r and λ i = 0 for i > r.
We have A n = S T J n S, so the edge weight matrix for a path of length n ≥ 1 can be written as We can write M (n) ij = r =1 a ij λ n by a formal expansion, for every n ≥ 1 and some real a ij 's that are dependent on D and S, but independent of n and λ , where 1 ≤ i, j ≤ m and 1 ≤ ≤ r. By the formal expansion of the symmetric matrix M (n) above, we have a ij = a ji . Let t = |F |, which is the number of edges in G subject to the stretching operator S n to form G n .
In the evaluation of the partition function Z A,D (G n ), we stratify the vertex assignments in G n as follows. Denote by κ = (k ij ) 1≤i≤j≤m a nonnegative tuple with entries indexed by ordered pairs of nonnegative numbers that satisfy 1≤i≤j≤m k ij = t. Let K denote the set of all such possible tuples κ. In particular, |K| = t+m(m+1)/2−1 m(m+1)/2−1 . For a fixed m, this is a polynomial in t, and thus a polynomial in the size of G. Let c κ be the sum over all assignments of all vertex and edge weight products in Z A,D (G n ), except the contributions by the paths of length n formed by stretching parallel edges in G, such that the endpoints of precisely k ij constituent paths of length n receive the assignments (i, j) (in either order of the end points) for every 1 ≤ i ≤ j ≤ m. Technically we can call a vertex assignment on G consistent with κ (where κ ∈ K), if it satisfies the stated property. Note that the contribution by each such path does not include the vertex weights of the two end points (but does include all vertex weights of the internal n − 1 vertices of the path). We can write for κ ∈ K.
In particular, the values c κ are independent of n. Thus for some polynomially many values c κ , where κ ∈ K, we have Expanding out the last sum and rearranging the terms, for some values b i 1 ,...,ir independent of n, we get where n ≥ 2 in polynomial time (recall that G n is simple and loopless for n ≥ 2). The coefficient matrix of the linear system (C.1) is a Vandermonde matrix. However, it might not be of full rank because the coefficients r =1 λ i do not have to be pairwise distinct, and therefore it can have repeating columns. Nevertheless, when there are two repeating columns we replace the corresponding unknowns b i 1 ,...,ir and b i 1 ,...,i r with their sum as a new variable; we repeat this replacement procedure until there are no repeating columns. Since all λ = 0, for 1 ≤ ≤ r, after the replacement, we have a Vandermonde system of full rank. Therefore we can solve this modified linear system in polynomial time. This allows us to obtain the value Z A,D (G) = We are ready to prove the #P-hardness part of the dichotomy by Goldberg et al. [12] (Theorem 1.1) for simple graphs. Let A be a real symmetric m × m matrix. Assuming that A does not satisfy the tractability conditions of the dichotomy theorem of Goldberg et al., the problem EVAL(A) is #P-hard. By Theorem C.1 (with D = I m ), EVAL(A) ≤ P T EVAL simp (A). It follows that EVAL simp (A) is #P-hard.
Hence the dichotomy theorem by Goldberg et al. can improve to apply to simple graphs.
Theorem C.2. Let A be a real symmetric matrix. Then either EVAL(A) is in polynomial time or EVAL simp (A) is #P-hard (a fortiori, EVAL(A) is #P-hard). Moreover, there is a polynomial time algorithm that, given the matrix A, decides which case of the dichotomy it is.
Remark: The interpolation argument in Theorem C.1 works even if G is a multigraph possibly with multiple loops at any vertex in the following sense. In Definition 2.4, we treat the loops of G as edges. We think of them as mapped to the entries A ii in the evaluation of the partition function Z A,D . However, we need to slightly change the way we define the graphs G n . In addition to n-stretching the parallel edges of G, we also need to n-stretch each loop of G (i.e., replacing a loop by a closed path of length n). Now F is the set of parallel edges and loops in G. This way each G n = S (F ) n (G) for n ≥ 2 is simple and loopless. The rest of the proof goes through. In other words, the statement of Theorem C.1 extends to a reduction from the EVAL(A, D) problem that allows input G to have multiloops, to the standard problem EVAL simp (A, D) not allowing loops.