Approximate counting CSP seen from the other side
aa r X i v : . [ c s . CC ] J a n Approximate counting CSP seen from the other side ∗ Andrei A. BulatovSchool of Computing Science, Simon Fraser University, Canada [email protected]
Stanislav ˇZivn´yDepartment of Computer Science, University of Oxford, UK [email protected]
Abstract
In this paper we study the complexity of counting Constraint SatisfactionProblems (CSPs) of the form C , − ) , in which the goal is, given arelational structure A from a class C of structures and an arbitrary structure B , to find the number of homomorphisms from A to B . Flum and Groheshowed that C , − ) is solvable in polynomial time if C has boundedtreewidth [FOCS’02]. Building on the work of Grohe [JACM’07] on decisionCSPs, Dalmau and Jonsson then showed that, if C is a recursively enumerableclass of relational structures of bounded arity, then assuming FPT = C , − ) solvable exactly in polynomial time(or even fixed-parameter time) [TCS’04].We show that, assuming FPT = W[1] (under randomised parameterisedreductions) and for C satisfying certain general conditions, C , − ) is not solvable even approximately for C of unbounded treewidth; that is,there is no fixed parameter tractable (and thus also not fully polynomial)randomised approximation scheme for C , − ) . In particular, our con-dition generalises the case when C is closed under taking minors. The Constraint Satisfaction Problem (CSP) asks to decide the existence of a ho-momorphism between two given relational structures (or to find the number ofsuch homomorphisms). It has been used to model a vast variety of combinatorial ∗ An extended abstract of this work appeared in the
Proceedings of the 44th International Sympo-sium on Mathematical Foundations of Computer Science (MFCS’19) [6]. Andrei Bulatov was sup-ported by an NSERC Discovery grant. Stanislav ˇZivn´y was supported by a Royal Society UniversityResearch Fellowship. This project has received funding from the European Research Council (ERC)under the European Union’s Horizon 2020 research and innovation programme (grant agreement No714532). The paper reflects only the authors’ views and not the views of the ERC or the EuropeanCommission. The European Union is not liable for any use that may be made of the informationcontained therein. C and D be two classes of relational structures. In this paper wewill assume that structures from C , D only have predicate symbols of bounded arity.The constraint satisfaction problem (CSP) parameterised by C and D is the follow-ing computational problem, denoted by CSP( C , D ) : given A ∈ C and B ∈ D ,is there a homomorphism from A to B ? CSPs in which both input structures arerestricted have not received much attention (with a notable exception of matrixpartitions [21, 22] and assorted graph problems on restricted classes of graphs).However, the two most natural restrictions have been intensively studied over thelast two decades. Let − denote the class of all (bounded-arity) relational structures,or, equivalently, indicate that there are no restrictions on the corresponding inputstructure.Problems of the form CSP( − , { B } ) , where B is a fixed finite relational struc-ture, are known as nonuniform or language-restricted CSPs [35]. For instance, if B = K is the complete graph on vertices then CSP( − , { B } ) is the standard 3-C OLOURING problem [29]. The study of nonuniform CSPs has been initiated bySchaefer [43] who considered the case of
CSP( − , { B } ) for 2-element structures B . The complexity of CSP( − , { H } ) , for a fixed graph H , was studied under thename of H -colouring by Hell and Neˇsetˇril [34]. General nonuniform CSPs havebeen studied extensively since the seminal paper of Feder and Vardi [23] who inparticular proposed the so-called Dichotomy Conjecture stating that every nonuni-form CSP is either solvable in polynomial time or is NP-complete. The complexityof nonuniform CSPs has been resolved only recently in two independent papersby Bulatov [3] and Zhuk [44], which confirmed the dichotomy conjecture of Federand Vardi and also its algebraic version [4].CSPs restricted on the other side, that is, of the form CSP( C , − ) , where C is a fixed (infinite) class of finite relational structures, are known as structurally-restricted CSPs. For instance, if C = ∪ k ≥ { K k } is the class of cliques of all sizesthen CSP( C , − ) is the standard C LIQUE problem [29]. In this case the complexityof CSPs is related to various “width” parameters of the associated class of graphs.For a relational structure A let G ( A ) denote the Gaifman graph of A , that is, thegraph whose vertices are the elements of A , and vertices v, w are connected withan edge whenever v and w occur in the same tuple of some relation of A . Then G ( C ) denotes the class of Gaifman graphs of structures from C , and we refer tothe treewidth of G ( A ) as the treewidth of A . Dalmau, Kolaitis, and Vardi showedthat CSP( C , − ) is in PTIME if C has bounded treewidth modulo homomorphicequivalence [11]. Grohe then showed that, assuming FPT = W[1], there are noother cases of (bounded arity)
CSP( C , − ) solvable in polynomial time (or evenfixed-parameter time, where the parameter is the size of the left-hand side struc-ture) [31]. The case of structures with unbounded arity was extensively studied byGottlob et al. who introduced the concept of bounded hypertree width in an attemptto characterise structurally restricted CSPs solvable in polynomial time [30]. The2earch for a right condition is still going on, and the most general structural prop-erty that guarantees that CSP( C , − ) is solvable in polynomial time is fractional hy-pertree width introduced by Grohe and Marx [32]. Finally, Marx showed that themost general condition, assuming the exponential-time hypothesis, that capturesstructurally-restricted CSPs solvable in fixed-parameter time is that of submodularwidth [36].An important problem related to the CSP is counting: Given a CSP instance,that is, two relational structures A and B , find the number of homomorphisms from A to B . We again consider restricted versions of this problem. More precisely, fortwo classes C and D of relational structures, C , D ) denotes the followingcomputational problem: given A ∈ C and B ∈ D , how many homomorphismsare there from A to B ? This problem is referred to as a counting CSP. Similar todecision CSPs, problems of the form − , D ) and C , − ) are the twomost studied ways to restrict the counting CSP, and the research on these problemsfollows a similar pattern as their decision counterparts.For a fixed finite relational structure B , the complexity of the nonuniform prob-lem − , { B } ) was characterised for graphs by Dyer and Greenhill [18] andfor 2-element structures by Creignou and Hermann [9]. The complexity of thegeneral nonuniform counting CSPs was resolved by Bulatov [5] and Dyer andRicherby [19]. As in the case of the decision version the complexity of nonuniformcounting CSPs is determined by their algebraic properties, and every such CSP iseither solvable in polynomial time or is C , − ) is solvable in polynomial time if C has bounded treewidth [24]. Dalmau andJonsson then showed that, assuming FPT = C , − ) solvable exactly in polynomial time (or, again, evenfixed-parameter time) [10]. Note that the result of Dalmau and Jonsson states thatthe class C itself has to be of bounded treewidth, while in Grohe’s characterisa-tion of polynomial-time solvable decision CSPs of the form CSP( C , − ) it is theclass of cores of structures from C that has to have bounded treewidth. Therehas also been some research on counting problems over structures of unboundedarity. First, it was showed that notions sufficient for polynomial-time solvabil-ity of decision CSPs can be lifted to the problem of counting CSPs. In partic-ular, the polynomial-time solvability of C , − ) was shown by Pichler andSkritek for C of bounded hypertree width [40], by Mengel for C of bounded frac-tional hypertree width [38], and finally by Farnqvist for C of bounded submodularwidth [20]. Secondly, the work of Brault-Baron et al. showed that the (unboundedarity) structurally-restricted C , − ) are solvable in polynomial time for theclass C of β -acyclic hypergraphs [2]. Brault-Baron et al. [2] show their tractability results for so-called CSPs with default values, ε ∈ (0 , returns in time polynomial in the size of theinstance and ε − a result which is with high probability a multiplicative (1 + ε ) -approximation of the exact solution. The parameterised version of this algorith-mic model is known as a Fixed Parameter Tractable Randomised ApproximationScheme (FPTRAS). However, unlike exact counting or the decision CSP, it is notvery likely there is a concise and clear complexity classification. For instance, Dyeret al. [16] identified a sequence of counting CSPs, Bipartite q -Colouring, that arelikely to attain an infinite hierarchy of approximation complexities. Only a handfulof results exist for the approximation complexity of counting nonuniform CSPs.The approximation complexity of − , { B } ) for 2-element structures B wascharacterised by Dyer et al. [17], where a trichotomy theorem was proved: for ev-ery 2-element structure B the problem − , { B } ) either admits an FPRAS,or is interreducible with B is a connected graph and − , { B } ) does not admit an FPRAS, then Gala-nis, Goldberg and Jerrum [27] showed that − , { B } ) is at least as hard as B a complexity classification of − , { B } ) can be extracted from the results of Chen et al. [8], see also [28]. Our Contribution
It should be clear by now that the picture painted by the shortsurvey above misses one piece: the approximation complexity of structurally re-stricted CSPs. This is the main contribution of this paper.Let C be a class of bounded-arity relational structures. If the treewidth of C modulo homomorphic equivalence is unbounded then, by Grohe’s result [31], it ishard to test for the existence of a homomorphism from A to B , where A ∈ C ,for any instance A , B of CSP( C , − ) . Using standard techniques (see, e.g., theproof of [37, Proposition 3.16]), this implies, assuming that FPT = C , − ) , let alone an FPRAS. Consequently, the tractability boundary for ap-proximate counting of C , − ) lies between bounded treewidth and boundedtreewidth modulo homomorphic equivalence.As our main result, we show that for C such that a certain class of graphs (tobe defined later) is a subset of G ( C ) , C , − ) cannot be solved even approx-imately for C of unbounded treewidth, assuming FPT = W[1] (under randomised which in particular includes C , − ) as defined here. Chen et al. [8] studied the weighted version of − , { B } ) , and although their result doesnot provide a complete characterisation of the weighted problem, it allows to determine the complex-ity of − , { B } ) as defined here. CSP( C , − ) or C , − ) is usually proved.We follow the hardness proof of Grohe for decision CSPs [31], which waslifted to exact counting CSPs by Dalmau and Jonsson [10]. In fact Grohe’s resulthad an important precursor [33]. The key idea is a reduction from the parame-terised C LIQUE problem to
CSP( C , − ) . Let G = ( V, E ) and k be an instance ofthe p -C LIQUE problem, where k is the parameter. Broadly speaking, the reductionworks as follows. For a class of unbounded treewidth, the Excluded Grid Theo-rem of Robertson and Seymour [42] guarantees the existence of the ( k × (cid:0) k (cid:1) ) -grid(as a minor of some structure A ∈ C ), which is used to encode the existence of a k -clique in G as a certain structure B . The encoding usually means that G has a k -clique if and only if there is a homomorphism from A to B whose image coversa copy of the grid built in B . For decision CSPs, the correctness of the reduction— that there are no homomorphisms from A to B not satisfying this condition— is achieved by dealing with coloured grids [33] or by dealing with structureswhose cores have unbounded treewidth (with another complication caused by mi-nor maps) [31]. For the complexity of exact counting CSPs, the correctness of thereduction [10] is achieved by employing interpolation or the inclusion-exclusionprinciple, a common tool in exact counting.None of these two methods can be applied to approximate solving C , − ) .We cannot assume that the class of cores of C has unbounded treewidth, becausethen by [31] even the decision problem cannot be solved in polynomial time, whichimmediately rules out the existence of an FPRAS. Interpolation techniques suchas the inclusion-exclusion principle are also well known to be incompatible withapproximate counting. The standard tool in approximate counting to achieve thesame goal of prohibiting homomorphisms except ones from a certain restrictedtype, is to use gadgets to amplify the number of homomorphisms of the requiredtype. We give a reduction from p - LIQUE to C , − ) by using “fan-grids”,formally introduced in Section 3.3. Unfortunately, due to the delicate nature ofapproximation preserving reductions, we cannot use minors and minor maps andhave to assume that “fan-grids” themselves are present in G ( C ) . (In Section 5,we will briefly discuss how a weaker assumption can be used to obtain the sameresult.) By the Excluded Grid Theorem [42], if C is closed under taking minors ,then G ( C ) contains all the fan-grids (details are given in Section 3.3 and in par-ticular in Lemma 4). Thus, the classes C for which we establish the hardness of C , − ) includes all classes C that are closed under taking minors. We remark that the hardness for C closed under taking minors follows from Grohe’s classifica-tion [31] of decision CSPs. Indeed, for C of unbounded treewidth, the Excluded Grid Theorem [42]gives grids of arbitrary sizes. Since every planar graph is a minor of some grid [12], C contains allplanar graphs. As there exist planar graphs of arbitrarily large treewidth that are also minimal withrespect to homomorphic equivalence, Grohe’s result gives W[1]-hardness of CSP( C , − ) and hence C , − ) cannot have an FPRAS/FPTRAS. Preliminaries N denotes the set of positive integers. For every n ∈ N , we let [ n ] = { , . . . , n } . A relational signature is a finite set τ of relation symbols R , each with a specifiedarity ar ( R ) . A relational structure A over a relational signature τ (or a τ -structure,for short) is a finite universe A together with one relation R A ⊆ A ar ( R ) for eachsymbol R ∈ τ . The size k A k of a relational structure A is defined as k A k = | τ | + | A | + X R ∈ τ | R A | · ar ( R ) . Let R be a binary relational symbol. We will sometimes view graphs as { R } -structures.A homomorphism from a relational τ -structure A (with universe A ) to a rela-tional τ -structure B (with universe B ) is a mapping ϕ : A → B such that for all R ∈ τ and all tuples x ∈ R A we have ϕ ( x ) ∈ R B .Two structures A and B are homomorphically equivalent if there is a homo-morphism from A to B and a homomorphism from B to A .Let C be a class of relational structures. We say that C has bounded arity ifthere is a constant r ≥ such that for every τ -structure A ∈ C and R ∈ τ , we havethat ar ( R ) ≤ r . The notion of treewidth, introduced by Robertson and Seymour [41], is a well-known measure of the tree-likeness of a graph [12]. Let G = ( V ( G ) , E ( G )) be agraph. A tree decomposition of G is a pair ( T, β ) where T = ( V ( T ) , E ( T )) is atree and β is a function that maps each node t ∈ V ( T ) to a subset of V ( G ) suchthat1. V ( G ) = S t ∈ V ( T ) β ( t ) ,2. for every u ∈ V ( G ) , the set { t ∈ V ( T ) | u ∈ β ( t ) } induces a connectedsubgraph of T , and3. for every edge { u, v } ∈ E ( G ) , there is a node t ∈ V ( T ) with { u, v } ⊆ β ( t ) .The width of the decomposition ( T, β ) is max {| β ( t ) | | t ∈ V ( T ) } − . The treewidth tw ( G ) of a graph G is the minimum width over all its tree decomposi-tions.Let A be a relational structure over relational signature τ . The Gaifman graph (also known as primal graph ) of A , denoted by G ( A ) , is the graph whose vertexset is the universe of A and whose edges are the pairs ( u, v ) for which there is atuple x and a relation symbol R ∈ τ such that u, v appear in x and x ∈ R A .6et C be a class of relational structures. We say that C has bounded treewidth if there exists w ≥ such that tw ( A ) = tw ( G ( A )) ≤ w for every A ∈ C .We say that C has bounded treewidth modulo homomorphic equivalence if thereexists w ≥ such that every A ∈ C is homomorphically equivalent to A ′ with tw ( A ′ ) ≤ w .A graph H is a minor of a graph G if H is isomorphic to a graph that canbe obtained from a subgraph of G by contracting edges (for more details, see,e.g., [12]).For k, ℓ ≥ , the ( k × ℓ ) -grid is the graph with the vertex set [ k ] × [ ℓ ] and anedge between ( i, j ) and ( i ′ , j ′ ) iff | i − i ′ | + | j − j ′ | = 1 . Treewidth and minors areintimately connected via the celebrated Excluded Grid Theorem of Robertson andSeymour. Theorem 1 ([42]) . For every k there exists a w ( k ) such that the ( k × k ) -grid is aminor of every graph of treewidth at least w ( k ) . Let C be a class of relational structures. We say that C if closed under takingminors if for every A ∈ C and for every minor H of G ( A ) , there is a structure A ′ ∈ C such that G ( A ′ ) is isomorphic to H . Let C be a class of relational structures. We will be interested in the computationalcomplexity of the following problem. Name: C , − ) Input:
Two relational structures A and B over the same signature with A ∈ C . Output:
The number of homomorphisms from A to B .We say that C , − ) is in FP, the class of function problems solvable in polynomial time , if there is a deterministic algorithm that solves any instance A , B of C , − ) in time ( k A k + k B k ) O (1) .We will also consider the parameterised version of C , − ) . Name: p - C , − ) Input:
Two relational structures A and B over the same signature with A ∈ C . Parameter: k A k . Output:
The number of homomorphisms from A to B .We say that p - C , − ) is in FPT, the class of problems that are fixed-parameter tractable , if there is a deterministic algorithm that solves any instance A , B of p - C , − ) in time f ( k A k ) ·k B k O (1) , where f : N → N is an arbitrarycomputable function. 7he class W[1], introduced in [13], can be seen as an analogue of NP in pa-rameterised complexity theory. Proving W[1]-hardness of a problem (under a pa-rameterised reduction which may be randomised), is a strong indication that theproblem is not solvable in fixed-parameter time as it is believed that FPT = W[1].For counting problems, = = Theorem 2 ([10]) . Assume FPT = C be a recursively enumerable class of relational structures of bounded arity. Then,the following are equivalent:1. C , − ) is in FP.2. p - C , − ) is in FPT.3. C has bounded treewidth. The following problem is an example of a
Name: p - LIQUE
Input:
A graph G and k ∈ N . Parameter: k . Output:
The number of cliques of size k in G .Note that p - LIQUE can be modelled as p - C , − ) if we set C to be theset of cliques of all possible sizes. The decision version of p - LIQUE was shownto be W[1]-hard by Downey and Fellows [14].
Name: p -C LIQUE
Input:
A graph G and k ∈ N . Parameter: k . Output:
Decide if G contains a clique of size k . In view of our complete understanding of the exact complexity of C , − ) for C of bounded arity (cf. Theorem 2), we will be interested in approximation algorithms for C , − ) . In particular, are there any new classes C of boundedarity for which the problem C , − ) can be solved efficiently (if only ap-proximately)? We will provide a partial answer to this question (cf. Theorem 3):8or certain general bounded-arity classes C (which include classes that are closedunder taking minors ), the answer is no!The notion of efficiency for approximate counting is that of a fully polynomialrandomised approximation scheme [39] and its parameterised analogue, a fixedparameter tractable randomised approximation scheme, originally introduced byArvind and Raman [1]. We now define both concepts.A randomised approximation scheme (RAS) for a function f : Σ ∗ → N isa randomised algorithm that takes as input ( x, ε ) ∈ Σ ∗ × (0 , and produces asoutput an integer random variable X satisfying the condition Pr( | X − f ( x ) | ≤ εf ( x )) ≥ / . A RAS for a counting problem is called fully polynomial (FPRAS)if on input of size n it runs in time p ( n, ε − ) for some fixed polynomial p . ARAS for a parameterised counting problem is called fixed parameter tractable (FP-TRAS) if on input of size n with parameter k it runs in time f ( k ) · p ( n, ε − ) , where p is a fixed polynomial and f is an arbitrary computable function.To compare approximation complexity of (parameterised) counting problemstwo types of reductions are used. Suppose f, g : Σ ∗ → N . An approximationpreserving reduction (AP-reduction) [16] from f to g is a probabilistic oracle Tur-ing machine M that takes as input a pair ( x, ε ) ∈ Σ ∗ × (0 , , and satisfies thefollowing three conditions: (i) every oracle call made by M is of the form ( w, δ ) ,where w ∈ Σ ∗ is an instance of g , and < δ < is an error bound satisfy-ing δ − ≤ poly ( | x | , ε − ) ; (ii) the TM M meets the specification for being a ran-domised approximation scheme for f whenever the oracle meets the specificationfor being a randomised approximation scheme for g ; and (iii) the running time of M is polynomial in | x | and ε − .Similar to [37] we also use the parameterised version of AP-reductions. Again,let f, g : Σ ∗ → N . A parameterised approximation preserving reduction (parame-terised AP-reduction) from f to g is a probabilistic oracle Turing machine M thattakes as input a triple ( x, k, ε ) ∈ Σ ∗ × (0 , , and satisfies the following three con-ditions: (i) every oracle call made by M is of the form ( w, k ′ , δ ) , where w ∈ Σ ∗ isan instance of g , k ′ ≤ h ( k ) for some computable function h , and < δ < is anerror bound satisfying δ − ≤ poly ( | x | , ε − ) ; (ii) the TM M meets the specificationfor being a randomised approximation scheme for f whenever the oracle meets thespecification for being a randomised approximation scheme for g ; and (iii) M isfixed-parameter tractable with respect to k and polynomial in | x | and ε − . The following concept plays a key role in this paper. Let k, r, ℓ , ℓ ∈ N with k, r ≥ . Intuitively, the fan-grid is a ( k × r ) -grid with extra degree-one vertices attachedto certain special (called “fan”) vertices. Formally, the fan-grid L ( k, r, ℓ , ℓ ) isa graph with vertex set L ∪ L , where L = { ( i, p ) | i ∈ [ k ] , p ∈ [ r ] } , L = M ∪ · · · ∪ M , where M , . . . , M are disjoint and | M i | = ℓ for i ∈ [4] , and | M i | = ℓ for i ∈ { , . . . , } . Vertices from L will be called grid vertices .Vertices u = (1 , , u = (1 , r ) , u = ( k, , u = ( k, r ) , u = (1 , , u = ℓ = 4 and ℓ = 3 . Fan vertices are shownby larger dots. (1 , r − , u = ( k, , u = ( k, r − , u = (3 , , u = (4 , r ) , u = ( k − , , u = ( k − , r ) will be called fan vertices , and u , u , u , u will be called cornervertices . The edges of the fan grid are as follows: ( i, p )( i ′ , p ′ ) for | i − i ′ | + | p − p ′ | =1 , and wu i for each w ∈ M i and i ∈ [12] , see Figure 1.We call a class C of relational structures of bounded arity a fan class if either C has bounded treewidth or for any parameters k, r, ℓ , ℓ ∈ N we have that G ( C ) contains the fan-grid L ( k, r, ℓ , ℓ ) .The following is our main result. Theorem 3 ( Main ) . Assume FPT = W[1] under randomised parameterised reduc-tions. Let C be a recursively enumerable class of relational structures of boundedarity. If C is a fan class then the following are equivalent:1. C , − ) is polynomial time solvable.2. C , − ) admits an FPRAS.3. p - C , − ) admits an FPTRAS.4. C has bounded treewidth. Let C be a recursively enumerable class of relational structures of bounded arityand closed under taking minors. We claim that C is a fan class and thus Theorem 3applies to such C . For this we need Theorem 1. In particular, for any k, r, ℓ , ℓ ∈ N , if C is not of bounded treewidth then, by Theorem 1, G ( C ) contains an ( s × s ) -grid, where s = max( k + 2 ℓ , r + 2 ℓ ) , and thus also a ( k + 2 ℓ ) × ( r + 2 ℓ ) -grid.The following simple lemma then shows that fan-grids are minors of grids (ofappropriate size). 10 emma 4. L ( k, r, ℓ , ℓ ) is a minor of ( t × t ′ ) -grid, where t = k + 2 ℓ , t ′ = r + 2 ℓ and ℓ = max( ℓ , ℓ ) .Proof. Take the subgraph of the ( t × t ′ ) -grid as shown in Figure 2 and contract thepaths shown with thicker edges.Figure 2: Fan-grid as a minor. In the subgraph of the bigger grid shown in solidlines contract the thick edges. Conditions (1) and (4) in Theorem 3 are equivalent by Theorem 2. Implications“(1) ⇒ (2) ⇒ (3)” are trivial. Our main contribution is to prove the “(3) ⇒ (4)”implication.The main idea of the proof is as follows. Assuming that C , − ) admitsan FPTRAS for a fan class C , we will demonstrate that C has bounded treewidth.For the sake of contradiction, assume that C has unbounded treewidth. We will ex-hibit a parameterised reduction from p - LIQUE to p - C , − ) , which givesan FPTRAS for p - LIQUE assuming an FPTRAS for p - C , − ) . Given agraph G and an integer k , our reduction builds (in Section 4.1) a graph H = H ( G, k, W , W ) in such a way that the number of homomorphisms from a fan-grid L = L ( k, r, ℓ , ℓ ) (defined in Section 3.3) to H approximates the numberof k -cliques in G . Section 4.2 gives details on the number of possible homomor-phisms from H to L . (The numbers ℓ , ℓ , W , and W are carefully chosen tomake the reduction work.) Section 4.3 then fits the pieces together and describesthe reduction in detail. 11 .1 Construction Let G = ( V, E ) be a graph with n = | V | and m = | E | . Let k ∈ N . We constructa graph H ( G, k, W , W ) for W , W > n + m ) as follows. Let r = (cid:0) k (cid:1) andlet ̺ be a correspondence between [ r ] and the set of 2-element sets {{ i, j } | i, j ∈ [ k ] , i = j } . For i ∈ [ k ] and p ∈ [ r ] , we write i ∈ p as a shorthand for i ∈ ̺ ( p ) .The vertex set of H ( G, k, W , W ) is the union of two sets H ∪ H , defined by H = { ( v, e, i, p ) | v ∈ V, e ∈ E, and v ∈ e ⇐⇒ i ∈ p } ,H = K ∪ · · · ∪ K , where K , . . . , K are disjoint and | K i | = W for i ∈ [4] , | K i | = W for i ∈{ , . . . , } .As in fan-grids, vertices of the form ( v, e, , , ( v, e, , r ) , ( v, e, k, , ( v, e, k, r ) , ( v, e, , , ( v, e, , r − , ( v, e, k, , ( v, e, k, r − , ( v, e, , , ( v, e, , r ) , ( v, e, k − , , ( v, e, k − , r ) will be called fan vertices , and vertices of the form ( v, e, , , ( v, e, , r ) , ( v, e, k, , ( v, e, k, r ) will be called corner vertices .The edge set of H ( G, k, W , W ) consists of the following pairs: • ( v, e, i, p )( v ′ , e, i ′ , p ) such that | i − i ′ | = 1 ; • ( v, e, i, p )( v, e ′ , i, p ′ ) such that | p − p ′ | = 1 ; • u ( v, e, , for u ∈ S ⊆ K and ( v, e, , ∈ H , where S is an arbi-trary subset of K whose cardinality is such that the degree of ( v, e, , isexactly W . (Here we used that W > n + m ) , as ( v, e, , can have atmost n + m neighbours outside of K .)Similarly, u ( v, e, , r ) , u ( v, e, k, , u ( v, e, k, r ) , u ( v, e, , , u ( v, e, , r − , u ( v, e, k, , u ( v, e, k, r − , u ( v, e, , , u ( v, e, , r ) , u ( v, e, k − , , u ( v, e, k − , r ) for u ∈ S j ⊆ K j (for j = 2 , . . . , in this order) and ( v, e, , r ) , ( v, e, k, , ( v, e, k, r ) , ( v, e, , , ( v, e, , r − , ( v, e, k, , ( v, e, k, r − , ( v, e, , , ( v, e, , r ) , ( v, e, k − , , ( v, e, k − , r ) ∈ H ,where S , . . . , S are arbitrary subsets whose cardinality is such that thedegree of ( v, e, , r ) , ( v, e, k, , ( v, e, k, r ) is exactly W and the degree ofthe remaining vertices from the list is exactly W .We study homomorphisms from L ( k, r, ℓ , ℓ ) to H ( G, k, W , W ) . A homo-morphism ϕ : L ( k, r, ℓ , ℓ ) → H ( G, k, W , W ) is said to be corner-to-corner(or c-c for short) if ϕ (1 , , ϕ (1 , r ) , ϕ ( k, , ϕ ( k, r ) ∈ { ( v, e, , , ( v, e, , r ) , ( v, e, k, , ( v, e, k, r ) | v ∈ V, e ∈ E } . A homomorphism ϕ is called identity (skew identity) if ϕ ( i, p ) ∈ { ( v, e, i, p ) | v ∈ V, e ∈ E } (respectively, ϕ ( i, p ) ∈ { ( v, e, k − i + 1 , p ) | v ∈ V, e ∈ E } ) for all i ∈ [ k ] and p ∈ [ r ] . Sometimes we will abuse the terminology and call a (skew) A similar if slightly simpler construction is described and illustrated in [37, Section 4.1.1]. L (the set ofgrid vertices).We define the weight of a homomorphism ϕ from L ( k, r, ℓ , ℓ ) restricted to L (the set of grid vertices) to H ( G, k, W , W ) as the number of extensions of ϕ to a homomorphism from L ( k, r, ℓ , ℓ ) . We start with a simple lemma.
Lemma 5.
The weight of an identity or skew identity homomorphism is W ℓ W ℓ .Proof. Let ϕ be an identity or a skew identity homomorphism. The images ofvertices from L under ϕ are fixed, while vertices from L can be mapped by ϕ toany neighbour of the corresponding fan vertex independently. Since the degree ofa corner vertex ( v, e, i, p ) with i ∈ { , k } and p ∈ { , r } is W , and the degree ofany other fan vertex is W , the result follows.The next lemma, which will be proved using Lemma 5, is essentially [10,Lemma 3.1] adapted to our setting, which in turn builds on [31, Lemma 4.4]. Lemma 6.
Let N be the number of k -cliques in G . Then the total weight of identityand skew identity homomorphisms is N W ℓ W ℓ k ! .Proof. We will show that the total weight of identity homomorphisms is
N W ℓ W ℓ k ! .Observe that there is a bijection between the sets of identity and skew identity ho-momorphisms that maps an identity homomorphism ϕ to a skew identity one, ψ ,for which ψ ( i, p ) = ( v, e, k − , p ) whenever ϕ ( i, p ) = ( v, e, i, p ) . Thereforethe total weight of skew identity homomorphisms is also N W ℓ W ℓ k ! . First wegive a description of all identity homomorphisms. Let v , . . . , v k be the vertex setof a k -clique in G . For p ∈ [ r ] with ̺ ( p ) = { a, b } , let e p = v a v b be the edge in G between v a and v b . We define ϕ v ,...,v k : L → H by ϕ v ,...,v k (( i, p )) = ( v i , e p , i, p ) for every i ∈ [ k ] and p ∈ [ r ] .We will need two claims; the first one follows directly from the definition. Claim 1. ϕ v ,...,v k is an identity homomorphism from L to H . Claim 2. If ϕ is an identity homomorphism from L to H then ϕ = ϕ v ,...,v k forsome vertex set v , . . . , v k of a k -clique in G . Proof of Claim 2.
Let ϕ be an identity homomorphism from L to H .For every i ∈ [ k ] and p ∈ [ r ] , we have ϕ (( i, p )) = ( v, e, i, p ) for some v ∈ V and e ∈ E with v ∈ e ⇐⇒ i ∈ p . Let ϕ (( i ′ , p )) = ( v ′ , e ′ , i ′ , p ) . We claimthat (A) e = e ′ . We prove (A) for i ′ = i + 1 , the rest follows by induction.Since ϕ is a homomorphism and ( i, p )( i ′ , p ) is an edge in L ( k, r, ℓ , ℓ ) , there13s an edge ( v, e, i, p )( v ′ , e ′ , i ′ , p ) in H ( G, k, W , W ) . The definition of edges in H ( G, k, W , W ) implies that e = e ′ . Similarly, let ϕ (( i, p )) = ( v, e, i, p ) and ϕ (( i, p ′ )) = ( v ′ , e ′ , i, p ′ ) . We claim that (B) v = v ′ . For p ′ = p + 1 , this againfollows from the assumption that ϕ is a homomorphism and the definition of edgesin H ( G, K, W , W ) ; a simple induction establishes (B) for arbitrary values p, p ′ ∈ [ r ] . Together, claims (A) and (B) imply that there are vertices v , . . . , v k ∈ V andedges e , . . . , e r ∈ E such that for all i ∈ [ k ] and p ∈ [ r ] we have ϕ (( i, p )) =( v i , e p , i, p ) . Since ϕ (( i, p )) ∈ H , we have v i ∈ e p ⇐⇒ i ∈ p . Hence v , . . . , v k forms a k -clique in G . (End of proof of Claim 2.) Claims 1 and 2 give us a complete description of identity homomorphismsfrom L to H : a mapping ϕ from L to H is an identity homomorphisms if andonly if ϕ = ϕ v ,...,v k for some vertex set v , . . . , v k of a k -clique in G . Hence,the number of such mappings is the number of k -cliques in G multiplied by k ! .By Lemma 5, each identity homomorphism can be extended in W ℓ W ℓ distinctways to a homomorphism from L ( k, r, ℓ , ℓ ) to H ( G, k, W , W ) .We will frequently use the following simple observation. Observation 7.
Let ϕ be a homomorphism from a bipartite graph G to a bipartitegraph H . If vertices u, v are of distance m in G then ϕ ( u ) , ϕ ( v ) are of distance atmost m in H and the parity of the distances is the same. Next we establish an upper bound on the total weight of homomorphisms thatare neither identity nor skew identity.
Lemma 8.
Let G = ( V, E ) have n = | V | vertices and m = | E | edges, let k = 4 k ′ for some k ′ , and let T = log W W . If ℓ > T ℓ T − , then the total weight of homomorphisms that are neither identity nor skew identityis at most W ℓ W ℓ (2 n + m ) ℓ · (4 W + 8 W + nmkr ) kr . The key ideas in the proof of Lemma 8 are the following: Firstly, we show thatc-c homomorphisms dominate non-c-c homomorphisms. Secondly, using cruciallythe special structure of fan grids and our choice of k being a multiple of four, we es-tablish an upper bound on any c-c homomorphism that is neither identity nor skewidentity. Finally, we give an upper bound on the number of all homomorphisms.These three ingredients together allows us to establish the required bound. Proof.
We prove this lemma in two steps. First, in Claims 1 and 2, we upperbound the weight of a homomorphism that is not identity or skew identity. Second,in Claim 3, we upper bound the number of such homomorphisms.14 laim 1.
The weight of any c-c homomorphism is greater than the weight of anynon c-c homomorphism.
Proof of Claim 1:
The weight of a c-c homomorphism ϕ is lower bounded by W ℓ , since each of the ℓ neighbours of a corner vertex in L ( k, r, ℓ , ℓ ) , say u , can be mapped to any of the W neighbours of the corner vertex ϕ ( u ) in H ( G, k, W , W ) .The weight of any non c-c homomorphism is upper bounded by W ℓ +8 ℓ W ℓ ,since in a non c-c homomorphism ϕ at least one corner vertex in L ( k, r, ℓ , ℓ ) , say u , is mapped to a fan vertex ϕ ( u ) that is not a corner vertex and hence the ℓ neigh-bours of u can only be mapped to the W neighbours of ϕ ( u ) in H ( G, k, W , W ) .The term W ℓ +8 ℓ corresponds to all but one fan vertices in L ( k, r, ℓ , ℓ ) beingmapped to corner vertices in H ( G, k, W , W ) .Take the logarithm base W of the two numbers above. We need to show that T ℓ > T (3 ℓ + 8 ℓ ) + ℓ , or, equivalently, T ℓ > T ℓ + ℓ , which is equivalent to the condition ℓ > T ℓ T − of the lemma. (End of proof of Claim 1.)Claim 2. Let ϕ be a c-c homomorphism that is neither identity nor skew identity.Then its weight does not exceed W ℓ W ℓ (2 n + m ) ℓ . Proof of Claim 2:
We consider several cases. First observe some symmetries in c-c homomorphisms. If ψ is the mapping of H (the “grid” part of H ( G, k, W , W ) )mapping ( v, e, i, p ) to ( v, e, k − i + 1 , p ) , then the weight of ψ ◦ ϕ equals that of ϕ . Thus we may assume ϕ (1 , ∈ { ( v, e, , , ( v, e, , r ) | v ∈ V, e ∈ E } , whichgives C ASE
ASE k is a multiple of four, both k − and r − , where r = (cid:0) k (cid:1) , are odd.C ASE ϕ (1 ,
1) = ( v, e, , for some v ∈ V, e ∈ E .Since ( k, is at distance k − from (1 , , by Observation 7, ϕ ( k, is at odddistance not exceeding k − from ϕ (1 , . As ϕ is c-c, there is only one possibility ϕ ( k,
1) = ( v ′ , e ′ , k, for some v ′ ∈ V, e ′ ∈ E . Similarly, as (1 , r ) is at odddistance from (1 , and ϕ (1 , r ) is a corner vertex, by Observation 7 it suffices toconsider only two cases for ϕ (1 , r ) .C ASE ϕ (1 , r ) = ( v ′′ , e ′′ , , r ) for some v ′′ ∈ V, e ′′ ∈ E .Since ( k, r ) is at distance k − from (1 , r ) , by Observation 7, ϕ ( k, r ) is atodd distance not exceeding k − from ϕ (1 , r ) . As ϕ is c-c and we assume that15 (1 , r ) = ( v ′′ , e ′′ , , r ) , there is only one possibility ϕ ( k, r ) = ( v ′′′ , e ′′′ , k, r ) forsome v ′′′ ∈ V, e ′′′ ∈ E . It is now easy to verify that ϕ is identity, a contradiction.C ASE ϕ (1 , r ) = ( v ′′ , e ′′ , k, for some v ′′ ∈ V, e ′′ ∈ E .As in C ASE ϕ ( k, r ) = ( v ′′′ , e ′′′ , , for some v ′′′ ∈ V, e ′′′ ∈ E . Indetail, since ( k, r ) is at distance k − from (1 , r ) , by Observation 7, ϕ ( k, r ) is atodd distance not exceeding k − from ϕ (1 , r ) . As ϕ is c-c and we assume that ϕ (1 , r ) = ( v ′′ , e ′′ , k, , there is only one possibility ϕ ( k, r ) = ( v ′′′ , e ′′′ , , .Since (1 , r ) , (2 , r ) , . . . , ( k, r ) is the only shortest path from (1 , r ) to ( k, r ) , ho-momorphism ϕ maps this path to ( v k , e k , k, , ( v k − , e k − , k − , , . . . , ( v , e , , for some v , . . . , v k ∈ V, e , . . . , e k ∈ E (in fact, we can claim that e ′′′ = e = · · · = e k = e ′′ , but we do not need this). In particular, ϕ (4 , r ) = ( v k − , e k − , k − , and ϕ ( k − , r ) = ( v , e , , ; that is, these two vertices are mapped tonon-fan vertices. Since both ( v k − , e k − , k − , and ( v , e , , have at most n + m neighbours, the weight of ϕ is at most W ℓ W ℓ (2 n + m ) ℓ .C ASE ϕ (1 ,
1) = ( v, e, , r ) for some v ∈ V, e ∈ E .This case is symmetric to C ASE ϕ is c-c, we get ϕ ( k,
1) = ( v ′ , e ′ , k, r ) for some v ′ ∈ V, e ′ ∈ E . Also, we get that ϕ (1 , r ) = ( v ′′ , e ′′ , , or ϕ (1 , r ) = ( v ′′ , e ′′ , k, for some v ′′ ∈ V, e ′′ ∈ E . In the former case, as in C ASE ϕ necessarily is skew identity, which is a contradiction. In the latter case, simi-larly to C ASE ϕ (3 ,
1) = ( v k − , e k − , k − , r ) , ϕ ( k − ,
1) =( v , e , , r ) for some v k − , v ∈ V, e k − , e ∈ E . Since ( v k − , e k − , k − , r ) and ( v , e , , r ) are not fan vertices, as in C ASE ϕ does notexceed W ℓ W ℓ (2 n + m ) ℓ . (End of proof of Claim 2.)Claim 3. The number of homomorphisms of the ( k × r ) -grid to H ( G, k, W , W ) is upper bounded by (4 W + 8 W + nmkr ) kr . Proof of Claim 3:
Since H ( G, k, W , W ) has no more than W + 8 W + nmkr vertices and the ( k × r ) -grid has kr vertices, the claim follows. (End of proof ofClaim 3.) By Claims 1 and 2, the maximum weight of a homomorphism that is not iden-tity or skew identity is W ℓ W ℓ (2 n + m ) ℓ . By Claim 3, there are at most (4 W + 8 W + kr ) kr such homomorphisms. The result follows.We now have all results required to relate the number of k -cliques in a givengraph G and the number of homomorphisms from L ( k, r, ℓ , ℓ ) to H ( G, K, W , W ) ,for appropriately chosen values of ℓ , ℓ , W , W . Lemma 9.
Let N ≥ be the number of k -cliques in G , where k = 4 k ′ for some k ′ , n = V ( G ) , m = E ( G ) , and n + m > . Let M = M ( ℓ , ℓ , W , W ) be the umber of homomorphisms from L ( k, r, ℓ , ℓ ) , where r = (cid:0) k (cid:1) , to H ( G, k, W , W ) .If W = (2 n + m ) , W = W , ℓ = 8 kr , and ℓ = 17 ℓ , then we have N < M W ℓ W ℓ k ! < N + 12 . Proof.
Let M c be the total weight of identity and skew identity homomorphismsand let M n be the total weight of the remaining homomorphisms. By Lemma 6, M c = 2 W ℓ W ℓ k ! · N . Therefore if N ≥ we only need to show that M n < M c N . (1)Since N ≥ , M c N = W ℓ W ℓ k ! ≥ W ℓ W ℓ , (2)and it suffices to show that M n < W ℓ W ℓ . If N = 0 then it again suffices toshow that M n < W ℓ W ℓ k ! ≥ W ℓ W ℓ . On the other hand, ℓ = 17 ℓ by the conditions of the lemma, that is, ℓ > T ℓ T − ,where T = log W W = 2 . Therefore we satisfy the conditions of Lemma 8, andwe have M n < W ℓ W ℓ (2 n + m ) ℓ · (4 W + 8 W + nmkr ) kr . (3)Note that for n, m > , W = 8(2 n + m ) < (2 n + m ) = W . (4)Also, as k ≤ n, r ≤ m , nmkr < (2 n + m ) = W . (5)Using (4) and (5) in (3), we get M n < W ℓ W ℓ (2 n + m ) ℓ · (6 W ) kr . (6)By (2) and (6), in order to establish (1) it suffices to prove W ℓ W ℓ (2 n + m ) ℓ · (6 W ) kr < W ℓ W ℓ , (7)or, equivalently, that (2 n + m ) ℓ · (6 W ) kr < W ℓ . (8)Since (2 n + m ) ℓ = W ℓ and W = W , inequality (8) is equivalent to kr · W kr < W ℓ . (9)17ince n + m > , we have kr < (2 n + m ) kr . (10)Multiplying both sides of inequality (10) by (2 n + m ) kr , we obtain kr · (2 n + m ) kr < (2 n + m ) kr . (11)Since W = (2 n + m ) , inequality (11) can be rewritten as kr · W kr < (2 n + m ) kr . (12)Finally, since W = (2 n + m ) and ℓ = 8 kr , (12) implies (9).Finally, as Lemmas 8 and 9 are only proved for k = 4 k ′ , we need to show thatthe problem for other values of the parameter can be reduced to k of such form.The following lemma takes care of that. Let p - LIQUE denote the followingproblem
Name: p - LIQUE
Input:
A graph G and k ∈ N . Parameter: k . Output:
The number of cliques of size k in G . Lemma 10.
There is a parameterised AP-reduction from p - C LIQUE to p - C LIQUE .Proof.
Let
G, k be an instance of p - LIQUE and let ε ∈ (0 , be an error tol-erance. If k = 4 k ′ for some k ′ then transform the instance to the instance G, k ′ of p - LIQUE with the same error tolerance ε . Otherwise repeat the followingreduction as many times as required to obtain a parameter of the form k ′ .Suppose there is an FPRAS Alg that approximates the number of ( k + 1) -cliques in any graph. We construct graph G + s = ( V ′ , E ′ ) as follows. Let w , . . . , w s be vertices not belonging to V . Then set V ′ = V ∪ { w , . . . , w s } and E ′ = E ∪ { vw i | v ∈ V, i ∈ [ s ] } , that is, we connect all the new vertices with all verticesof G . The following claim is easy to verify. Claim 1.
Let N be the number of k -cliques in G and let N be the number of ( k + 1) -cliques in G . Then the number of ( k + 1) -cliques in G + s is sN + N .Observe also that N < nN , because every ( k + 1) -clique contains a k -clique,and for every k -clique C the number of ( k + 1) -cliques containing C is at most n − k . Finally, we need the following observation. Claim 2.
In an instance
G, ε of k - LIQUE , the number N of k -cliques of G canbe assumed to be either 0 or greater than / ε . Proof of Claim 2.
We show that there is a reduction from the general k - LIQUE to the probem admitting only instances with the restriction described in Claim 2.18he reduction makes use of the standard idea of blowing up the vertices of G . Let t be a natural number with t > (cid:0) ε (cid:1) /k . Construct G ( k ) by replacing every vertex v of G with v , . . . , v t , and every edge vw with a complete bipartite graph on thevertices v , . . . , v t , w , . . . , w t . It is easy to see that every k -clique v , . . . , v k in G gives rise to t k k -cliques in G ( k ) of the form v i , . . . , v ki k . Moreover, every k -cliqueof G ( k ) is of this form. Therefore the number of k -cliqes in G ( k ) equals t k N . Bythe choice of t t k N > (cid:18) ε (cid:19) /k · k N, and so if N > , this number is greater than / ε . (End of proof of Claim 2.) The reduction works as follows: Apply
Alg to the instance G + s , k + 1 , where s = nε , with error tolerance ε/ . If it returns a number M output ⌊ Q ⌋ , where Q = Ms . We now show that (1 − ε ) N < ⌊ Q ⌋ < (1 + ε ) N . By Claim 1 we have (cid:16) − ε (cid:17) ( sN + N ) < M < (cid:16) ε (cid:17) ( sN + N ) , or equivalently (by dividing by s ), (cid:16) − ε (cid:17) (cid:18) N + N s (cid:19) < Q < (cid:16) ε (cid:17) (cid:18) N + N s (cid:19) . Since by Claim 2 we assume that
N > / ε , we obtain (1 − ε ) N = (cid:16) − ε (cid:17) N − ε N < (cid:16) − ε (cid:17) N − < (cid:16) − ε (cid:17) (cid:18) N + N s (cid:19) − , implying (1 − ε ) N < ⌊ Q ⌋ .On the other hand, we have N < nN and therefore ⌊ Q ⌋ ≤ Q < (cid:16) ε (cid:17) (cid:18) N + N s (cid:19) < (cid:16) ε (cid:17) (cid:16) N + ε N (cid:17) < (1 + ε ) N, where in the middle inequality we used the choice of s . The result follows.In particular, Lemma 10 establishes p - LIQUE prob-lem.
Proof of Theorem 3.
As we mentioned earlier, conditions (1) and (4) are equivalentby Theorem 2 and the implications “(1) ⇒ (2) ⇒ (3)” are trivial.The rest of the proof establishes “ (3) ⇒ (4) ”. Assume that C , − ) admits an FPTRAS for a fan class C . Our goal is to show that C has boundedtreewidth. For the sake of contradiction, assume that C has unbounded treewidth.We will exhibit a parameterised reduction from p - LIQUE to p - C , − ) ,19hich gives an FPTRAS for p - LIQUE assuming an FPTRAS for p - C , − ) .Under the assumption that FPT = W[1] (under randomised parameterised reduc-tions [15]), the W[1]-hardness of p -C LIQUE established in [14] implies, by [37,Corollary 3.17], the non-existence of an FPTRAS for the p - LIQUE problem, acontradiction.Let G = ( V, E ) and k be an instance of the p - LIQUE problem. By Lemma 10,we can assume that k = 4 k ′ . First, we show that if G has any k -cliques at all, itcan be assumed to have many k -cliques. Let s ∈ N and G s be defined as follows. V ( G s ) = { v , . . . , v s | v ∈ V } and v i w j ∈ E ( G s ) , for v, w ∈ V and i, j ∈ [ s ] , ifand only if vw ∈ E . In other words, every vertex v of G is replaced with s distinctvertices v , . . . , v s , and every edge vw is replaced with a complete bipartite graph K s,s . Claim 1. If N is the number of k -cliques in G , then G s contains s k N k -cliques.
Proof of Claim 1.
As is easily seen, for any indices i , . . . , i k ∈ [ s ] the vertices v i , . . . , v ki k induce a clique in G s if and only if v , . . . , v k is a clique in G . More-over, no clique in G s contains vertices v i , v j for v ∈ V and i, j ∈ [ s ] . The resultfollows. (End of proof of Claim 1.) For a given instance G = ( V, E ) , k of p - LIQUE and error tolerance ε ∈ (0 , using Claim 1, we first reduce it to the instance G s , k of p - LIQUE , where s > (cid:18) ε/ ε (cid:19) k . Such a choice of s guarantees that if G s contains any k -clique, the number of k -cliques it contains is at least ε/ ε . For simplicity we will have this assumptiondirectly for G . We will also assume that if n = | V | and m = | E | , then n + m > .Now we construct an instance A , B of p - C , − ) such that an ε/ -ap-proximation of the number of homomorphisms from A to B yields an ε -appro-ximation of the number of k -cliques in G . Structures A , B will be chosen to be(essentially) A = L ( k, r, ℓ , ℓ ) and B = H ( G, k, W , W ) , where the parameters ℓ , ℓ , W , W are set according to Lemma 9.Since C is a fan class and we assume that C is not of bounded treewidth, thereis a structure A in C such that L ( k, r, ℓ , ℓ ) is the Gaifman graph G ( A ) of A .We enumerate the class C until we find such an A . First we argue that A can be assumed to be a τ -structure where τ consists of a single binary relationsymbol; i.e., A is a graph and hence L ( k, r, ℓ , ℓ ) itself. Let A be a τ -structurewhose Gaifman graph G ( A ) is L ( k, r, ℓ , ℓ ) . We show how to construct a τ -structure B whose Gaifman graph G ( B ) is H ( G, k, W , W ) such that the set ofhomomorphisms from A to B is identical to the set of homomorphisms from G ( A ) to G ( B ) = H ( G, k, W , W ) , where W = (2 n + m ) and W = (2 n + m ) .The universe of B is the vertex set of H ( G, k, W , W ) . Let R ∈ τ and take any x ∈ R A . Since L ( k, r, ℓ , ℓ ) does not contain triangles, x consists of at mosttwo distinct elements, say a, b ∈ A . Let I ⊆ [ ar ( R )] be the set of indices i with20 [ i ] = a . For every u, v ∈ B with uv an edge in H ( G, k, W , W ) , we add (ifit is not there already) to R B the tuples y and z defined by y [ i ] = z [ j ] = u and y [ j ] = z [ i ] = v for every i ∈ I and j I . Now it is easy to see that a mapping ϕ : A → B is a homomorphism from A to B if and only if ϕ is a homomorphismfrom G ( A ) to G ( B ) .Since the parameters n, m, ℓ , ℓ , W , W satisfy the conditions of Lemma 9,by that lemma we have N < M W ℓ W ℓ k ! < N + 12 , (13)where N is the number of k -cliques in G , which we want to approximate within ε , and M is the number of homomorphisms from A to B , for which we havean FPTRAS by assumption. Let Q = M/ (2 W ℓ W ℓ k !) . The FPTRAS for p - C , − ) applied with error tolerance ε/ produces a number M ′ such that (1 − ε/ M < M ′ < (1 + ε/ M. (14)We then return ⌊ Q ′ ⌋ , where Q ′ = M ′ W ℓ W ℓ k ! . It remains to show that (1 − ε ) N < ⌊ Q ′ ⌋ < (1 + ε ) N . On one hand, we have ⌊ Q ′ ⌋ > ⌊ (1 − ε/ Q ⌋ ≥ ⌊ (1 − ε/ N ⌋ ≥ (1 − ε ) N, where the first inequality follows from (14) and the definitions of Q and Q ′ , thesecond inequality follows from (13) and the definitions of Q and N , and the thirdinequality is trivial provided N is large enough (which we can assume by Claim 2from the proof of Lemma 10).On the other hand, we have ⌊ Q ′ ⌋ ≤ Q ′ < (1 + ε/ Q < (1 + ε/ (cid:18) N + 12 (cid:19) , where the first inequality is trivial, the second inequality follows from (14) and thethird inequality follows from (13).Assume first that N = 0 . Then Q ′ < ε/ , and by the assumption ε < we have ⌊ Q ′ ⌋ = 0 as required. Otherwise by the assumption on the number of k -cliques in G , N > ε/ ε ; therefore ⌊ Q ′ ⌋ < (1 + ε/ (cid:18) N + 12 (cid:19) = (1 + ε/ N + 1 + ε/ < (1 + ε/ N + ( ε/ N = (1 + ε ) N. Observe that the reduction runs in time f ( k ) · poly ( n + m, ε − ) and is a param-eterised AP-reduction. Thus, the reduction gives an FPTRAS for N . Theorem 3 isproved. 21 Conclusions
We do not know whether Theorem 3 holds for all classes of (bounded-arity) rela-tional structures.With more technicalities (but the same ideas as presented here), one can weakenthe assumption on a fan class to obtain the same result (Theorem 3). In partic-ular, it suffices to require that there are polynomials f , f , f , f such that forany parameters k, r, ℓ , ℓ ∈ N , G ( C ) contains the fan-grid L ( k ′ , r ′ , ℓ ′ , ℓ ′ ) , where k ′ = f ( k, r, ℓ , ℓ ) ≥ k , r ′ = f ( k, r, ℓ , ℓ ) ≥ r , ℓ ′ = f ( k, r, ℓ , ℓ ) ≥ ℓ , ℓ ′ = f ( k, r, ℓ , ℓ ) ≥ ℓ . This can be achieved by making use of Lemma 10 (asit would not be possible to test directly for cliques of all sizes) and by a modifica-tion of the construction from Section 4.1 (to accommodate for the fact that somefan-grids may not correspond to cliques due to incompatible numbers). Acknowledgements
We would like to thank the anonymous referees of both the conference [6] and thisfull version of the paper.
References [1] Vikraman Arvind and Venkatesh Raman. Approximation algorithms forsome parameterized counting problems. In
Proceedings of the 13th Inter-national Symposium on Algorithms and Computation (ISAAC’02) , volume2518 of
Lecture Notes in Computer Science , pages 453–464. Springer, 2002. doi:10.1007/3-540-36136-7_40 .[2] Johann Brault-Baron, Florent Capelli, and Stefan Mengel. Under-standing model counting for beta-acyclic CNF-formulas. In
Pro-ceedings of the 32nd International Symposium on Theoretical As-pects of Computer Science (STACS’15) , pages 143–156, 2015. doi:10.4230/LIPIcs.STACS.2015.143 .[3] Andrei Bulatov. A dichotomy theorem for nonuniform CSP. In
Proceedings of the 58th Annual IEEE Symposium on Founda-tions of Computer Science (FOCS’17) , pages 319–330. IEEE, 2017. doi:10.1109/FOCS.2017.37 .[4] Andrei Bulatov, Peter Jeavons, and Andrei Krokhin. Classifying the Com-plexity of Constraints using Finite Algebras.
SIAM Journal on Computing ,34(3):720–742, 2005. doi:10.1137/S0097539700376676 .[5] Andrei A. Bulatov. The complexity of the counting constraint satisfactionproblem.
Journal of the ACM , 60(5):34, 2013. doi:10.1145/2528400 .226] Andrei A. Bulatov and Stanislav ˇZivn´y. Approximate counting CSP seenfrom the other side. In
Proceedings of the 44th International Symposiumon Mathematical Foundations of Computer Science (MFCS’19) , volume 138of
LIPIcs , pages 60:1–60:14. Schloss Dagstuhl - Leibniz-Zentrum f¨ur Infor-matik, 2019. doi:10.4230/LIPIcs.MFCS.2019.60 .[7] Jin-Yi Cai and Xi Chen. Complexity of counting CSP with complex weights.
Journal of the ACM , 64(3):19:1–19:39, 2017. doi:10.1145/2822891 .[8] Xi Chen, Martin E. Dyer, Leslie Ann Goldberg, Mark Jerrum, Pinyan Lu,Colin McQuillan, and David Richerby. The complexity of approximatingconservative counting CSPs.
Journal of Computer and System Sciences ,81(1):311–329, 2015. doi:10.1109/FOCS.2017.37 .[9] Nadia Creignou and Miki Hermann. Complexity of generalized satisfiabil-ity counting problems.
Information and Computation , 125(1):1–12, 1996. doi:10.1006/inco.1996.0016 .[10] V´ıctor Dalmau and Peter Jonsson. The complexity of counting homomor-phisms seen from the other side.
Theoretical Computer Science , 329(1-3):315–323, 2004. doi:10.1016/j.tcs.2004.08.008 .[11] V´ıctor Dalmau, Phokion G. Kolaitis, and Moshe Y. Vardi. Constraint Sat-isfaction, Bounded Treewidth, and Finite-Variable Logics. In
Proceedingsof the 8th International Conference on Principles and Practice of ConstraintProgramming (CP’02) , volume 2470 of
Lecture Notes in Computer Science ,pages 310–326. Springer, 2002. doi:10.1007/3-540-46135-3_21 .[12] Reinhard Diestel.
Graph Theory . Springer, fourth edition, 2010.[13] Rodney G. Downey and Michael R. Fellows. Fixed-Parameter Tractabilityand Completeness I: Basic Results.
SIAM Journal on Computing Computing ,24(4):873–921, 1995. doi:10.1137/S0097539792228228 .[14] Rodney G. Downey and Michael R. Fellows. Fixed-parameter tractability andcompleteness II: On completeness for W[1].
Theoretical Computer Science ,141(1–2):109–131, 1995. doi:10.1016/0304-3975(94)00097-3 .[15] Rodney G. Downey, Michael R. Fellows, and Kenneth W. Regan. Parameter-ized circuit complexity and the W hierarchy.
Theoretical Computer Science ,191(1-2):97–115, 1998. doi:10.1016/S0304-3975(96)00317-9 .[16] Martin E. Dyer, Leslie Ann Goldberg, Catherine S. Greenhill, and Mark Jer-rum. The relative complexity of approximate counting problems.
Algorith-mica , 38(3):471–500, 2004. doi:10.1007/s00453-003-1073-y .[17] Martin E. Dyer, Leslie Ann Goldberg, and Mark Jerrum. An approximationtrichotomy for Boolean
Journal of Computer and System Sciences ,76(3-4):267–277, 2010. doi:10.1016/j.jcss.2009.08.003 .2318] Martin E. Dyer and Catherine S. Greenhill. The complexity of countinggraph homomorphisms.
Random Struct. Algorithms , 17(3-4):260–289, 2000. doi:10.1002/1098-2418(200010/12)17:3/4<260::AID-RSA5>3.0.CO;2-W .[19] Martin E. Dyer and David Richerby. An effective dichotomy for the countingconstraint satisfaction problem.
SIAM Journal on Computing , 42(3):1245–1274, 2013. doi:10.1137/100811258 .[20] Tommy F¨arnqvist.
Exploiting Structure in CSP-related Prob-lems . PhD thesis, Department of Computer Science andInformation Science, Link¨oping University, 2013. URL: .[21] Tom´as Feder, Pavol Hell, Daniel Kr´al’, and Jiˇr´ı Sgall. Two algorithms for gen-eral list matrix partitions. In
Proceedings of the Sixteenth Annual ACM-SIAMSymposium on Discrete Algorithms (SODA’05) , pages 870–876, 2005. URL: http://dl.acm.org/citation.cfm?id=1070432.1070554 .[22] Tom´as Feder, Pavol Hell, and Wing Xie. Matrix partitions withfinitely many obstructions.
Electr. J. Comb. , 14(1), 2007. URL: .[23] Tom´as Feder and Moshe Y. Vardi. The Computational Structure of Mono-tone Monadic SNP and Constraint Satisfaction: A Study through Data-log and Group Theory.
SIAM Journal on Computing , 28(1):57–104, 1998. doi:10.1137/S0097539794266766 .[24] J¨org Flum and Martin Grohe. The Parameterized Complexity of Count-ing Problems. In
Proceedings of the 43rd Symposium on Foundations ofComputer Science (FOCS’02) , page 538. IEEE Computer Society, 2002. doi:10.1109/SFCS.2002.1181978 .[25] J¨org Flum and Martin Grohe. The parameterized complexity of count-ing problems.
SIAM Journal on Computing , 33(4):892–922, 2004. doi:10.1137/S0097539703427203 .[26] J¨org Flum and Martin Grohe.
Parametrized Complexity Theory . Texts inTheoretical Computer Science. An EATCS Series. Springer, 2006.[27] Andreas Galanis, Leslie Ann Goldberg, and Mark Jerrum. Approxi-mately Counting H -Colorings is SIAM Journal on Computing ,45(3):680–711, 2016. doi:10.1137/15M1020551 .[28] Andreas Galanis, Leslie Ann Goldberg, and Mark Jerrum. A Complexity Tri-chotomy for Approximately Counting List H -Colorings. ACM Transactionson Computation Theory , 9(2):9:1–9:22, 2017. doi:10.1145/3037381 .2429] Michael R. Garey and David S. Johnson.
Computers and Intractability: AGuide to the Theory of NP-Completeness . W.H. Freeman, 1979.[30] Georg Gottlob, Nicola Leone, and Francesco Scarcello. Hypertree decom-position and tractable queries.
Journal of Computer and System Sciences ,64(3):579–627, 2002. doi:10.1006/jcss.2001.1809 .[31] Martin Grohe. The complexity of homomorphism and constraint satisfactionproblems seen from the other side.
Journal of the ACM , 54(1):1–24, 2007. doi:10.1145/1206035.1206036 .[32] Martin Grohe and D´aniel Marx. Constraint solving via fractionaledge covers.
ACM Transactions on Algorithms , 11(1):4:1–4:20, 2014. doi:10.1145/2636918 .[33] Martin Grohe, Thomas Schwentick, and Luc Segoufin. When is the eval-uation of conjunctive queries tractable? In
Proceedings 33rd ACM Sym-posium on Theory of Computing (STOC’01) , pages 657–666. ACM, 2001. doi:10.1145/380752.380867 .[34] Pavol Hell and Jaroslav Neˇsetˇril. On the Complexity of H -coloring. Journal of Combinatorial Theory, Series B , 48(1):92–110, 1990. doi:10.1016/0095-8956(90)90132-J .[35] Phokion G. Kolaitis and Moshe Y. Vardi. Conjunctive-Query Containmentand Constraint Satisfaction.
Journal of Computer and System Sciences ,61(2):302–332, 2000. doi:10.1006/jcss.2000.1713 .[36] D´aniel Marx. Tractable hypergraph properties for constraint satisfaction andconjunctive queries.
Journal of the ACM , 60(6), 2013. Article No. 42. doi:10.1145/2535926 .[37] Kitty Meeks. The challenges of unbounded treewidth in parameterised sub-graph counting problems.
Discrete Applied Mathematics , 198:170–194,2016. doi:10.1016/j.dam.2015.06.019 .[38] Stefan Mengel.
Conjunctive queries, arithmetic circuits and count-ing complexity . PhD thesis, University of Paderborn, 2013. URL: http://nbn-resolving.de/urn:nbn:de:hbz:466:2-11944 .[39] Michael Mitzenmacher and Eli Upfal.
Probability and Computing . Cam-bridge University Press, Cambridge, second edition, 2017. Randomizationand Probabilistic techniques in Algorithms and Data Analysis.[40] Reinhard Pichler and Sebastian Skritek. Tractable counting of the an-swers to conjunctive queries.
J. Comput. Syst. Sci. , 79(6):984–1001, 2013. doi:10.1016/j.jcss.2013.01.012 .2541] Neil Robertson and Paul D. Seymour. Graph minors. III. Planar tree-width.
Journal of Combinatorial Theory, Series B , 36(1):49–64, 1984. doi:10.1016/0095-8956(84)90013-3 .[42] Neil Robertson and Paul D. Seymour. Graph minors. V. Excluding a pla-nar graph.
Journal of Combinatorial Theory, Series B , 41(1):92–114, 1986. doi:10.1016/0095-8956(86)90030-4 .[43] Thomas J. Schaefer. The complexity of satisfiability problems. In
Pro-ceedings of the 10th Annual ACM Symposium on Theory of Computing(STOCS’78) , pages 216–226, 1978. doi:10.1145/800133.804350 .[44] Dmitriy Zhuk. The Proof of CSP Dichotomy Conjecture. In
Proceedings of the 58th Annual IEEE Symposium on Founda-tions of Computer Science (FOCS’17) , pages 331–342. IEEE, 2017. doi:10.1109/FOCS.2017.38doi:10.1109/FOCS.2017.38