# The Complexity of Approximately Counting Retractions

Let G be a graph that contains an induced subgraph H. A retraction from G to H is a homomorphism from G to H that is the identity function on H. Retractions are very well-studied: Given H, the complexity of deciding whether there is a retraction from an input graph G to H is completely classified, in the sense that it is known for which H this problem is tractable (assuming P≠NP). Similarly, the complexity of (exactly) counting retractions from G to H is classified (assuming FP≠#P). However, almost nothing is known about approximately counting retractions. Our first contribution is to give a complete trichotomy for approximately counting retractions to trees. Our second contribution is to locate the retraction counting problem in the complexity landscape of related approximate counting problems. Interestingly, our results are in contrast to the situation in the exact counting context. We show that the problem of approximately counting retractions is separated both from the problem of approximately counting homomorphisms and from the problem of approximately counting list homomorphisms --- whereas for exact counting all three of these problems are interreducible. We also show that the number of retractions is at least as hard to approximate as both the number of surjective homomorphisms and the number of compactions. In contrast, exactly counting compactions is the hardest of these problems.

• 6 publications
• 25 publications
• 31 publications
07/04/2019

### The Complexity of Approximately Counting Retractions to Square-Free Graphs

A retraction is a homomorphism from a graph G to an induced subgraph H o...
08/28/2018

### Approximately counting bases of bicircular matroids

We give a fully polynomial-time randomised approximation scheme (FPRAS) ...
06/08/2021

### Complexity classification of counting graph homomorphisms modulo a prime number

Counting graph homomorphisms and its generalizations such as the Countin...
10/19/2020

### On the Robustness of Winners: Counting Briberies in Elections

We study the parameterized complexity of counting variants of Swap- and ...
07/12/2021

### Inapproximability of counting hypergraph colourings

Recent developments in approximate counting have made startling progress...
06/14/2021

### Exact Counting and Sampling of Optima for the Knapsack Problem

Computing sets of high quality solutions has gained increasing interest ...
12/25/2019

### A Study of the Learnability of Relational Properties (Model Counting Meets Machine Learning)

Relational properties, e.g., the connectivity structure of nodes in a di...

## 1 Introduction

A homomorphism from a graph  to a graph  is a function such that, for all , we have . For example, suppose that is a path . Then a homomorphism from to is a -colouring of in which the colour classes and induce a bipartition of . Suppose that itself contains a path . Then a retraction from to is a homomorphism from to that maps to , to and to . In general, let and be graphs such that contains a fixed copy of as an induced subgraph. Then a retraction from to is a homomorphism from to that is the identity function on this fixed copy of in .

Retractions have been studied over a long period of time [HellThesis, Hell1974, HR1987, Pesch1988]. In particular, the computational decision problem of determining whether there is a retraction from  to  is well-studied [HellNesetrilBook, VikasCompRetCSP, Vikas4Vertex, Vikas2017, FederPseudoForest]. Retractions have also been studied under the name of one-or-all list homomorphisms, pre-colouring extensions or simply extensions, see, e.g., [FederLHomRefl, FederLHomIrrefl, BHT1992, KS1997, Tuza1997, Marx2006, FHH2009]. See Hell and Nešetřil’s review article [HN2008] for a more extensive list of such work.

Homomorphism counting problems have been researched extensively as well [DGGJApprox, GJTreeHoms, DGJSampling, GGJList, GGJBIS, KelkThesis, GKP2004, DG2000, Hell2004b, BorgsCountingSurvey, FGZ2017]. The problem of exactly counting retractions has been studied recently and a complete complexity classification is given in [FGZ2017]. However, very little is known about approximately counting retractions.

### 1.1 First Contribution: A Trichotomy for Approximately Counting Retractions to Graphs of Girth at least 5

A (self-)loop is an edge from a vertex to itself. A cycle is a walk where and all vertices in are distinct. The length of the cycle is . We sometimes refer to length- cycles as “triangles” and to length- cycles as “squares”. The girth of a graph is the length of a shortest cycle in . If is acyclic (that is if is a forest with possibly some loops) then its girth is infinity. In this work we give a complete complexity classification for the problem of approximately counting retractions to graphs that have a girth of at least (Theorem 1). Thus, our classification applies to all graphs except to those that contain -cycles or -cycles We now informally introduce some notation and concepts in order to state this result.

Given a graph , we use to denote the problem of counting retractions to , given as input a graph  containing a fixed copy of .

To investigate the complexity of approximate counting problems, Dyer, Goldberg, Greenhill and Jerrum [DGGJApprox] introduce the concept of an approximation-preserving reduction (AP-reduction). Intuitively, an AP-reduction from a problem to a problem is an algorithm that is a “good” approximation to if it has oracle access to a “good” approximation to . We write if such an AP-reduction exists. Two problems that are studied in this paper appear frequently as benchmark problems in this line of research. is the problem of counting the satisfying assignments of a Boolean formula. This problem is complete for with respect to AP-reductions. is the problem of counting the independent sets of a bipartite graph. This problem is complete for the approximate counting complexity class (with respect to AP-reductions). While it is not believed that there is an efficient approximation algorithm for , it is also not believed that it is complete for with respect to AP-reductions.

While, in general, the vertices of  may or may not have loops, we will consider two special cases. We say that a graph is irreflexive if it does not contain any loops. We say that it is reflexive if every vertex has a loop. A tree may be irreflexive, reflexive, or neither, but it may not have any cycles. A caterpillar is an irreflexive tree which contains a path such that all vertices outside of have degree . A partially bristled reflexive path is a tree consisting of a reflexive path , together with a (possibly empty) set of unlooped “bristle” vertices  and a matching connecting all of the vertices of to “internal” vertices of  (vertices of  that are not endpoints of the path). A more formal definition, along with an example, is given in Section 1.5.

###### Theorem 1.

Let be a graph of girth at least .

1. If every connected component of is an irreflexive star, a single looped vertex, or an edge with two loops, then is in .

2. Otherwise, if every connected component of is an irreflexive caterpillar or a partially bristled reflexive path, then is approximation-equivalent to .

3. Otherwise, is approximation-equivalent to .

Since there has been prior work on the problem of counting homomorphisms to trees, it is worth noting the special case of Theorem 1 where is an irreflexive tree. In this case, is in if is a star. If is a caterpillar but not a star, then . For all other irreflexive trees , the problem is -equivalent under AP-reductions. The special case where is a reflexive tree is also easy to state. In this case, is in if is a single looped vertex or an edge with two loops. If is a reflexive path with at least three vertices, then . Otherwise, is -equivalent with respect to AP-reductions.

The special case of our classification where is irreflexive is given in Theorem 18. It is slightly more general than what is given in Theorem 1 since it covers all irreflexive square-free graphs , including those that have -cycles. The proof of Theorem 1 is given in Section 2.3.

### 1.2 Second Contribution: Locating #\textscRet(H) in the Approximate Counting Landscape

We locate the retraction counting problem in the complexity landscape of related homomorphism counting problems. Interestingly, it turns out that the complexity landscape for approximate counting looks very different from the one for exact counting.

We use to denote the set of homomorphisms from to and to denote the size of . The following is the well-known homomorphism counting problem.

Name: . Input: An irreflexive graph . Output: .

Note that, in the problem , the input graph  is required to be irreflexive. This is standard in the field, and the reason for it is to make results stronger — typically it is the hardness results that are most challenging. In the problem , as we have informally defined it, it does not make sense to force  to be irreflexive, since it contains an induced copy of , which may have loops. However, we can insist that have no loops outside of the induced copy of . Theorem 1 is still true under this restriction, and we incorporate this restriction into our formal definitions below. In order to give formal definitions, it is more natural to re-cast the retraction problem in terms of list homomorphisms, so we define these next.

Let be a set of “lists” indexed by the vertices of . Each list is a subset of . We say that a function is a homomorphism from to (also called a list homomorphism) if is a homomorphism from to and, for each vertex of , we have . We use to denote the set of homomorphisms from to and we use to denote the size of . We will be interested in the following generalisation of .

Name: Input: An irreflexive graph and a collection of lists . Output: .

As noted earlier, we will find it convenient to formally define the computational problem in terms of list homomorphisms.

Name: . Input: An irreflexive graph and a collection of lists such that, for all , . Output: .

The polynomial-time interreducibility between the problem which we defined informally (with the restriction on loops in ) and the one defined here, is demonstrated by Feder and Hell [FederLHomRefl, Theorem 4.1] who give a parsimonious reduction between them. This reduction also shows that the corresponding decision problems are polynomial-time interreducible.

We consider two more related counting problems, namely , the problem of counting vertex-surjective homomorphisms, and , the problem of counting edge-surjective homomorphisms, which are called compactions. We give their formal definitions at the beginning of Section 3. Both problems are well-studied in the decision setting [BodirskySurvey, GolovachFinding, GolovachTrees, GolovachNewHardness, MartinPaulusmaSHomC4, VikasReflCycle, VikasIrreflCycle, Vikas2013, VikasHexagon]. All three of the problems , and can be interpreted as problems requiring one to count homomorphisms with some kind of surjectivity constraint. and are the corresponding list homomorphism problems and these are also formally defined in Section 3.

A separation between two homomorphism-counting problems and is given by a parameter for which and are of different complexity, subject to some complexity-theory assumptions.

Before stating our results we give an overview of the approximate counting complexity landscape in Figure 1. The results summarised in this figure are consistent with the results that are known concerning the corresponding decision problems, as surveyed by Bodirsky, Kára and Martin [BodirskySurvey], but they are in contrast to the situation in the exact counting world. For exact counting, , and are interreducible. Also, all of the exact counting problems that we have mentioned reduce to and  [FGZ2017], as depicted in Figure 2. Moreover, and are separated from the remaining problems.

We now give our results in more detail. We start off with the following simple observation which follows immediately from the problem definitions.

###### Observation 2.

Let be a graph. Then .

As we will see later, the complexity of approximately counting homomorphisms is still open (despite a lot of work on the problem) — even if restricted to trees . The complexity of approximately counting list homomorphisms is known, due to Galanis, Goldberg and Jerrum [GGJList]. Thus, Observation 2 indicates that is an important intermediate problem, between the solved and the wide-open .

The first interesting consequence of Theorem 1 is a separation between and .

###### Corollary 3.

and are separated subject to the assumption that and are not AP-interreducible. In particular, if is a partially bristled reflexive path with at least one unlooped vertex, then , whereas .

The fact that for partially bristled reflexive paths follows from Theorem 1. The fact that is from [GGJList], see Theorem 8 in the Related Work section.

As a second consequence, Theorem 1 separates from , but in a different sense. For let be the irreflexive graph obtained from the -leaf star by subdividing each edge. The graph is depicted in Figure 4 on page 4. From Goldberg and Jerrum [GJTreeHoms] it is known that the problem is AP-interreducible with the task of computing the partition function of the -state ferromagnetic Potts model [Potts1952] — a well-studied model from statistical physics. Despite extensive work on this problem [GJTreeHoms, GJ2012, Galanis2016] it is only known to be -hard but is not known to be -easy or to be -hard (with respect to AP-reductions).

###### Corollary 4.

Let be an integer with . and are separated subject to the assumption that approximately computing the partition function of the -state ferromagnetic Potts model is not -hard. In particular, it follows from Theorem 1 that .

In addition to these separations, we show that approximately counting retractions is at least as hard as approximately counting surjective homomorphisms and also at least as hard as approximately counting compactions. The latter is surprising as it is in contrast to known results for the corresponding exact counting problems (see Figure 2). Our proof uses an interesting Monte Carlo approach to AP-reductions and more details on this method are given in Section 1.3. The approach gives analogous reductions for the list versions of these problems for free.

###### Theorem 5.

Let be a graph. Then and .

###### Theorem 6.

Let be a graph. Then and .

Using Theorem 5 and Corollary 3 we can deduce that and are also separated subject to the assumption that and are not AP-interreducible. The same holds for and . Moreover, from Theorem 6 it follows that we can replace the problem with or in these separations.

Our reductions and allow us to state new -easiness results which are not limited to graphs of girth at least , namely the -easiness results in the following corollary.

###### Corollary 7.

Let be one of the following:

• A reflexive proper interval graph but not a complete graph.

• An irreflexive bipartite permutation graph but not a complete bipartite graph.

Then , and are -equivalent.

The -easiness results in Corollary 7 come from our Theorem 5 together with Observation 2 and the -easiness results for given in Theorem 8 on page 8. The corresponding -hardness comes from [FGZ2017, Theorem 35]).

The proof of Theorem 1 is given in Section 2.3. Theorem 5 is proved in Section 3.1 in the form of Corollaries 49 and 51. The proof of Theorem 6 is in Section 3.2.

### 1.3 Methods

In the proof of Theorem 1 we use several different techniques. In the -easiness proof for partially bristled reflexive paths (Lemma 19) we build upon a technique that was introduced by Dyer et al. [DGGJApprox] and extended by Kelk [KelkThesis] to reduce the problem of approximately counting homomorphisms to the problem of approximately counting the downsets of a partial order. In order to obtain more general results, we formalise this technique and use it in the context of the constraint satisfaction framework. This framework is convenient for generating -easiness results, not only for counting homomorphisms but also for counting retractions, both in the setting of undirected graphs (as used in this work) and even in the setting of directed graphs.

In order to obtain the -hardness part of Theorem 1, we analyse, and classify, different local structures in graphs. The most difficult part is Lemma 45 which analyses distance- neighbourhood structures as defined in Section 1.5. This lemma requires intricate gadgets (based on simpler versions used in [DGGJApprox] and [KelkThesis]), rather careful analysis, and classifying homomorphisms by type. Other -hardness results are easier to come by. For instance, we use modifications of, and a more careful analysis of, a gadget from [GJTreeHoms] to prove the -hardness for irreflexive square-free graphs that have an induced subgraph (Lemma 17). Some hardness results are also based on -completeness results for the retraction decision problem that carry over to the approximate counting version.

The algorithms captured by the reductions and are based on a Monte Carlo approach (Lemma 48). We will discuss this approach here in the context of counting surjective homomorphisms to . The details, and the related approach for counting compactions, are described in Section 3.1. The Monte Carlo approach is applicable for a reduction from to because is a so-called self-reducible problem. Recall that the output of , given a graph and lists such that, for all , , is the number of homomorphisms from to . Using an oracle for approximating this number, it is also possible to sample a homomorphism from to approximately uniformly at random (following the general method of Jerrum, Valiant, and Vazirani [JVV1986]). A naive approach for sampling surjective homomorphisms (and hence for approximately counting them) is as follows: Start with an input  to . Let be the trivial set of lists . Using the oracle for , obtain a random homomorphism from to  (which is just a random homomorphism from  to ). Reject (and repeat) if this homomorphism is not surjective. Eventually, we obtain a random surjective homomorphism from to , as required. While this approach is certainly straightforward, it does not lead to an efficient algorithm for sampling surjective homomorphisms because the number of surjective homomorphisms might be very small compared to the total number of homomorphisms.

Our method to shrink the sample space is based on the following fact. For every surjective homomorphism from to there exists a constant-size set of vertices such that the restriction of to is already surjective. We can enumerate all these constant-size sets and use single vertex lists to fix their images. Consequently we obtain a (polynomial) number of instances of the problem . For let be the set of homomorphisms from to . Then the set of surjective homomorphisms from to is the union . The final building block of our reduction is the idea that we can sample the union by first sampling from the disjoint union . This idea is explained more generally, for instance, in [Mitzenmacher2017]. The point is, that we can sample uniformly from by using a oracle, and the union is relatively dense in the disjoint union (its size is at least ). So we can obtain a sample from

. Then the samples can be combined to obtain, with high probability, an approximate count. A lot of AP-reductions are based on the use of gadgets and we have not seen the use of Monte Carlo algorithms in AP-reductions before.

### 1.4 Related Work

Let be a graph. It is well-known that the complexity of is determined by the maximum complexity for a connected component of . In the connected case the complexity is determined by the following theorem by Galanis et al. [GGJList].

###### Theorem 8 ([GGJList]).

Let be a connected graph.

1. If is an irreflexive complete bipartite graph or a reflexive complete graph, then is in .

2. Otherwise, if is an irreflexive bipartite permutation graph or a reflexive proper interval graph, then is -equivalent under AP-reductions.

3. Otherwise, is -equivalent under AP-reductions.

From our Theorem 1 and Theorem 8 we immediately obtain the separation between and given in Corollary 3. Note that when restricting to irreflexive or reflexive graphs, the classification of for graphs of girth at least is identical to the corresponding classification of the problem . A separation between these problems only occurs for graphs with at least one looped and one unlooped vertex.

The complexity of approximately counting homomorphisms in the absence of lists is still far from being resolved. Galanis, Goldberg and Jerrum [GGJBIS] give a dichotomy for the problem in terms of .

###### Theorem 9 ([Ggjbis]).

Let be a connected graph. If is a reflexive complete graph or an irreflexive complete bipartite graph, then admits an FPRAS. Otherwise, .

Surprisingly, even for the subclass of problems where is an irreflexive tree, the complexity of approximately counting homomorphisms is not completely classified. The following partial classification, originally due to Goldberg and Jerrum [GJTreeHoms], follows from Theorems 8 and 9.

###### Theorem 10 ([GJTreeHoms]).

Let be an irreflexive tree.

1. If is a star, then is in .

2. Otherwise, if is a caterpillar, then is -equivalent under AP-reductions.

3. Otherwise, is -hard under AP-reductions.

Note that, in general, for irreflexive trees that are neither stars nor caterpillars it is open whether approximately counting homomorphisms is -equivalent, -hard or even none of the two. It is only known that AP-reduces to . However, there exist trees for which is -equivalent with respect to AP-reductions (see [GJTreeHoms, Section 5]).

The decision version of the retraction problem is formally defined as follows.111 The literature is slightly inconsistent in the sense that the decision problem is often defined without the restriction that is irreflexive. It is easy to see that the two versions (with and without the restriction) are polynomial-time interreducible since a looped vertex of with list can be replaced with an irreflexive clique of size (all of whose members have list ) without changing whether or not there is a homomorphism to . Thus, results stated for one version apply to the other.

Name: . Input: An irreflexive graph and a collection of lists such that, for all , . Output: Is positive?

is completely classified as a result of the recent proof of the CSP dichotomy conjecture [BulatovCSPDichotomy, ZhukCSPDichotomy]. However, these proofs do not give a graph-theoretical characterisation. Feder, Hell, Jonsson, Krokhin and Nordh [FederPseudoForest, Corollary 4.2, Theorem 5.1] give the following graph-theoretical characterisation for pseudotrees, where a pseudotree is a graph with at most one cycle. A graph is called loop-connected if, for every connected component of , the looped vertices in induce a connected subgraph of .

###### Theorem 11 ([FederPseudoForest]).

Let be a pseudotree. Then is -complete if any of the following hold:

• is not loop-connected,

• contains a cycle of size at least ,

• contains a reflexive cycle of size or

• contains an irreflexive cycle of size .

Otherwise is in .

Finally, the complexity of exactly counting retractions is completely classified. It is in if every connected component of is a reflexive complete graph or an irreflexive complete bipartite graph and -complete otherwise [FGZ2017].

### 1.5 Preliminaries

For a positive integer let . As partially bristled reflexive paths appear in a number of our results we give a more formal definition of this class of graphs. We also give an example in Figure 3.

###### Definition 12.

A partially bristled reflexive path is a reflexive path, or a tree with the following form. Let be a positive integer and let be a non-empty subset of . Then and .

For a graph and a vertex we define the (distance-) neighbourhood of as . Similarly, the distance- neighbourhood of is defined as . Let be a subset of . Then is the set of common neighbours of the vertices in . The set of vertices that have a neighbour in is denoted by .

We will also use the concept of induced graphs. Given a subset of , the graph is called the subgraph of induced by . The graph is a subgraph of if and .

For the complexity theory part of our work we restate some standard definitions taken from [Mitzenmacher2017, Definitions 11.1, 11.2, Exercise 11.3]. A randomised algorithm gives an -approximation for the value  if the output  of the algorithm satisfies . Slightly overloading the notation, an -approximation for a problem is a randomised algorithm which, given an input  and parameters , outputs an -approximation for . A randomised approximation scheme (RAS) for a problem is a -approximation of . A RAS is called fully polynomial (FPRAS) if it runs in time that is polynomial in  and the size of the input .

For the technical definition of an approximation-preserving reduction (AP-reduction) we refer to [DGGJApprox]. Intuitively, an AP-reduction from a problem  to a problem  is an algorithm that yields an FPRAS for  if it has access to an FPRAS for .

Sometimes it is useful to switch between different notions of accuracy. To this end we use the following observation which follows immediately from the Taylor expansion of the exponential function.

###### Observation 13.

Let be in . Then and .

We conclude this section with some simple remarks regarding the connectivity of graphs when investigating the complexity of counting retractions. We will show that in the context of approximately counting retractions we can restrict to connected graph without loss of generality. We define the following problem which restricts the input to connected graphs.

Name: . Input: An irreflexive connected graph and a collection of lists such that, for all , . Output: .

The following observation is well known.

###### Observation 14.

Let be a graph. Then .

###### Proof.

The fact that is trivial. We now show that . Let be an instance of and let be the desired precision. Let be the connected components of . For each , let . Then . The algorithm which, for each , makes a oracle call with precision and input , and returns the product of outputs, approximates with the desired precision. ∎

###### Remark 15.

Let be a graph with connected components and let be an input to . For let and let . Then, as is connected, it holds that

 N((G,S)→H)=∑j∈[k]N((G,Sj)→Hj).

Therefore, given an oracle for for each , we obtain an algorithm for . By Observation 14 this means that given an oracle for for each , we obtain an algorithm for .

In the opposite direction, it is straightforward to see that for each we have (and therefore ). The details are as follows: Let be an input to . If all lists in have size , computing is trivial. Otherwise we fix some vertex with . For each and we define

and . As is connected, a homomorphism from to maps all vertices of to the same connected component of . Therefore, . This shows that calls to a oracle are sufficient to approximate the number of retractions to a component of .

## 2 Approximately Counting Retractions to Graphs without short Cycles

First we study the complexity of approximately counting retractions to graphs of girth at least . We start off by restricting to irreflexive graphs in Section 2.1. The corresponding classification (Theorem 18) is for irreflexive square-free graphs. Subsequently, in Section 2.2, we consider graphs that have at least one loop.

### 2.1 Irreflexive Square-free Graphs

The goal of this section is to prove Theorem 18. The most difficult part is Lemma 17, which shows that, if is a square-free graph containing an induced , then .

The proof of Lemma 17 generalises ideas from the proof of Lemma 3.6 of [GJTreeHoms], so we start with some definitions from there. A multiterminal cut of a graph with distinguished vertices , and (called terminals) is a set of edges that disconnects the terminals (i.e. ensures that there is no path in that connects any two distinct terminals). The size of a multiterminal cut is its cardinality. We consider the following computational problem.

Name: . Input: A connected irreflexive graph with distinct terminals and a positive integer . The input has the property that every multiterminal cut has size at least . Output: The number of size- multiterminal cuts of with terminals , and .

For motivation we consider the case where is a tree. Suppose that is an irreflexive tree with an induced , labelled as in Figure 4. Lemma 3.6 of [GJTreeHoms] gives an AP-reduction from to the problem of counting “weighted” homomorphisms to . In fact, the weights used in the proof are Boolean values, so the proof actually reduces to the problem of counting list homomorphisms to . Given an input of , a homomorphism instance is created in which lists ensure that the terminals , and are mapped to the vertices , and of , respectively. Lists also ensure that all other vertices of are mapped to . Finally, lists ensure that all remaining vertices of the homomorphism instance are mapped to the vertices of . Our proof shows how to refine the gadgets so that lists have size  or size . Thus, our reduction is to the more refined problem . We also show how to handle graphs  that are not trees (as long as they are square-free). The details are given in the proof of Lemma 17. We use the following technical lemma, known as Dirichlet’s approximation lemma, which bounds the extent to which reals can be approximated by integers. Using this lemma is a standard technique in this line of research (see for instance [GGJBIS]).

###### Lemma 16 ([Schmidt1991, p. 34]).

Let be real numbers and be a natural number. Then there exist positive integers with such that for every

Using Lemma 16, we can prove our main lemma.

###### Lemma 17.

Let be a square-free graph that contains an induced . Then .

###### Proof.

Suppose that is a square-free graph with vertices and an induced , which we label as shown in Figure 4. The problem is shown in [GJTreeHoms, Lemma 3.5] to be equivalent to with respect to AP-reductions. We will give a reduction from to .

Let , , , , be an instance of with and let be an error bound in . From this instance we construct an input to as follows. Each of the terminals , and will be vertices of . will also have a vertex  which is distinct from , and . Let , and be positive integers (we will give their precise values later). For every edge we define the set of vertices

 V′(e)={(e,α,1),…,(e,α,sα),(e,β,1),…,(e,β,sβ),(e,γ,1),…,(e,γ,sγ)}.

The label “” in the name of the vertex indicates that, in the instance , this vertex will be adjacent to . The labels “” and “” are similar. The label “” in the name of the vertex indicates that this vertex is in .

For each edge we then define a graph with vertex set . Note that the vertices in are distinct for each edge whereas , , and are identical for all . The edge set of the graph is defined as shown in Figure 5.

Then we define . Intuitively, is constructed from the graph by replacing each edge with the corresponding graph . Since is connected, every vertex is a member of some edge in . This ensures that is an edge of .

Next we define the set of lists in the instance . We set , , , and for all . Then we define . This is depicted in Figure 6.

We now show how a multiterminal cut of corresponds to a certain set of homomorphisms from to . Every multiterminal cut of induces a partition of into connected components. These are the connected components of . Let be the number of these components. Let be the set of neighbours of vertex  in and let be the degree of  in . Let be the set of functions such that

• maps the vertices of the components containing the terminals , , and to , and , respectively, and

• the set of bichromatic edges is exactly the cut .

Then

 (1)

Now, for every , let . Note that is the set of monochromatic edges in whose endpoints are mapped to . Similarly, let and .

Given a multiterminal cut  of  and a map , we say that a homomorphism agrees with if, for all , we have . Let be the set of all that agree with . Given a multiterminal cut  of  we say that a homomorphism agrees with  if there is a such that agrees with . Let be the number of homomorphisms from to that agree with the cut .

Now consider a multiterminal cut  of . We will bound by considering two cases.

Case 1: .

If then, since is connected, the input has a multiterminal cut of size less than , which contradicts the definition of . Hence, it must be the case that , which means that . For the single we have . We will consider the possible homomorphisms .

Let be the degrees of , and in , respectively.

• Consider any edge of that is not in the cut . Then, as , has to be in ,