# 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(·), also known as the partition function. Dyer and Greenhill [10] established a complexity dichotomy of Z_A(·) 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(·) also holds for simple graphs, where A is any real symmetric matrix.

## Authors

• 5 publications
• 14 publications
• 9 publications
• ### Dichotomy for Graph Homomorphisms with Complex Values on Bounded Degree Graphs

The complexity of graph homomorphisms has been a subject of intense stud...
04/14/2020 ∙ by Jin-Yi Cai, et al. ∙ 0

• ### Bounds on the Spectral Sparsification of Symmetric and Off-Diagonal Nonnegative Real Matrices

We say that a square real matrix M is off-diagonal nonnegative if and on...
09/23/2020 ∙ by Sergio Mercado, et al. ∙ 0

• ### Queue Layouts of Graphs with Bounded Degree and Bounded Genus

We prove that graphs with bounded degree and bounded Euler genus have bo...
01/17/2019 ∙ by Vida Dujmovic, et al. ∙ 0

• ### Partitioning a graph into degenerate subgraphs

Let G = (V, E) be a graph with maximum degree k≥ 3 distinct from K_k+1. ...
03/12/2018 ∙ by Faisal N. Abu-Khzam, et al. ∙ 0

• ### Inverse problems for symmetric doubly stochastic matrices whose Suleĭmanova spectra are to be bounded below by 1/2

A new sufficient condition for a list of real numbers to be the spectrum...
09/03/2019 ∙ by Michal Gnacik, et al. ∙ 0

• ### Bilinear matrix equation characterizes Laplacian and distance matrices of weighted trees

It is known from the algebraic graph theory that if L is the Laplacian m...
08/13/2020 ∙ by Mikhail Goubko, et al. ∙ 0

• ### A New Extension of Chubanov's Method to Symmetric Cones

We propose a new variant of Chubanov's method for solving the feasibilit...
10/19/2021 ∙ by Shin-ichi Kanoh, 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.

## 1 Introduction

The modern study of graph homomorphisms originates from the work by Lovász and others several decades ago and has been a very active area [18, 14]. If and are two graphs, a graph homomorphism (GH) is a mapping that preserves vertex adjacency, i.e., whenever is an edge in , is also an edge in . Many combinatorial problems on graphs can be expressed as graph homomorphism problems. Well-known examples include the problems of finding a proper vertex coloring, vertex cover, independent set and clique. For example, if with an edge between and and a loop at , then is a graph homomorphism iff is an independent set in ; similarly, proper vertex colorings on using at most colors correspond to homomorphisms from to (with no loops).

More generally, one can consider weighted graphs and aggregate all homomorphisms from to into a weighted sum. This is a powerful graph invariant which can express many graph properties. Formally, for a symmetric matrix , the graph homomorphism function on a graph is defined as follows:

 ZA(G)=∑ξ:V→[m]∏(u,v)∈EAξ(u),ξ(v).

Note that if is unweighted, and is its -adjacency matrix, then each product is or , and is iff is a graph homomorphism. Thus in this case counts the number of homomorphisms from to . One can further allow to have vertex weights. In this case, we can similarly define the function (see Definition 2.4).

These sum-of-product functions and are referred to as the partition functions in statistical physics [3]. Various special cases of GH have been studied there extensively, which include the Ising, Potts, hardcore gas, Beach, Widom-Rowlinsom models, etc. [3].

The computational complexity of has been studied systematically. Dyer and Greenhill [10, 11] proved that, for a symmetric -matrix , is either in polynomial time or #P-complete, and they gave a succinct condition for this complexity dichotomy: if satisfies the condition then is computable in polynomial time (we also call it tractable), otherwise it is #P-complete. Bulatov and Grohe [4] (see also [22, 13]) generalized the Dyer-Greenhill dichotomy to for nonnegative symmetric matrices . It was further extended by Goldberg et al. [12] to arbitrary real symmetric matrices, and finally by Cai, Chen and Lu [7] to arbitrary complex symmetric matrices. In the last two dichotomies, the tractability criteria are not trivial to state. Nevertheless, both tractability criteria are decidable in polynomial time (in the size of ).

The definition of the partition function can be easily extended to directed graphs and arbitrary (not necessarily symmetric) matrices corresponding to directed edge weighted graphs . Concerning the complexity of counting directed GH, we currently have the decidable dichotomies by Dyer, Goldberg and Paterson [9] for -matrices corresponding to (unweighted) simple acyclic graphs , and by Cai and Chen [6] for all nonnegative matrices .

Dyer and Greenhill in the same paper [10] proved a stronger statement that if a -matrix fails the tractability condition then is #P-complete even when restricted to bounded degree graphs . We note that the complexity of GH for bounded degree graphs is particularly interesting as much work has been done on the approximate complexity of GH focused on bounded degree graphs and approximate algorithms are achieved for them [8, 25, 21, 20, 17, 1, 2, 19, 15, 19]. However, for fifteen years the worst case complexity for bounded degree graphs in the Bulatov-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 , where in addition to the nonnegative symmetric edge weight matrix there is also a nonnegative diagonal vertex weight matrix . We will give an explicit tractability condition such that, if satisfies the condition then is computable in polynomial time for all , and if it fails the condition then is #P-hard even restricted to bounded degree simple graphs . is the special case of when

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 still holds for simple graphs. (Although in this case, whether under the same condition on 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 well-established 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 . 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 , resulting from combining pairwise linearly dependent rows and columns, that depends on vertex degree in a complicated way. (We note that in the 0-1 case all , 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 , and express the partition function in an extended framework, called on (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 , 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 , but rather they only have a direct combinatorial meaning in terms of on . 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 (without vertex weight) to , for some that inherits the hardness condition of , 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 with Hermitian edge weight matrices , where this degree dependence was also at the root of the difficulty. ***In [23], the proof of Lemma 4.22 uses Lemma 4.24. In Lemma 4.24, 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.

## 2 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 . We use and 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).

For a positive integer , we use to denote the set . When , . We use , where , to denote .

In this paper, we consider undirected graphs unless stated otherwise. Following standard definitions, the graph is allowed to have multiple edges but no loops. (However, we will touch on this issue a few times when is allowed to have loops.) The graph can have multiple edges and loops, or more generally, edge weights. For the graph , we treat its loops as edges.

An edge-weighted graph on vertices can be identified with a symmetric matrix in the obvious way. We write this correspondence by and .

###### Definition 2.1.

Let be a symmetric matrix. The problem is defined as follows: Given an undirected graph , compute

 ZA(G)=∑ξ:V→[m]∏(u,v)∈EAξ(u),ξ(v).

The function is called a graph homomorphism function or a partition function. When is a symmetric -matrix, i.e., when the graph is unweighted, counts the number of homomorphisms from to . In this case, we denote , and this problem is also known as the #-coloring problem.

###### Theorem 2.2 (Dyer and Greenhill [10]).

Let be a fixed undirected graph. Then is in polynomial time if every connected component of 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 is #P-complete.

Bulatov and Grohe [4] extended Theorem 2.2 to where 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 matrix is rectangular if there are pairwise disjoint nonempty subsets of : , for some , such that iff

 (i,j)∈⋃k∈[r](Tk×Tk)∪⋃l∈[s][(Pl×Ql)∪(Ql×Pl)].

We refer to and as blocks of . Further, we say a nonnegative symmetric matrix is block-rank- if is rectangular and every block of has rank one.

###### Theorem 2.3 (Bulatov and Grohe [4]).

Let be a symmetric matrix with nonnegative entries. Then is in polynomial time if is block-rank-, and is #P-hard otherwise.

There is a natural extension of involving the use of vertex weights. Both papers [10, 4] use them in their proofs. A graph on vertices with vertex and edge weights is identified with a symmetric edge weight matrix and a diagonal vertex weight matrix in a natural way. Then the problem can be generalized to for vertex-edge-weighted graphs.

###### Definition 2.4.

Let be a symmetric matrix and a diagonal matrix. The problem is defined as follows: Given an undirected graph , compute

 ZA,D(G)=∑ξ:V→[m]∏w∈VDξ(w)∏(u,v)∈EAξ(u),ξ(v).

Note that is the special case . We also need to define another problem where the vertex weights are specified by the degree.

###### Definition 2.5.

Let be a symmetric matrix and a sequence of diagonal matrices in . The problem is defined as follows: Given an undirected graph , compute

 ZA,D(G)=∑ξ:V→[m]∏w∈VD[[deg(w)]]ξ(w)∏(u,v)∈EAξ(u),ξ(v).

Finally, we need to define a general problem, where the vertices and edges can individually take specific weights. Let be a set of (edge weight) matrices and a set of diagonal (vertex weight) matrices. A GH-grid consists of a graph with possibly both directed and undirected edges, and loops, and assigns to each edge or loop an and to each vertex a . (A loop is just an edge of the form .) If is a directed edge then the tail and head correspond to rows and columns of , respectively; if is an undirected edge then must be symmetric.

###### Definition 2.6.

The problem is defined as follows: Given a GH-grid , compute

 ZA,D(Ω)=∑ξ:V→[m]∏w∈VD(w)ξ(w)∏e=(u,v)∈EA(e)ξ(u),ξ(v)

We remark that 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 generalizes both problems and , by taking to be a single symmetric matrix, and by taking to be a single diagonal matrix. But is not naturally expressible as because the latter does not force the vertex-weight matrix on a vertex according to its degree.

We refer to as the domain of the corresponding problem. If or , then we simply write or , respectively.

We use a superscript and/or a subscript to denote the restriction of a corresponding problem to degree- bounded graphs and/or simple graphs. E.g., denotes the problem restricted to degree- bounded graphs, denotes the problem restricted to simple graphs, and both restrictions apply in .

Working within the framework of , we define an edge gadget to be a graph with two distinguished vertices, called and . An edge gadget has a signature (edge weight matrix) expressed by an matrix , where

 Fij=∑ξ:V→[m]ξ(u∗)=i,ξ(v∗)=j∏z∈V∖{u∗,v∗}Dξ(z)∏(x,y)∈EAξ(x),ξ(y)

for . When this gadget is placed in a graph identifying and with two vertices and in that graph, then is the signature matrix for the pair . Note that the vertex weights corresponding to and are excluded from the product in the definition of . Similar definitions can be introduced for , and .

We use (and ) to denote polynomial-time Turing reductions (and equivalences, respectively).

Two simple operations are known as thickening and stretching. Let be integers. A -thickening of an edge replaces it by parallel edges, and a -stretching replaces it by a path of length . In both cases we retain the endpoints . The -thickening or -stretching of with respect to , denoted respectively by and , are obtained by -thickening or -stretching each edge from , respectively. Other edges, if any, are unchanged in both cases. When , we call them the -thickening and -stretching of and denote them by and , respectively. and are the special cases when the graph consists of a single edge . See Figure 1 for an illustration. Thickenings and stretchings can be combined in any order. Examples are shown in Figure 2.

For a matrix , we denote by the matrix obtained by replacing each entry of with its th power. Clearly, and . More generally, for the vertex-weighted case, we have and . Here if and are .

## 3 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.

###### Theorem 3.1.

Let be a symmetric nonnegative matrix. If is not block-rank-, then for some , the problem is #P-hard.

The degree bound proved in Theorem 3.1 depends on , as is the case in Theorem 2.2. The authors of [10] conjectured that a universal bound 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 , 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 , 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 and be nonnegative matrices, where is symmetric, and is diagonal. Let be the matrix obtained from by striking out rows and columns that correspond to entries of on the diagonal. If is block-rank-, then the problem is in polynomial time. Otherwise, for some , the problem is #P-hard.

Every entry of on the diagonal effectively nullifies the corresponding domain element in , so the problem becomes an equivalent problem on the reduced domain. Thus, for a nonnegative diagonal , without loss of generality, we may assume the domain has already been reduced so that 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 #P-hardness 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.

## 4 Hardness proof

We proceed to prove the #P-hardness part of Theorem 3.2. Let and be matrices, where is nonnegative symmetric but not block-rank-, and is positive diagonal. The first step is to eliminate pairwise linearly dependent rows and columns of . (We will see that this step will naturally create nontrivial vertex weights even if we initially start with the vertex unweighted case .)

If has a zero row or column , then for any connected input graph other than a single isolated vertex, no map having a nonzero contribution to can map any vertex of to . So, by crossing out all zero rows and columns (they have the same index set since is symmetric) we may assume that has no zero rows or columns. We then delete the same set of rows and columns from , thereby expressing the problem for on a smaller domain. Also permuting the rows and columns of both and simultaneously by the same permutation does not change the value of , and so it does not change the complexity of for 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 are contiguously arranged. Then, after renaming the indices, the entries of are of the following form: , where is a nonnegative symmetric matrix with all columns nonzero and pairwise linearly independent, , , , , and all . We also rename the indices of the matrix so that the diagonal entries of are of the following form: for and . As we get .

Then the partition function can be written in a compressed form

 ZA,D(G)=∑ζ:V(G)→[s]⎛⎝∏w∈V(G)mζ(w)∑j=1αζ(w)jμdeg(w)ζ(w)j⎞⎠∏(u,v)∈E(G)A′ζ(u),ζ(v)=ZA′,D(G)

where with for and . Then all matrices in are positive diagonal. Note the dependence on the vertex degree for . Since the underlying graph remains unchanged, this way we obtain the equivalence for any . Here the subscript can be included or excluded, and the same is true for the superscript , the statement remains true in all cases. We also point out that the entries of the matrices are computable in polynomial time in the input size of as well as in .

### 4.1 Gadgets Pn,p and Rd,n,p

We first introduce the edge gadget , for all . It is obtained by replacing each edge of a path of length by the gadget in Figure 5 from Lemma B.2. More succinctly is , where is an edge.

To define the gadget , for all , we start with a cycle on vertices (call it a -cycle), replace every edge of the -cycle by a copy of , and append a dangling edge at each vertex of the -cycle. To be specific, a -cycle has two vertices with parallel edges between them, and a -cycle is a loop on one vertex. The gadget always has dangling edges. Note that all are loopless simple graphs (i.e., without parallel edges or loops), for . An example of a gadget is shown in Figure 3. For the special cases , examples of gadgets can be seen in Figure 4.

We note that vertices in have degrees at most , and vertices in have degrees at most , taking into account the dangling edges. Clearly and , including the dangling edges.

By Lemma B.2, we can fix some such that is nondegenerate, where the superscript is from the stretching operator which creates those degree vertices, and the superscript is from the thickening operator , followed by , which creates those parallel paths of length . The edge gadget has the edge weight matrix

 L(n) =BD[[2p]]B…BD[[2p]]BD[[2p]] appears n−1 ≥ 0 times=B(D[[2p]]B)n−1 (4.1) =(D[[2p]])−1/2((D[[2p]])1/2B(D[[2p]])1/2)n(D[[2p]])−1/2, (4.2)

where in the notation we suppress the index . The occurrences of in (4.1) are due to those vertices of degree . Here is a diagonal matrix with the positive square roots of the corresponding entries of on the main diagonal, and is its inverse. The vertices are of degree each, but the contributions by its vertex weights are not included in .

The constraint function induced by is more complicated to write down. When it is placed as a part of a graph, for any given assignment to the vertices , we can express the contribution of the gadget in terms of copies of , together with the vertex weights incurred at the vertices which will depend on their degrees.

### 4.2 Interpolation using Rd,n,p

Assume for now that does not contain isolated vertices. We will replace every vertex of degree by a copy of , for all . The replacement operation can be described in two steps: In step one, each is replaced by a -cycle on vertices , each having a dangling edge attached. The dangling edges will be identified one-to-one with the incident edges at . If and are adjacent vertices in , then the edge in will be replaced by merging a pair of dangling edges, one from the -cycle and one from the -cycle. Thus in step one we obtain a graph , which basically replaces every vertex by a cycle of vertices. Then in step two, for every cycle in that corresponds to some we replace each edge on the cycle by a copy of the edge gadget .

Let denote the graph obtained from by the replacement procedure above. Since all gadgets are loopless simple graphs, so are for all , even if has multiple edges (or had multiloops, if we view a loop as adding degree to the incident vertex). As a technical remark, if contains vertices of degree , then the intermediate graph has loops but all graphs () do not. Also note that all vertices in have degree at most , which is independent of .

Next, it is not hard to see that

 |V(Gn,p)|=∑u∈V(G)dun(p+1)=2n(p+1)|E(G)|, |E(Gn,p)|=|E(G)|+∑u∈V(G)2npdu=(4np+1)|E(G)|.

Hence the size of the graphs is polynomially bounded in the size of , and .

Since we chose a fixed , and will choose to be bounded by a polynomial in the size of , whenever something is computable in polynomial time in , it is also computable in polynomial time in the size of (we will simply say in polynomial time).

We consider , and substitute by . We will make use of the edge weight matrix of in (4.2). The vertices are of degree each in , so will each contribute a vertex weight according to the diagonal matrix to the partition function, which are not included in , but now must be accounted for in .

Since is real symmetric and is positive diagonal, the matrix

 ˜B=(D[[2p]])1/2B(D[[2p]])1/2

is real symmetric. Then is orthogonally diagonalizable over

, i.e., there exist a real orthogonal matrix

and a real diagonal matrix such that . Then so the edge weight matrix for becomes

 L(n)=(D[[2p]])−1/2˜Bn(D[[2p]])−1/2=(D[[2p]])−1/2STJnS(D[[2p]])−1/2.

Note that as a matrix is defined for any , and , even though there is no physical gadget that corresponds to it. However, it is precisely this “virtual” gadget we wish to “realize” by interpolation.

Clearly, is nondegenerate as and both are, and so is . Then all . We can also write for every and some real ’s which depend on , , but not on and , for all . By the formal expansion of the symmetric matrix above, we have . Note that for all , the gadget for employs exactly copies of . Let ; this is precisely the number of edge gadgets in .

In the evaluation of the partition function , we stratify the vertex assignments in as follows. Denote by a tuple of nonnegative integers, where the indexing is over all ordered pairs . There are a total of such tuples that satisfy . For a fixed , this is a polynomial in , and thus a polynomial in the size of . Denote by the set of all such tuples . We will stratify all vertex assignments in by , namely all assignments such that there are exactly many constituent edge gadgets with the two end points (in either order of the end points) assigned and respectively.

For each , the edge gadgets in total contribute to the partition function . If we factor this product out for each , we can express as a linear combination of these products over all , with polynomially many coefficient values that are independent of all edge gadgets . Another way to define these coefficients is to think in terms of : For any , we say a vertex assignment on is consistent with if it assigns exactly many cycle edges of (i.e., those that belong to the cycles that replaced vertices in ) as ordered pairs of vertices to the values or . (For any loop in , as a cycle of length that came from a degree vertex of , it can only be assigned for some .) Let be any symmetric edge signature to be assigned on each of these cycle edges in , and keep the edge signature on the merged dangling edges between any two such cycles, and the suitable vertex weights specified by , namely each vertex receives its vertex weight according to . Then is the sum, over all assignments consistent with , of the products of all edge weights and vertex weights other than the contributions by , in the evaluation of the partition function on . In other words, for each ,

 cκ=∑ζ:V(G′)→[s]ζ is consistent with κ∏w∈V(G′)D[[2p+1]]ζ(w)∏(u,v)∈˜EA′ζ(u),ζ(v),

where are the non-cycle edges of that are in - correspondence with .

In particular, the values are independent of . Thus for some polynomially many values , where , we have

 ZA′,D(Gn,p)=∑κ∈Kcκ∏1≤i≤j≤s(L(n)ij)kij=∑κ∈Kcκ∏1≤i≤j≤s(s∑ℓ=1aijℓλnℓ)kij. (4.3)

Expanding out the last sum and rearranging the terms, for some values independent of , we get

 ZA′,D(Gn,p)=∑i1+…+is=ti1,…,is≥0bi1,…,is(s∏j=1λijj)n

for all .

This represents a linear system with the unknowns with the rows indexed by . The number of unknowns is clearly which is polynomial in the size of the input graph since is a constant. The values can be clearly computed in polynomial time.

We show how to compute the value

 ∑i1+…+is=ti1,…,is≥0bi1,…,is

from the values in polynomial time. The coefficient matrix of this system is a Vandermonde matrix. However, it can have repeating columns so it might not be of full rank because the coefficients do not have to be pairwise distinct. However, when they are equal, say, , we replace the corresponding unknowns and with their sum as a new variable. Since all , we have a Vandermonde system of full rank after all such combinations. Therefore we can solve this linear system in polynomial time and find the desired value .

Now we will consider a problem in the framework of according to Definition 2.6. Let be the (undirected) GH-grid, with the underlying graph , and every edge of the cycle in corresponding to a vertex in is assigned the edge weight matrix , and we keep the vertex-weight matrices at all vertices . The other edges, i.e., the original edges of , each keep the assignment of the edge weight matrix . (So in the specification of , we have , and . We note that may have loops, and Definition 2.6 specifically allows this.) Then

 Z{(D[[2p]])−1,A′},D[[2p+1]](G0,p)=∑i1+…+is=ti1,…,is≥0bi1,…,is(s∏j=1λijj)0=∑i1+…+is=ti1,…,is≥0bi1,…,is

and we have just computed this value in polynomial time in the size of from the values , for . In other words, we have achieved it by querying the oracle on the instances , for , in polynomial time.

Equivalently, we have shown that we can simulate a virtual “gadget” replacing every occurrence of in in polynomial time. The virtual gadget has the edge signature in place of in each , since

 (D[[2p]])−1/2˜B0(D[[2p]])−1/2=(D[[2p]])−1/2Is(D[[2p]])−1/2=(D[[2p]])−1.

Additionally, each retains the vertex-weight contribution with the matrix in . We view it as having “virtual” degree . This precisely results in the GH-grid .

However, even though still retains the cycles, since is a diagonal matrix, each vertex in a cycle is forced to receive the same vertex assignment value in the domain set ; all other vertex assignments contribute zero in the evaluation of . This can be easily seen by traversing the vertices in a cycle. Hence we can view each cycle employing the virtual gadget as a single vertex that contributes only a diagonal matrix of positive vertex weights , where is the vertex degree in . Contracting all the cycles to a single vertex each, we arrive at the original graph . Let , where we let , and for , we have where for . This shows that we now can interpolate the value using the values in polynomial time in the size of . The graph is arbitrary but without isolated vertices here. We show next how to deal with the case when has isolated vertices.

Given an arbitrary graph , assume it has isolated vertices. Let denote the graph obtained from by their removal. Then is of size not larger than and . Obviously, . Here the integer is a constant, so the factor can be easily computed in polynomial time. Thus, knowing the value