View metadata, citation and similar papers at core.ac.uk brought to you by CORE

provided by Birkbeck Institutional Research Online

On the Complexity of Generalized Chromatic

A. Goodalla,2, M. Hermannb,1, T. Kotekc,3, J.A. Makowskyd,1,∗, S.D. Noblee,2

aIUUK, MFF, Charles University, Prague, Czech Republic bLIX (CNRS, UMR 7161), Ecole´ Polytechnique, 91128 Palaiseau, France cTechnische Universitat¨ Wien, Institut fur¨ Informationssysteme, 1040 Wien, Austria dDepartment of Computer Science, Technion–IIT, 32000 Haifa, Israel eDepartment of Economics, and Statistics, Birkbeck, University of London, London, United Kingdom

Abstract

J. Makowsky and B. Zilber (2004) showed that many variations of graph colorings, called CP-colorings in the sequel, give rise to graph polynomials. This is true in par- ticular for harmonious colorings, convex colorings, mcct-colorings, and rainbow color- ings, and many more. N. Linial (1986) showed that the chromatic χ(G; X) is #P-hard to evaluate for all but three values X = 0, 1, 2, where evaluation is in P. This dichotomy includes evaluation at real or complex values, and has the further prop- erty that the set of points for which evaluation is in P is finite. We investigate how the complexity of evaluating univariate graph polynomials that arise from CP-colorings varies for different evaluation points. We show that for some CP-colorings (harmo- nious, convex) the complexity of evaluation follows a similar pattern to the chromatic polynomial. However, in other cases (proper edge colorings, mcct-colorings, H-free colorings) we could only obtain a dichotomy for evaluations at non-negative integer points. We also discuss some CP-colorings where we only have very partial results. Keywords: Graph polynomials, Counting Complexity, Chromatic Polynomial, MSC classes: 05C15, 05C31, 05C85, 68Q17, 68W05

∗Corresponding author Email addresses: [email protected] (A. Goodall), [email protected] (M. Hermann), [email protected] (T. Kotek), [email protected] (J.A. Makowsky), [email protected] (S.D. Noble) URL: http://kam.mff.cuni.cz/˜andrew (A. Goodall), http://www.lix.polytechnique.fr/Labo/Miki.Hermann (M. Hermann), http://forsyte.at/˜kotek/ (T. Kotek), http://www.cs.technion.ac.il/˜janos (J.A. Makowsky), http://www.bbk.ac.uk/ems/faculty/steven-noble (S.D. Noble) 1Work done in part while the authors were visiting the Simons Institute for the Theory of Computing in Spring 2016. 2Supported by the Heilbronn Institute for Mathematical Research, Bristol, UK. 3Supported by the Austrian National Research Network S11403- N23 (RiSE) of the Austrian Science Fund (FWF).

Preprint submitted to Elsevier April 3, 2017 Contents

1 Introduction 3 1.1 The complexity spectrum ...... 4 1.2 Easy computation of the polynomial versus its easy evaluation . . . .5 1.3 Linial’s Trick ...... 5 1.4 The Difficult Point Dichotomy ...... 7

2 One, two, many chromatic polynomials 8 2.1 Many chromatic polynomials ...... 8 2.2 P-colorings and variations ...... 10

3 Detailed case study: Dichotomy theorems 11 3.1 Harmonious colorings ...... 11 3.2 Convex colorings ...... 13 3.3 DU(H)-colorings ...... 14

4 Counting convex colorings is #P-complete: the proof 17 4.1 Cuts, crossing sets, and cocircuits ...... 17 4.2 Reductions ...... 18

5 Detailed case study: Discrete spectra 21 5.1 Proper edge colorings ...... 21 5.2 mcct-colorings ...... 22 5.3 H-free-colorings ...... 25

6 More graph polynomials 26 6.1 Graph polynomials with incomplete complexity spectrum ...... 26 6.2 NP-hardness ...... 27

7 Conclusions and open problems 28

2 1. Introduction

By a classical result of R. Ladner, and its generalization by K. Ambos-Spies, [Lad75, AS87], there are infinitely many degrees (via polynomial time reducibility) between P and NP, and between P and #P, provided P 6= NP. In contrast to this, the com- plexity of evaluating partition functions or counting graph homomorphisms satisfies a dichotomy theorem: either evaluation is in P or it is #P-complete, [DG00, BG05, CCL13]. For the definition of the complexity class #P, see [GJ79] or [Pap94]. In accordance with the literature in graph theory a finite graph G = (V (G),E(G)) with n(G) = |V (G)| and e(G) = |E(G)| has order n(G) and size e(G). Otherwise, the size of a finite set is its cardinality. In this paper we study the complexity of the evaluation of generalized univari- ate chromatic polynomials, as introduced in [MZ06] and further studied in [KMZ08, KMZ11]. They will be called in the sequel CP-colorings (for Counting Polynomials). Among these we find: Examples 1.1. (i) Trivial (unrestricted) vertex colorings using at most k colors are just functions V (G) → [k]. We denote by χtrivial(G; k) the number of trivial |V (G)| colorings of G, hence χtrivial(G; k) = k ∈ Z[k]. (ii) Proper vertex colorings using at most k colors, where two neighboring vertices receive different colors, are counted by χ(G; k), the classical chromatic polyno- mial . (iii) Proper edge colorings using at most k colors, where two edges with a common vertex receive different colors, are counted by χedge(G; k), the edge chromatic polynomial. We note that they are exactly the proper vertex colorings of the line graph L(G) of G. (iv) Convex colorings using at most k colors are vertex colorings, which are not nec- essarily proper, but where each color class induces a connected subgraph. They are counted by χconvex(G; k). Convex colorings are first introduced in [MS07]. (v) Harmonious colorings using at most k colors are proper vertex colorings such that no two edges have end-vertices receiving the same pair of colors. They were introduced in [HK83, EM95, Edw97]. We denote the number of harmo- nious colorings using at most k colors by χharm(G; k). The graph parameter χharm(G; X) is a polynomial in k by [MZ06, KMZ11] which was further studied more recently in [DBG17]. (vi) For a fixed connected graph H, DU(H)-colorings are vertex colorings, where each color class induces a disjoint collection of copies of H. The graph parame- ter counting the number of DU(H)-colorings with at most k colors is a polyno- mial in k, and the corresponding graph polynomial is denoted by χDU(H)(G; k). + (vii) For a fixed t ∈ N , an mcct-coloring using at most k colors is a vertex col- oring, where the connected components of the subgraphs induced by each color class have at most t vertices. They were previously studied in [ADOV03] and

[LMST07]. The graph parameter χmcct (G; k) counting the number of mcct- colorings with at most k colors is also a polynomial in k but not in t. (viii) For a fixed graph H, an H-free coloring using at most k colors is a vertex color- ing in which every color class induces an H-free graph. For H = K2 these are

3 the proper vertex colorings. The graph parameter χH−free(G; k) counting the number of H-free colorings with at most k colors is also a polynomial in k. More examples are presented in Section 2, where we also discuss a general theorem which allows us to find infinitely many generalized chromatic polynomials, and in Section 6.

1.1. The complexity spectrum Let F be a fixed field that contains Q, the rational numbers, and in which the arithmetic operations are polynomial time computable. For our discussion we use the unit-cost4 model for the field computations in F. Given a graph polynomial P (G; X) ∈ F[X] and an element a ∈ F, we view Pa(G) = P (G; a) as a graph parameter. We will look at the complexity of the problem of evaluating P (G; a) for a fixed a ∈ F and at the problem of computing all the coefficients of P (G; X).

Problem: P (G; a) Input: Graph G. Output: The value of P (G; X) for X = a.

Problem: P (G; X) Input: Graph G. Output: All the coefficients of P (G; X) as a vector over F.

We denote by TPa (n) the time needed to compute P (G; a) on graphs with n ver- tices in the Turing model of computation. Similarly TPX (n) denotes the time needed to compute all the coefficients of P (G; X). Clearly, for every a ∈ F the problem P (G; a) is reducible to computing the coefficients of P (G; X). The converse is not true in gen- eral, but we shall see cases where for certain a0 ∈ F computing the coefficients of P (G; X) is reducible to P (G; a0). When we speak informally of the complexity spec- trum of P (G; X) we have in mind the variability of TPa (n) where a ∈ F, without giving the term a precise definition. For a graph polynomial P (G; X), we are inter- ested in describing the complexity of Pa(G) for all a ∈ F. A more modest task would be to describe it only for a ∈ N. In the case of a ∈ N we speak of the discrete com- plexity spectrum, in the case of a ∈ F we speak of the full complexity spectrum, if the context requires it.

4If instead we use the binary cost model for computations in, say, Q, the main results still hold, but have to be formulated more carefully, as a ∈ Q could be very large, and the notion of uniformity would be affected.

4 We define

d EASY(P ) = {a ∈ F : there exists d ∈ N with TPa (n) ≤ n for all n ≥ 2} Analogously, we define

#PHARD(P ) = {a ∈ F : Pa(G) is #P-hard}.

1.2. Easy computation of the polynomial versus its easy evaluation In the definition of EASY(P ), we require that the evaluation at a ∈ F takes poly- nomial time, but the exponent d may depend on a, which is to say the polynomial bound for evaluating P (G; a) is non-uniform. If we could compute all of the coefficients of P (G; X) in polynomial time, we could also evaluate P (G; a) for every a in polynomial time O(nd) where d is indepen- dent of a, and P (G; a) can be evaluated in polynomial time uniformly. However, if EASY(P ) is infinite with a non-uniform polynomial bound, then it does not follow that there exists d such that for every G the coefficients of P (G; X) maybe computed in time O(nd). Proposition 1.2. (i) If the coefficients of the polynomial P (G; X) can be computed in polynomial time from G alone, then EASY(P ) = F. (ii) If, in addition to (i), there is a ∈ F such that a ∈ #PHARD(P ), then P = #P. Proof. As all the coefficients of P (G; X) can be computed together in polynomial time, the degree δ = δ(G) of P (G; X) is polynomial in the number of vertices of G, and so is the size of the coefficients. Evaluating such a polynomial can be done in polynomial time in the order of G. Therefore if a ∈ EASY(P ) ∩ #PHARD(P ) we have P = #P.

The characteristic polynomial pA(G; X) of a graph G is the characteristic polyno- mial of its adjacency matrix. A variant of this, pL(G; X), is obtained by replacing the adjacency matrix by the Laplacian of G. Both are obtained by computing a determi- 3 nant, therefore evaluating both pA(G; X) and pL(G; X) can be done in time O(n ), irrespective of the evaluation point X = a ∈ F. Hence EASY(pA(G; X)) = F (EASY(pL(G; X)) = F) uniformly. In Section 3.1 we shall see an example where EASY(P ) = N non-uniformly.

1.3. Linial’s Trick In the case of the chromatic polynomial χ(G; X), N. Linial set the paradigm in the following theorem: Theorem 1.3 ([Lin86]). #PHARD(χ) = F − {0, 1, 2} and EASY(χ) = {0, 1, 2}. To show this N. Linial observed the following:

Lemma 1.4 (Linial’s Trick). Let G1 ./ G2 be the join of the graphs G1 and G2, obtained from the disjoint union G1 t G2 by connecting all the vertices of G1 with all the vertices of G2.

5 (i) A function f : V (G ./ K1) → [k] is a proper coloring with k colors if and only if there is a function g : V (G) → {1, . . . , i − 1, i + 1, . . . , k} which is a proper coloring of G with k − 1 colors and f|V (G) = g, i.e., g is the restriction of f to V (G), and f(u) = i. (ii) χ(G ./ K1; k) = k · χ(G; k − 1) (iii) χ(G ./ Kn; k) = k(n) · χ(G; k − n) where k(n) is the falling factorial: k! k(n) = k(k − 1)(k − 2) ... (k − (n − 1)) = (n−k)! .

This allows one for a 6∈ N to evaluate χ(G, a − n) by computing χ(G ./ Kn, a). It also shows that evaluating χ(G; k) is reducible to evaluating χ(G; k + 1) for k ≥ 3. Proof of Theorem 1.3. First one proves that χ(G; 3) is #P-complete directly, as in [Lin86]. For the cases a ∈ N − {0, 1, 2} one uses (ii) of Linial’s trick iteratively to reduce the computation of χ(G; 3) to the computation of χ(G; a). For the cases a ∈ F−N one uses (iii) of Linial’s trick to compute χ(G; a−n) for n = 0, 1, . . . , n(G). By Lagrange interpolation the polynomial χ(G; X) is thereby determined since the degree of χ(G; X) is n(G). In particular computing χ(G; 3) is polynomial time reducible to computing χ(G; a). Hence, Theorem 1.3 follows. Similarly, for the generating matching polynomial X gm(G; X) = X|M|, M⊆E(G) we have, see [AM]5. Proposition 1.5. #PHARD(gm) = F − {0} and EASY(gm) = {0},

G-polynomial E = EASY(P ) #PHARD(P ) OTHER Reference

χtrivial(G; X) Etrivial = F, u ∅ ∅ trivial pA(G; X) Echar = F, u ∅ ∅ folklore gm(G; X) Ematch = {0} F − Ematch ∅ folklore χ(G; X) Echrom = {0, 1, 2} F − Echrom ∅ Theorem 1.3 χharm(G; X) Eharm = N, nu F − Eharm ∅ Theorem 3.2 χconvex(G; X) Econvex = {0, 1} F − Econvex ∅ Theorem 3.6

χDU(Kα)(G; X) EDU(Kα) = {0, 1} F − EDU(Kα) ∅ Theorem 3.16 α ≥ 2

Table 1: Full complexity spectra, u=uniformly, nu=non-uniformly

5It appears that this was known as folklore, but we could not find a suitable reference.

6 G-polynomial E = EASY(P ) #PHARD(P ) OTHER Reference

χedge(G; X) Eedge = {0, 1} N − Eedge ∅ Theorem 5.2

χmcct (G; X) Emcct = {0, 1} N − Emcc2 ∅ Theorem 5.8 t ≥ 2, k ≥ 2 χH−free(G; X) EH−free = {0, 1} N − {0, 1, 2} {2} (+) Theorem 5.10

Table 2: Discrete complexity spectra only, H of size 2, (+) only NP-hard is known

The purpose of this paper is to study the complexity spectrum of generalized uni- variate chromatic polynomials arising from CP-colorings. In the examples we study, the complexity spectrum is easily described with the two sets EASY(P ) and #PHARD(P ). Our results on full complexity spectra are summarized in Table 1. Cases where only the discrete spectrum is understood are given in Table 2. To get a complete description of the full complexity spectrum of P (G; a), one needs two ingredients:

(i) Enough points a ∈ N for which the complexity of Pa(G) = P (G; a) is known, and (ii) some form of reducibility between Pa(G) and Pb(G) for the remaining values a, b ∈ F. From the literature we often, but not always, can get enough information for (i). We give here new results for (i), namely Theorems 3.5, 3.14 and 5.6. For (ii) we try to adapt Linial’s Trick, which in some cases is more or less straightforward, while in other cases requires finding a new gadget as in Theorem 3.2. A precise description of what is needed for (ii) is given in [BDM10], which also covers the case for multivariate graph polynomials.

1.4. The Difficult Point Dichotomy We say that a univariate graph polynomial has the Difficult Point Dichotomy if (i) for every a ∈ F either a ∈ EASY(P ) or a ∈ #PHARD(P ), and (ii) EASY(P ) = F or EASY(P ) ⊆ N. In [Mak08a, MKR13] it is conjectured that, for every univariate graph polyno- mial P (G; X) definable in Second Order Logic SOL, the set EASY(P ) is either fi- nite or EASY(P ) = F and that EASY(P ) ∪ #PHARD(P ) = F. In [Mak08a] the same was also conjectured for univariate graph polynomials definable in Monadic Sec- ond Order Logic MSOL. The example of χharm(G; X) is SOL-definable and there- fore disproves the conjecture for SOL-definable graph polynomials. However, it was shown in [KM14] that χharm(G; X) is not MSOL-definable. Rather than conjecturing frivolously, we state some problems.

7 Problem 1.6. Which univariate graph polynomials P (G; X) satisfy the Difficult Point Dichotomy? In particular, (i) Is it true for every MSOL-definable univariate graph polynomial P (G; X)? (ii) Can one find a criterion which applies to an infinite family of univariate graph polynomials P (G; X) which are not partition functions, or which do not count homomorphisms, and which implies the Difficult Point Dichotomy.

Outline of the paper In Section 2 we give a simplified proof of the result from [MZ06] that not only counting proper graph colorings, but counting many other graph colorings, give rise to infinitely many generalized chromatic graph polynomials. We give many explicit examples, and show that there are infinitely many such graph polynomials which are mutually semantically incomparable, cf. [MRB14, KMR17]. In Sections 3 and 5 we analyze in detail the graph polynomials from Table 1 and 2. In Section 4 we give the proof that counting convex colorings with 2 colors is #P-complete (Theorem 3.5). In Section 6 we discuss graph polynomials for which we have only partial results. Finally, in Section 7 we summarize our conclusions and list some open problems.

2. One, two, many chromatic polynomials

Let G = (V (G),E(G)) be a finite graph and k ∈ N+ a positive integer. We denote the set {1, . . . , k} by [k]. Unless otherwise stated all graphs are simple, i.e., loop-free and without multiple edges. A vertex (edge) coloring f with k colors is a function f : V (G) → [k] (f : E(G) → [k]). The coloring f is proper if no two vertices (edges) with a common edge (vertex) have the same color. Let χ(G; k) (χedge(G; k)) denote the number of proper vertex (edge) colorings of G with k colors. In 1912 G. Birkhoff [Bir12] noticed that χ(G; k) and χedge(G; k) are polynomials in Z[k], and therefore can be extended to polynomials in C[X], denoted, by abuse of notation, by χ(G; X) and χedge(G; X). Birkhoff’s proof for χ(G; X) was based on a recurrence relation involving deletion and contraction of edges, which was generalized and led, in its most general form, to the . For χedge(G; X) one simply observes that

χ(L(G); X) = χedge(G; X), (*) where L(G) is the line graph of G. Although proper edge colorings have been studied in the literature, the polynomial χedge(G; X) has not received wide attention, probably because of (*).

2.1. Many chromatic polynomials Let G denote the class of all finite graphs. We introduce our concepts for vertex colorings, but they can be straightforwardly extended to edge colorings.

8 Two vertex colorings f1, f2 : V (G) → [k] are isomorphic if there is an automor- phism α : V (G) → V (G) of G and a permutation π :[k] → [k] such that for all v ∈ V (G) π(f1(v)) = f2(α(v)). S S V (G) Let COL = + [k] .A coloring property Φ is a subset of COL that is G∈G k∈N closed under isomorphisms of colorings. For a fixed coloring property Φ, a graph G ∈ G, k ∈ N+ and I ⊆ [k], let

χΦ(G; k) = |{f ∈ Φ: f : V (G) → [k]}| and let Φ cG(I, k) = |{f ∈ Φ: f : V (G) → [k] with f(V (G)) = I}| be the number of colorings f ∈ Φ of G which use exactly the colors in I. We say that Φ is a CP-Property if the following two conditions are satisfied:

(A) For all k ∈ N+ and I,J ⊆ [k] with |I| = |J| = i we have

Φ Φ cG(I, k) = cG(J, k).

0 + 0 Φ Φ 0 (B) For all k, k ∈ N with I ⊆ [k] ∩ [k ] we have cG(I, k) = cG(I, k ). Φ Φ If (A) holds we let cG(i, k) denote the common value of cG(I, k), where |I| = i, and Φ Φ if both (A) and (B) hold, we let cG(i) denote the common value of cG(i, k), for k ≥ i. We now compute χΦ(G; k) using (A) and (B):

X X k χ (G; k) = cΦ (I, k) = cΦ (i) . Φ G G i I⊆[k] i

This establishes the following result, first shown in [MZ06]:

Theorem 2.1 ([MZ06]). If Φ is a CP-property, the counting function χΦ(G; k) is a polynomial in Z[k]. Examples 2.2. (i) In the case of the chromatic polynomial, both (A) and (B) are satisfied. Hence we get a new proof of Birkhoff’s Theorem. Φ (ii) Let χˆΦ(G; k) = cG(k) be the graph parameter that counts the number of color- ings in Φ of G which use exactly k colors. Note that the function χˆΦ(G; k) need not be a polynomial in k when χΦ(G; k) is a polynomial in k. (iii) Let Φ1 be the coloring property which says f is a proper coloring with k colors

where all the k colors are used. Here (B) is violated, and indeed, χΦ1 (G; k) is not a polynomial. (iv) Let Φ2 be the coloring property which says f is a proper coloring with k colors such that f(v) = i + 1 if and only if the degree of v is i. Here (A) is violated, but

(B) is still true, and χΦ2 (G; k) is still a polynomial. (v) All the examples (i)-(vii) of Section 1 listed in Examples 1.1 satisfy (A) and (B). Hence they are polynomials in k.

9 2.2. P-colorings and variations Two graph polynomials may be compared via their distinctive power. Two graphs G1 and G2 are similar if they have the same number of vertices, edges and connected components. A graph polynomial Q(G; X) is less distinctive than P (G; Y ), written Q  P , if for every two similar graphs G1 and G2

P (G1; X) = P (G2; X) implies Q(G1; Y ) = Q(G2; Y ).

We also say that P (G; X) determines Q(G; X) if Q  P . Two graph polynomials P (G; X) and Q(G; Y ) are equivalent in distinctive power (d.p.-equivalent) if for every two similar graphs G1 and G2

P (G1; X) = P (G2; X) iff Q(G1; Y ) = Q(G2; Y ).

Here we show how to obtain infinitely many graph polynomials that are mutually in- comparable in distinctive power. Let P be any (a class of finite graphs closed under graph isomor- phism). A function f : V (G) → [k] is a P-coloring if for every i ∈ [k] the set f −1(i) induces a graph G[f −1(i)] ∈ P. Clearly, this is a CP-coloring for any graph property P. Hence χP (G; k), the number of P-colorings of G with at most k colors, is a polynomial in k. Theorem 2.3 ([KMR17]). There are infinitely many graph polynomials of the form χP (G; k) with mutually incomparable distinctive power.

We can generalize this further. Let P1 and P2 be two graph properties. The P1- colorings such that the union of any two color classes induces a graph in P2 form also a CP-property. Let

χP1,P2 (G; k) = −1 −1 |{f : V (G) → [k]: ∀i∈[k]G[f ({i})] ∈ P1, ∀i,j∈[k],i6=jG[f ({i, j})] ∈ P2}| denote the number of such colorings. Then, for k ∈ N and a graph G, the graph invariant χP1,P2 (G; k) is a polynomial in k.

Problem 2.4. For which graph properties P1, P2 can we describe the complexity of

χP1,P2 (G; k)? In particular, for which graph properties does the Difficult Point Di- chotomy hold? Remark 1. In Problem 2.4 it may be reasonable to impose some complexity restrictions on P1 and P2, e.g., we might require them to be in NP. Let AH be any additive induced hereditary property (closed under taking induced subgraphs and disjoint unions). AH-colorings have been studied in [Bro96, Far04], in which the following is shown: Theorem 2.5. (i) ([Bro96]) There are uncountably many induced hereditary prop- erties AH of graphs. Therefore, χAH(G; k) may not be computable.

10 (ii) ([Far04]) χAH(G; k) is NP-hard, unless AH is the class of empty (=edgeless) graphs.

Table 3 unifies the CP-colorings considered in Table 1 as P1-colorings such that the union of any two color classes induces a graph in P2. Table 3 also contains the definitions of acyclic colorings, t-improper colorings and co-colorings, which will be discussed in Section 6.

CP-coloring P1 P2 trivial all graphs all graphs proper edgeless graphs all graphs acyclic edgeless graphs forests convex connected graphs all graphs harmonious edgeless graphs at most one edge mcct conn. cpts size ≤ t all graphs DU(H) disjoint union of =∼ H all graphs t-imp max. degree t all graphs co-coloring clique or edgeless all graphs AH-coloring AH all graphs

Table 3: P1-colorings where the union of any two color classes is in P2. In the last line P1 is an additive induced hereditary property (closed under taking induced subgraphs and disjoint unions).

3. Detailed case study: Dichotomy theorems

3.1. Harmonious colorings Recall that a coloring is harmonious if it is a proper vertex coloring and every pair of colors occurs along some edge at most once, and χharm(G; X) is the corresponding graph polynomial.

Proposition 3.1. For every k ∈ N there is a polynomial time Turing machine T (k) which computes χharm(−; k). In other words N ⊆ EASY(χharm) non-uniformly.

Proof. For X = k a positive integer and a graph G on n vertices, χharm(G; k) 6= 0 k 2·e(k) implies that G has at most e(k) = 2 edges. Furthermore, there are k colorings of 2 · e(k) vertices with k colors. Let i(G) be the number of isolated vertices of G, T (k) proceeds as follows:

(i) Determine |E(G)|. If |E(G)| ≥ e(k) + 1 we have χharm(G; k) = 0. (ii) Otherwise, we strip G of all its isolated vertices to obtain G0, which has at most 2 · e(k) vertices. 0 0 (iii) We count the colorings of G which are harmonious, i.e., χharm(G ; k), which takes time t(k), independently of the number of vertices of G. i(G) 0 (iv) Therefore χharm(G; k) = k · χharm(G ; k). It follows that T (k) runs in time O(n2) where the constants depend on k.

11 G G1 S(G)

Figure 1: Constructing S(G) from G

Remark 2. In spite of the low complexity of the above algorithms, we cannot compute all the coefficients of χharm(G; X) in polynomial time. To compute χharm(G; X) for a graph G on n vertices we would have to compute for n + 1 values k1, . . . , kn+1 of X the value of the function χharm(G; X) and then use Lagrange interpolation. However, the above algorithm inspects k2·e(k) colorings, which for at least one of the values 2·e(n) χharm(G; ki) is bigger than n . It follows from Theorem 3.2 below that, indeed, χharm(G; X) cannot be computed in polynomial time unless P = #P.

Theorem 3.2. For each a ∈ F − N the evaluation of χharm(G; a) is #P-hard. Proof. Let G be a graph. We form S(G) in the following way (see Figure 1). We first form G1 using G by adding a new vertex ve for each edge e = (u, v) of G. Then replace the edge e by two new edges (u, ve) and (ve, v). Using G1 we now form S(G): We connect all the new vertices ve : e ∈ E(G) of G1 such that they form a on |E(G)| vertices. For a graph G and k ∈ N, k + e(G) χ (S(G); k + e(G)) = χ(G; k) · e(G)!, (1) harm e(G) where e(G) = |E(G)| and χ(G; k) is the chromatic polynomial of G evaluated at k. Since Equation (1) holds for every k ∈ N, it is a polynomial identity, which can be written as follows:

χharm(S(G); X) = X(e(n)) · χ(G; X − e(G)). (2) Equation (2) provides a polynomial time reduction from the coefficients of χ(G; X) to the coefficients of χharm(S(G); X), and vice versa. In particular, determining χharm(S(G); X) is #P-hard. We also see from Equation (2) that for a ∈ F − N, the graph parameter χ(G; a − e(G)) is polynomial time equivalent to the evaluation χharm(S(G); a).

Finally, evaluating χ(G; a − e(G)) is #P-hard for a 6∈ N. To see this, first observe the following polynomial identity by the multiplicativity of the chromatic polynomial over disjoint unions:

χ(G t K1,n; X −e(G t K1,n)) = χ(K1,n; X −e(G t K1,n)) · χ(G; X −e(G t K1,n)) = (3) (X −e(G)−n) · (X −e(G)−n−1)n · χ(G; X −e(G)−n).

12 For a ∈ F − N, we use Equation (3) to obtain the evaluations χ(G; a−e(G)−n) for n = 0, 1,..., |V (G)| and we apply Lagrange interpolation to compute χ(G; X−e(G)). By Equation (2) this determines χharm(S(G); X), which as we have seen is a #P-hard problem. Consequently evaluating χharm at X = a is #P-hard. Remark 3. From Equation (1) we also see that, since evaluating χ(G; 3) is #P- complete, we must indeed have non-uniform polynomial time evaluation of χharm(G; X) at positive integer points, as stated in Proposition 3.1.

Hence we have shown:

Theorem 3.3. The Difficult Point Dichotomy is true for χharm(G; X) with EASY(χharm) = N non-uniformly, and #PHARD(χharm) = F − N.

3.2. Convex colorings Recall that a convex coloring of a graph G is an assignment of colors to its vertices so that for each color c the subgraph of G induced by the vertices receiving color c is 6 connected . The resulting graph polynomial is χconvex(G; X). The following is easily verified:

Proposition 3.4. (i) For X = 1 we have ( 1 if G is connected χconvex(G; 1) = 0 else.

(ii) For k ∈ N+ we have

χconvex(G t K1; k) = k · χconvex(G; k − 1).

In [Mak08b], it was asked whether χconvex(−; 2) is #P-hard. The question was answered in the positive and posted in [GN08], but remained unpublished. Note that the number of convex colorings using at most two colors is equal to zero if G has three or more connected components and equal to two if G has exactly two connected components. So we may restrict our attention to connected graphs.

Theorem 3.5 (A. Goodall and S. Noble, [GN08]). Evaluating χconvex(G; X) for X = 2 on connected graphs is #P-complete.

The proof is given in Section 4. Combining Proposition 3.4 and Theorem 3.5 we get the following:

Theorem 3.6. EASY(χconvex) = {0, 1} and #PHARD(χconvex) = F − {0, 1}.

6We consider a graph with no vertices to be connected.

13 3.3. DU(H)-colorings Let H be a fixed connected graph. A coloring f : V (G) → [k] is an DU(H)- coloring with k colors, if each color class induces a disjoint union of copies of H. We denote by χDU(H)(G; k) the number of DU(H)-colorings of G with at most k colors, and by χˆDU(H)(G; k) the number of DU(H) colorings of G with exactly k colors. We easily verify:

Proposition 3.7. (i) Being a DU(H)-coloring with k colors is a CP-property, hence χDU(H)(G; k) is a polynomial in k. However, χˆDU(H)(G; k) is not a CP- property, and in general is not a polynomial in k. Pk k (ii) χDU(H)(G; k) = i=1 i χˆDU(H)(G; i). (iii) χDU(H)(G; k) is multiplicative over disjoint unions. (iv) For k = 1, a graph G is DU(H)-colorable iff G is a disjoint union of Hs.

(v) For n(G) 6≡ 0 mod n(H) the polynomial χDU(H)(G; k) vanishes.

Let v ∈ V (H). We define H,v(G) to be the graph with vertex set V (G) t V (H), and edge set E(G) t E(H) t V (G) × {v}. We can apply Linial’s Trick, cf. Lemma 1.4, to analyze the complexity of χDU(H)(G; a). Proposition 3.8. Let H be a connected graph.

(i) χDU(H)(H,v(G); k) = k · χDU(H)(G; k − 1). (ii) For every a, b ∈ N and b > a, χDU(H)(G; a) is polynomial time reducible to χDU(H)(G; b). (iii) For every a0 ∈ F−N, computing the coefficients of χDU(H)(G; X) is polynomial time reducible to χDU(H)(G; a0). The proof is the same as in [Lin86]. For the convenience of the reader we sketch it here. Proof. (i) All the vertices of V (H) have to be colored by the same color but differently from the vertices in V (G). (ii) Apply (i) b − a many times. (iii) Let G0 = G, Gi+1 = H,v(Gi). Using χDU(H)(−; a0) we can compute χDU(H)(Gi; a0) for sufficiently many i’s and then use Lagrange Interpolation to compute the coeffi- cients of χDU(H)(G; X). Related decision and counting problems have been considered in the literature. In the following α is a nonnegative integer.

Problem: CliqueCoverα Input: Graph G. If α ≥ 1 then n(G) = α · m. Question: Can we partition V (G) into sets Vi such that each Vi induces a clique (for α = 0) or induces a copy of Kα (for α ≥ 1)?

14 Problem: #CliqueCoverα Input: Graph G. If α ≥ 1 then n(G) = α · m. Output: The number of partitions of V (G) into sets Vi such that each Vi induces a clique (for α = 0) or induces a copy of Kα (for α ≥ 1).

We note for α = 0 this is the classical clique cover decision problem of Richard Karp’s original 21 problems, see [GJ79]. From the literature we know the following:

Theorem 3.9. (i) CliqueCover0 is NP-complete and #CliqueCover0 is #P-complete, [GJ79, HIMRS98]. (ii) CliqueCover1 and #CliqueCover1 are both trivial. (iii) CliqueCover2 is the same as finding a perfect matching, and is in P, and #CliqueCover2 is #P-complete by [Val79]. (iv) CliqueCover3 is NP-complete and #CliqueCover3 is #P-complete, [KH83, HIMRS98].

Problem 3.10. For which α ≥ 4 is #CliqueCoverα #P-complete?

The connection between #CliqueCoverα and χDU(Kα)(G; X) is given as follows:

Proposition 3.11. (i) χDU(K1)(G; X) = χ(G; X), the chromatic polynomial. n n  (ii) χˆDU(Kα)(G; α ) = α ! · #CliqueCoverα where α 6= 0 and n(G) is divisible by α.

Proof. If n = n(G) is divisible by α, the maximal value k such that χˆDU(Kα)(G; k) 6= n 0 is k = α . In this case the subgraph induced by each color class is isomorphic to Kα, n  and there are α ! many such colorings.

We will prove that χDU(Kα)(G; 2) is #P-hard for every α ≥ 2 in Theorem 3.14 below by describing a polynomial time reduction from the #P-hard problem #α-of-2α-SAT. From [CH96] we know that #α-of-2α-SAT is #P-complete.

Problem: #α-of-2α-SAT Input: 2αCNF formula Θ. Output: The number of truth assignments such that, in each clause, α literals are true and the other α are false.

Now we proceed to describe the construction of a graph GΘ for every input Θ to

#α-of-2α-SAT. We will prove that #α-of-2α-SAT(Θ) = χDU(Kα)(GΘ; 2). Vs Let Θ = i=1 Ci be a 2αCNF formula with clauses Ci = li,1 ∨· · ·∨li,2α. Without loss of generality, let the variables which occur in Θ be xt : t ∈ [r]. The literals li,j of Θ

15 are either variables xt or negation of variables ¬xt. We define var(xt) = var(¬xt) = xt. For every clause Ci of Θ, let Gi be a clique of size 2α whose vertices are labeled by li,1, . . . , li,2α respectively. Let GΘ be the disjoint union of Gi for all clauses Ci of Θ. For every variable xt : t ∈ [r] let Dt be a clique of size 2α in which α vertices are labeled xt and the other α vertices are labeled ¬xt. Let DΘ be the disjoint union of Dt : t ∈ [r]. We construct a graph GΘ as follows. The graph GΘ is obtained from the disjoint union GΘ t DΘ of GΘ and DΘ by adding an edge between any vertex of GΘ and any vertex of DΘ whose labels are negations of each other (i.e. one is xt and the other is ¬xt, t ∈ [r]). Any coloring c : V (GΘ) → [2] can be interpreted as assigning the truth values true (for the color 1) and false (for the color 2) to the literals labeling the vertices. A coloring c of GΘ is consistent if the truth values assigned by c to the literals induce a well-defined truth value assignment asc to the variables. More precisely, c is consistent if any two vertices labeled the same (both xt or both ¬xt, t ∈ [r]) have the same color and any two vertices with opposing labels (xt and ¬xt, t ∈ [r]) have different colors.

Lemma 3.12. Let c : V (GΘ) → [2] be a coloring of GΘ.

(i) If c is a DU(Kα)-coloring, then c is consistent. (ii) If c is consistent, then the following are equivalent: (a) c is a DU(Kα)-coloring. (b) asc satisfies the condition of #α-of-2α-SAT.

Proof. For (i), we assume c is a DU(Kα)-coloring. For all i and t, Gi and Dt are cliques of size 2α. Hence, in each of the cliques Gi and Dt exactly α vertices are colored 1 and the other α vertices are colored 2. As a consequence, no vertex u is adjacent to any vertex v such that c(u) = c(v) and u and v belong to different cliques in GΘ t DΘ. Let u be a vertex of GΘ such that u is labeled by l and var(l) = xt. Since there are edges between u and the α vertices labeled by the negation of l in Dt, these α vertices cannot have the color c(u). As a consequence, the α vertices labeled by l in Dt must have the color c(u). We get that all the vertices of GΘ labeled with l receive the same color, which is different from the color of the vertices labeled by the negation of l, and we get (i). Moreover, c assigns exactly α vertices in each Gi to each of the colors, which implies that asc assigns exactly α of the literals of Ci to true and the other α to false. Hence asc is counted by #α-of-2α-SAT, and we get the direction (a)⇒(b) of (ii). For the direction (b)⇒(a) of (ii), let c be a consistent coloring such that asc is counted by #α-of-2α-SAT. We will prove that c is a DU(Kα)-coloring. Since asc is counted by #α-of-2α-SAT, it assigns true to α literals and false to the other α literals of each clause. Hence, c colors every clique Gi so that α vertices receive color 1 and the other α receive color 2. Each of the two colors induces a clique of size α in Gi. Since asc is consistent and Dt consists of α vertices labeled by some label l and α vertices labeled by the negation of l, each color class of c induces a clique of size α in Dt. It remains to notice that, since c is consistent, any other edge of GΘ crosses

16 between the color classes, hence does not belong to the induced subgraph of any of the two colors. Consequently, each of the colors induces a disjoint union of cliques of size α in GΘ.

As a consequence of Lemma 3.12 we have #α-of-2α-SAT(Θ) = χDU(Kα)(GΘ; 2). From [CH96] we have: Theorem 3.13. For every α ≥ 2, #α-of-2α-SAT is #P-hard. From Lemma 3.12 and Theorem 3.13, and using the fact that the construction of GΘ can be done in polynomial time, we get:

Theorem 3.14. For every α ≥ 2, χDU(Kα)(G; 2) is #P-hard.

Proposition 3.15. χDU(Kα)(G; 0) and χDU(Kα)(G; 1) are polynomial time computable.

Proof. For X = 0, χDU(Kα)(G; 0) is always 0 and hence trivially polynomial time computable. For X = 1, there is exactly one coloring c : V (G) → [1] and c is a DU(Kα)-coloring iff G is a disjoint union of copies of Kα, which can be verified in polynomial time.

Putting all this together we get the full complexity spectrum for χDU(Kα)(G; X) for α ≥ 2. Recall that χDU(K1)(G; X) = χ(G; X) is the chromatic polynomial.

Theorem 3.16. For all α ≥ 2, we have EASY(χDU(Kα)) = {0, 1} and

#PHARD(χDU(Kα)) = F − {0, 1}.

Moreover, for α ≥ 1 the Difficult Point Dichotomy is true for χDU(Kα)(G; X), as for α = 1 it includes the chromatic polynomial.

4. Counting convex colorings is #P-complete: the proof

The purpose of this section is to prove Theorem 3.5. This answers a question originally asked in [Mak08b], whether the problem of counting the number of convex colorings using at most two colors, i.e. computing χconvex(−; 2), is #P-complete on connected graphs. This section follows almost verbatim the preprint posted as [GN08].

4.1. Cuts, crossing sets, and cocircuits Let X and Y be disjoint sets of vertices of a graph G. The set of edges of G that have one endpoint in X and the other in Y is denoted by δ(X,Y ). Given a connected graph G, a cut is a partition of V (G) into two (non-empty) sets called its shores. The crossing set of a cut with shores X and Y is δ(X,Y ). A cut is a cocircuit if no proper subset of its crossing set is the crossing set of a cut. Given a set A of edges, we denote by G \ A the graph obtained by removing the edges in A from G. We will use the following observation: Lemma 4.1. Let G be a connected graph. Then a cut of G with crossing set A is a cocircuit if and only if G \ A has exactly two connected components.

17 Note that our terminology is slightly at odds with standard usage in the sense that the terms cut and cocircuit usually refer to what we call the crossing set of respectively a cut and a cocircuit. Our usage prevents some cumbersome descriptions in the proofs. We will however abuse our notation by saying that a cut or cocircuit has size k if its crossing set has size k.

4.2. Reductions We prove Theorem 3.5 by a sequence of reductions involving the following prob- lems:

Problem: #COCIRCUITS Input: Connected graph G. Output: The number of cocircuits of G.

Problem: #REQUIRED SIZE COCIRCUITS Input: Connected graph G, strictly positive integer k. Output: The number of cocircuits of G of size k.

Problem: #MAX CUT Input: Connected graph G, strictly positive integer k. Output: The number of cuts of G of size k.

Problem: #MONOTONE 2-SAT Input: A Boolean formula in conjuctive normal form in which each clause con- tains two variables and there are no negated literals. Output: The number of satisfying assignments.

It is easy to see that each of these problems is a member of #P. The following result is from Valiant’s seminal paper on #P [Val79].

Theorem 4.2. #MONOTONE 2-SAT is #P -complete. We will establish the following reductions.

18 #MONOTONE 2-SAT ∝ #MAX CUT ∝ #REQUIRED SIZE COCIRCUITS ∝ #COCIRCUITS ∝ χconvex(−; 2) Combining Theorem 4.2 with these reductions shows that each of the five problems that we have discussed is #P-complete. As far as we are aware, each of these reductions is new. We have not been able to find a reference showing that #MAX CUT is #P complete. Perhaps it is correct to describe this result as ‘folklore’. In any case we provide a proof below. Some similar problems, but not exactly what we consider here, are shown to be #P complete in [PB83].

Lemma 4.3. #MONOTONE 2-SAT ∝ #MAX CUT.

Proof. Suppose we have an instance I of #MONOTONE 2-SAT with variables x1, . . . , xn and clauses C = {C1,...,Cm}. We construct a corresponding instance M(I) = (G, k) of #MAX CUT by first defining a graph G with vertex set [ {x} ∪ {x1, . . . , xn} ∪ {{ci,1, . . . , ci,6} : 1 ≤ i ≤ m}

For each clause we add nine edges to G. Suppose Cj is xu ∨ xv. Then we add the edges

xcj,1, cj,1cj,2, cj,2xu, xucj,3, cj,3cj,4, cj,4xv, xvcj,5, cj,5cj,6, cj,6x.

Distinct clauses correspond to pairwise edge-disjoint circuits, each of size 9. Now let k = 8|C|. We claim that the number of solutions of instance M(I) of #MAX CUT is equal to 3|C| times the number of satisfying assignments of I. Given a solution of I, let L1 be the set of variables assigned the value true and L0 the set of variables assigned false together with x. Observe that for each clause Cj = xu ∨ xv there are three choices of how to add the vertices cj,1, . . . , cj,6 to either L0 or L1 so that exactly eight edges of the circuit corresponding to Cj have one endpoint in L0 and the other in L1. Clearly the choices for each clause are independent and distinct satisfying assignments result in distinct choices of L0 and L1. Any of the choices of L0 and L1 constructed in this way may be taken as the shores of a cut of size 8|C|. Hence we have constructed 3|C| solutions of M(I) corresponding to each satisfying assignment of I. In any graph the intersection of a set of edges forming a circuit and a crossing set of a cut must always have even size. So in a solution of M(I) each of the edge-disjoint circuits making up G and corresponding to clauses of I must contribute exactly eight edges to the cut. Suppose U and V \ U are the shores of a cut of G of size 8|C|. Then it can easily be verified that for any clause C = xu ∨ xv both U and V \ U must contain at least one element from {xu, xv, x}. So it is straightforward to see that this solution of M(I) is one of those constructed above corresponding to the satisfying assignment where a variable is false if and only if the corresponding vertex is in the same set as x.

Lemma 4.4. #MAX CUT ∝ #REQUIRED SIZE COCIRCUITS.

19 Proof. Suppose (G, k) is an instance of #MAX CUT. We construct an instance (G0, k0) of #REQUIRED SIZE COCIRCUITS as follows. Suppose G has n vertices. To form G0 0 add new vertices x, x , x1, . . . , xn2 to G. Now add an edge from x to every other vertex of G0 except x0 and similarly add an edge from x0 to every other vertex of G0 except x. Let k0 = n2 + n + k. From each solution of the #MAX CUT instance (G, k) we 2 construct 2n +1 solutions of the #REQUIRED SIZE COCIRCUITS instance (G0, k0). Suppose C = (U, V (G) \ U) is a solution of (G, k) then we may freely choose to add 0 0 x, x , x1, . . . , xn2 to either U or V (G) \ U, with the sole proviso that x and x are not both added to the same set, to obtain a cut in G0 of size k0 = n2 + n + k. Furthermore this cut is a cocircuit because both shores contain exactly one of x and x0 and so they induce connected subgraphs. Conversely suppose C = (U, V (G0) \ U) is a cocircuit in G0 of size k0. Consider 0 the pair of edges incident with xj. Note that the partition (xj,V (G )\xj) is a cocircuit. So if both of the edges incident with xj are in the crossing set of C then because of 0 its minimality we must have C = (xj,V (G ) \ xj) which is not possible because C 0 would then have size 2 < k . Now suppose that neither edge incident with xj is in the crossing set of C. 0 Then both x and x , and hence x1, . . . , xn2 , lie in the same block of the partition constituting C. But since G is a simple graph, the maximum possible size of such a n 2 cocircuit is at most 2n + 2 < n + n + k. Hence precisely one of the edges adjacent 0 to xj is in the crossing set. So x and x are in different shores of C. Hence the crossing 2 set of C contains: for each j precisely one edge incident to xj (n edges in total), for each v ∈ V (G) precisely one of edges vx and vx0 (n edges in total) and k other edges with both endpoints in V (G). So the partition C0 = (U ∩V (G),V (G)\U) is a cut of G of size k and hence C is one of the cocircuits constructed in the first part of the proof. Consequently the number of solutions of the instance (G0, k0) of #REQUIRED SIZE 2 COCIRCUITS is 2n +1 multiplied by the number of solutions of the instance (G, k) of #MAX CUT

Lemma 4.5. #REQUIRED SIZE COCIRCUITS ∝ #COCIRCUITS

Proof. Given a graph G let Nk(G) denote the number of cocircuits of size k and N(G) denote the total number of cocircuits. Let Gl denote the l-stretch of G, that is, the graph formed from G by replacing each edge of G by a path with l edges. Let m = |E(G)|. Then we claim that m X l N(G ) = lkN (G) + m. l k 2 k=1

To see this, suppose that C is a cocircuit of Gl. If the crossing set of C contains two edges from one of the paths corresponding to an edge of G then by the minimality of the crossing set of C we see that it contains precisely these two edges. The number l of such cocircuits is 2 m. Otherwise the crossing set C contains at most one edge from each path in Gl cor- responding to an edge of G. Suppose the crossing set of C contains k such edges. Let A denote the corresponding edges in G. Then A is the crossing set of a cocircuit in G k of size k. From each such cocircuit we can construct l cocircuits of Gl by choosing one edge from each path corresponding to an edge in A. The claim then follows.

20 If we compute N(G1),...,N(Gm) then we may retrieve N1(G),...,Nm(G) by using Gaussian elimination because the matrix of coefficients of the linear equations is an invertible Vandermonde matrix. The fact that the Gaussian elimination may be carried out in polynomial time follows from [Edm67].

Lemma 4.6. #COCIRCUITS ∝ χconvex(−; 2) Proof. The lemma is easily proved using the following observation. When two colors are available, there are two convex colorings of a connected graph using just one color and the number of convex colorings using both colors is equal to twice the number of cocircuits.

The preceding lemmas imply our main result, Theorem 3.5, that χconvex(−; 2) is #P-hard.

5. Detailed case study: Discrete spectra

In this section we dicuss cases where we were not able to find a suitable version of Linial’s Trick, but where we could determine the complexity of the evaluations for non-negative integers.

5.1. Proper edge colorings

Recall that χedge(G; k) counts the number of proper edge colorings of a graph G with k colors. It is a polynomial in k because

χedge(G; k) = χ(L(G); k), where L(G) is the line graph of G and χ(G; k) is the chromatic polynomial. We have χedge(G; 0) = 0 and ( 1 if G consists of isolated edges and vertices χedge(G; 1) = 0 otherwise

Although χedge(G; k) = χ(L(G); k), where L(G) is the line graph of G, not every graph G is the line graph of some graph G0. The class of all finite line graphs, LG, has been completely characterized, [Bei70, BLS99].

Theorem 5.1 (Beineke, 1970, [Bei70]). There are nine graphs Fi : 1 ≤ i ≤ 9, each with at most 6 vertices, such that G ∈ LG if and only if no Fi is an induced subgraph of G. The complexity spectrum of the chromatic polynomial restricted to the class LG has, to the best of our knowledge, not been studied. Surprisingly, the complexity of counting proper edge colorings was proven #P- hard only recently, [CGW14]:

Theorem 5.2 (J. Y. Cai, H. Guo, T. Williams, 2014). For k ∈ N we have:

21 (i) χedge(G; k) is #P-hard over planar r-regular graphs for all k ≥ r ≥ 3. (ii) χedge is trivially tractable when k ≥ r ≥ 3 does not hold.

The proof given in [CGW14] reduces χedge(G; k) to computation of the diagonal of the Tutte polynomial T (G; X,X) using several intermediate steps via Holants7. Problem 5.3. Find an elementary (holant-free) proof of Theorem 5.2.

Theorem 5.2 gives us the discrete complexity spectrum for k ∈ N. We were unable to adapt Linial’s Trick to proper edge colorings. Therefore we do not know how to determine the complexity of χedge(G; X) for X = a and a ∈ C − N or even a ∈ Q − N.

Problem 5.4. Determine the full complexity spectrum of χedge(G; X) for X = a and a ∈ Q or a ∈ C.

5.2. mcct-colorings Let t ∈ N. Recall that a coloring f : V (G) → [k] is an mcct -coloring with k colors, if the connected components of each color class have at most t vertices. We easily verify:

+ Proposition 5.5. (i) For fixed t ∈ N being an mcct -coloring with k colors is a

CP-property, hence χmcct (G; k) is a polynomial in k (but not in t).

(ii) χmcct (G; k) is multiplicative over disjoint unions.

(iii) For t = 1 we have χmcc1 (G; k) = χ(G; k), i.e., it is the chromatic polynomial. (iv) For k = 1 a graph G is mcct -colorable iff G is a disjoint union of connected graphs with at most t vertices.

We next establish a complexity result.

Theorem 5.6. Computing χmcct (G; 2) is #P-complete for t ≥ 2. To prove Theorem 5.6 we use a result due to Creignou and Hermann [CH96]. Let NAEk be the Boolean relation of all k-tuples having at least one 0 and at least one 1, k i.e. NAEk = {0, 1} r {0 ··· 0, 1 ··· 1}, commonly called the not-all-equal relation. Let NAEk(x1, . . . , xk) be a constraint which is satisfied only by all tuples from the relation NAEk.A NAEk formula ϕ = c1 ∧ · · · ∧ cn is satisfied if each clause ci is not-all-equal satisfied. Given a CNF formula ϕ, the counting problem #NAEkSAT asks for the number of not-all-equal satisfying assignments of ϕ.

Theorem 5.7 ([CH96]). #NAEkSAT is #P-complete for each k ≥ 3. Proof of Theorem 5.6. The membership in #P is clear, therefore we focus on the proof of #P-hardness. We perform a parsimonious reduction from #NAEt+1SAT. Given a NAEt+1 formula ϕ, we associate with it the graph Gϕ in the following way. For each clause c = NAEt+1(x1, . . . , xt+1) construct the clause gadget (as in

7For background on holants, cf. [Val08, CLX11]

22 x2 x1

c1

c2

x3 x4

(a) Clause gadget

y2 x1 b x1 z2

1 1 c1 c2

2 2 c1 c2

y3 y4 z4 z3

(b) Bridge

Figure 2: Clause gadget (a) for a clause c = NAE4(x1, x2, x3, x4) and a bridge (b) connecting two vertices labeled by the same variable x1 in two different clauses c1 = NAE4(x1, y2, y3, y4) and c2 = NAE4(x1, z2, z3, z4).

23 Figure 2a for t = 3), consisting of a complete graph K2t. Label t + 1 vertices of K2t 1 t−1 by the variables x1,..., xt+1 and the remaining t − 1 vertices by c ,..., c , where c is the identifier of the clause. Connect different copies of the same variable in two clause gadgets by a bridge with a new vertex b. There is a new bridge vertex b for each pair of variable vertices labeled by the same variable x in different clause gadgets. Figure 2b illustrates (for t = 3) how two copies of the variable x1 in clauses c1 = NAEt+1(x1, y2, . . . , yt+1) and c2 = NAEt+1(x1, z2, . . . , zt+1) are connected through a bridge with a new node b. We show that each mcct-coloring of the graph Gϕ encodes a NAEt+1-satisfiability of the formula ϕ. A valid mcct 2-coloring of each clause gadget forces t variables to be colored by the color 0 and the t others by the color 1. Restricted to the variable nodes x1,..., xt+1 of the clause gadget, this represents a correct assignment of the constraint NAEt+1(x1, . . . , xt+1). No other 2-coloring of the clause gadget is a valid mcct coloring. When two occurrences of the same variable x are connected through a bridge with a vertex b, this bridge vertex b must be colored by a different color than the vertices labeled by x. Indeed, in a valid mcct coloring, the vertex x in the clause gadget is connected to another t − 1 vertices colored by the same color. This induces a different color for the vertex b, otherwise there would be a connected component containing t + 1 vertices and colored by the same color. This also forces the two copies of the variable x, connected by a bridge, to be colored by the same color. Hence, the satisfying assignments of a NAEt+1SAT formula ϕ are in one-to-one correspondence to the mcct 2-colorings of Gϕ, which constitutes a parsimonious re- duction from #NAEt+1SAT.

Next we determine the complexity of χmcct (G; k) for k, t ∈ N.

Theorem 5.8. For any integers t and k that are both at least two, χmcct (G; k) is #P- complete. Proof. Membership in #P is clear. We shall show that if t and k are integers and both at least two, then χmcct (G; k) is polynomial time reducible to χmcct (G; k + 1). Combining this with Theorem 5.6 gives the result. Given a graph G, form G0 from G by adding a clique on t(k + 1) new vertices and joining one of the new vertices to every vertex of G. In any valid coloring of G0 with k + 1 colors, each color class must contain precisely t of the new vertices and these (k+1)t (k+1)t vertices can be colored in t,t,...,t ways, where t,t,...,t is the multinomial coefficient counting the number of ways of choosing an ordered collection of k + 1 subsets each of size t from a set of size (k + 1)t. Once the new vertices have been colored there are k colors available to color the vertices of G. Thus  (k + 1)t  χ (G0; k + 1) = χ (G; k). mcct t, t, . . . , t mcct The result follows. Remark 4. The statement  (k + 1)t  χ (G0; k + 1) = χ (G; k). mcct t, t, . . . , t mcct

24 appears at first sight to be an instance of Linial’s Trick, but there is a subtle difference. In the proof above the choice of G0 = f(G, t, k) both depends on t and k. In applying Linial’s Trick we require that the graph G0 = g(G) does not depend on k in order to get a polynomial identity of the form

n χmcct (g (G); k + n) = f(k, n, t) · χmcct (G; k).

Currently we do not know whether there is a version of Linial’s Trick which can be used for χmcct (G; X).

Using the fact that χmcc1 (G; X) is the chromatic polynomial and the previous dis- cussion (Proposition 5.5, and Theorems 5.6 and 5.8) we get

Corollary 5. Evaluating χmcct (G; X) is in P for t = 1 and k = 0, 1, 2, and for t ≥ 2 and k = 1. For all other values of t, k ∈ N evaluation is #P-complete.

Problem 5.9. What is the complexity spectrum for χmcct (G; a) for t ≥ 2 and a ∈ F − N? In Theorem 3.16 we have determined completely the complexity spectrum for

χDU(Kα)(G; X). This was meant to be a warm-up exercise for determining the com- plexity spectrum for χmcct (G; X), as each DU(Kα)-coloring is also an mccα-coloring.

However, determining the difficulty of evaluating χmcct (G; X) seems to be much more demanding.

5.3. H-free-colorings A function f : V (G) → [k] is an H-free coloring if no color class induces a graph isomorphic to H. Clearly this is a CP-property, hence χH−free(G; k) is a polynomial in k. The discrete complexity spectrum is rather well understood:

Theorem 5.10. (i) ([ABCM98]) χH−free(G; k) is #P-hard for every k ≥ 3 and H with at least 2 vertices.

(ii) ([Ach97]) χH−free(G; 2) is NP-hard for every H with at most 2 vertices. It is easy to see that for X = 0, 1 we have the following evaluations:

χH−free(G; 0) = 0 and ( 1 if G is H − free χH−free(G; 1) = 0 otherwise .

Problem 5.11. What is the complexity of evaluation of χH−free(G; a) for a ∈ F−N? H-free coloring is another case where Linial’s Trick does not seem to work.

25 6. More graph polynomials

In this section we discuss some graph polynomials for which we have only partial knowledge, if any, about the complexity spectrum. The graph polynomials χΦ(G; k) we discuss arise from CP-properties Φ defined in Section 6.1. Three of them, (i-iii), belong to the framework of P1 − P2-colorings from Subsection 2.2, listed in Table 3, and the remaining two, (iv,v), are mentioned here because they have a rich literature. In each case we do not know — but suspect — that evaluation of χΦ(G; X) is #P-hard for X = a for at least one a ∈ F.

Problem 6.1. Determine the full complexity spectrum of χΦ(G; X) for each of the graph polynomials in Section 6.1.

Instead of counting colorings one can look at the corresponding decision problem which asks whether χΦ(G; k) > 0. Clearly, the counting problem is at least as hard as this decision problem. For each of the graph properties Φ above we do know that computing the polynomial χΦ(G; X) is NP-hard. Furthermore, in two cases we dis- cuss dichotomy theorems showing that an evaluation of χΦ(G; X) is either in P or NP-hard.

6.1. Graph polynomials with incomplete complexity spectrum We consider the following colorings:

(i) Let t ∈ N. A function c : V (G) → [k] is a t-improper coloring if every color induces a graph of maximal degree t. t-improper colorings were studied in [CGJ97]. They originate in certain network problems. (ii) A function c : V (G) → [k] is an acyclic coloring if it is proper and there is no two colored cycle in G. Acyclic colorings were introduced in [Gru73] and further studied in [AMR91]. (iii) A function f : V (G) → [k] is a co-coloring if every color class induces a graph which is either a clique or an independent set. Co-colorings were first studied in [HJL77]. (iv) A function f : E(G) → [k] is a rainbow-path coloring (rainbow coloring for short) if every two vertices are connected by a path in which every two edges are colored differently. Rainbow colorings were first introduced in [CJMZ08]. (v) A function f : V (G) → [k] is an injective coloring if it is injective on the open neighborhood of every vertex. f does not have to be a proper coloring. In other words, if there is a path of length 2 between v and u then u and v must have different colors.

Let Φt−imp, Φacyc, Φco−co, Φrainbow, and Φinject denote respectively the coloring properties of t-improper colorings for fixed t ∈ N, acyclic colorings, co-colorings, rainbow colorings, and injective colorings. Clearly, each of these coloring properties Φ is a CP-property, and hence the number of colorings in each Φ is a polynomial in k. We denote by χt−imp(G; k), χacyc(G; k), χco−co(G; k), χrainbow(G; k), and χinject(G; k) the graph polynomials χΦ(G; k) counting colorings with at most k colors of a graph G in the corresponding Φ.

26 For acyclic colorings, co-colorings, rainbow colorings and injective colorings, the complexity spectrum is completely unknown. For t-improper colorings, partial results are known. For t = 0, the t-improper colorings are exactly the proper colorings, hence χ0−imp(G; k) = χ(G; k) and the complexity spectrum is completely understood. For t = 1 and k ∈ N we have χ1−imp(G; k) = χmcc2 (G; k) and the complexity spectrum is completely understood. For t = 2 every color class consists of a disjoint union of paths and cycles. This is the first case where the complexity spectrum of χ2−imp(G; k) is not known.

6.2. NP-hardness From the literature, we have that each of the graph polynomials defined in Sec- tion 6.1 is NP-hard:

Theorem 6.2. (i) Let t ∈ N. Let Φ be one of Φt−imp Φco−co, Φrainbow, and Φinject. Computing the minimal integer k ∈ N such that χΦ(G; k) > 0 is NP-hard. (ii) It is NP-hard to decide for a given G and k if the acyclic chromatic number of G is at most k. Proof. The case of t-improper colorings in Theorem 6.2(i) follows directly from [CGJ97]. The case of co-colorings is proven in [GKS94]. The case of rainbow colorings is proven in [CFMY11]. The case of injective colorings follows directly from [HKSS02]. Theo- rem 6.2(ii) is proven in [Kos78]. For t-improper colorings we are able to give a dichotomy theorem for graphs with multiple edges:

Proposition 6.3. (i) For every a ∈ F−{0, 1} the problem of evaluating χt−imp(G; a), where the input runs over the class of graphs with multiple edges allowed, is NP- hard. (ii) The evaluations χt−imp(G; 0) and χt−imp(G; 1) are in P.

Proof. Let G ./t K1 be the graph obtained from G by adding a new vertex v and putting t + 1 edges between v and any vertex of G. Clearly, v cannot be colored the same color as any other vertex of G. Therefore, we can use Linial’s Trick.

For acyclic colorings, we have a partial dichotomy. The evaluations of χacyc(G; X) with X = 0 and X = 1 are trivial by definition, because every proper coloring with less than two colors is acyclic.

Proposition 6.4. For every a∈ / N, it is NP-hard to compute χacyc(G; a). Proof. We use a version of Linial’s Trick for the chromatic polynomial. Consider G ./ K1. Every acyclic coloring f of G ./ K1 with color set [k] must color the vertex K1 with a unique color. The coloring f|G induced by f on G is clearly proper and does not contain any two-colored cycles, since f is acyclic. On the other hand, every acyclic coloring g of G with color set [k − 1] can be transformed to an acyclic coloring f of G ./ K1 with color set [k] by coloring K1 with any of the k colors, and then setting ( g(v) g(v) < f(K ) f(v) = 1 g(v) + 1 g(v) ≥ f(K1)

27 for any v ∈ V (G). Hence we get

χacyc(G ./ K1; x0) = χacyc(G; x0 − 1) · x0 .

Using Theorem 6.2(ii) we complete the proof. A solution of the following problem would complete the dichotomy:

Problem 6.5. What is the complexity of the evaluation χacyc(G; a) for a ∈ N−{0, 1}?

7. Conclusions and open problems

In the light of the discovery of many univariate graph polynomials in [KMZ11], and the fact that infinitely many of them are incomparable in expressive power, The- orem 2.3, we initiated the systematic study of these graph polynomials. Inspired by N. Linial’s work in [Lin86] we have concentrated in this paper on the complexity of evaluating these graph polynomials. We have introduced the full and the discrete com- plexity spectrum of univariate graph polynomials. In this paper we concentrated our attention on graph polynomials arising from graph colorings previously studied in the literature. Throughout the paper we have listed8 open problems we encountered in our ex- plorations. They mostly ask for the complete determination of the full complexity spectrum for specific graph polynomials. Among the more interesting challenges we have the following: Problem 7.1. Determine the full complexity spectrum of

(i) the edge chromatic polynomial χedge(G; X);

(ii) the polynomial χmcct (G; X) for t ≥ 2; (iii) the polynomials χH−free(G; X) for t ≥ 2; (iv) the generalized chromatic polynomials derived from t-improper colorings, acyclic colorings, co-colorings, rainbow-path colorings and injective colorings of Sec- tion 6. We have not found a single graph polynomial which does not have a complexity spectrum satisfying the Difficult Point Dichotomy. Our results so far suggest that there might be meta-theorem to be formulated, and finally also to be proven, which says that for a large class of graph polynomials Difficult Point Dichotomy holds. The large class in question should be defined by some definability criterion. Examples of such criteria could come from descriptive complexity theory. Here are some candidates for logically defined classes9 of univariate graph polyno- mials (i) All SOL-definable graph polynomials.

8These are Problems 1.6, 2.4, 5.3, 5.4, 3.10, 5.9, 5.11, 6.1 and 6.5. 9For a discussion of logically defined classes of graph polynomials, see [Mak08a, MKR13, KMZ11, Kot12].

28 (ii) All MSOL-definable graph polynomials. (iii) All P-chromatic polynomials where P is in NP, or equivalently, where P is definable in ∃SOL, the existential fragment of SOL. Previous experience suggests that it is too early to formulate a solid conjecture. Problem 7.2. Formulate and prove a meta-theorem for the Difficult Point Dichotomy.

We hope the search for a meta-theorem will spawn further research and will lead to new insights both in graph theory and in descriptive complexity theory.

Acknowledgements We would like to thank two anonymous referees of an earlier version of this paper for their accurate reading and spotting gaps and imprecisions, and for their extremely valuable comments. We would also like to thank the editors of this special issue, J. Ellis-Monaghan, J. Kung and I. Moffatt for their patience and support.

References

[ABCM98] D. Achlioptas, J. I. Brown, D. G. Corneil, M. S. Molloy. The existence of uniquely- g colourable graphs, Discrete Math., 179 (1998) 1–11. [Ach97] D. Achlioptas. The complexity of G-free colourability, Discrete Math., 165 (1997) 21–30. [ADOV03] N. Alon, G. Ding, B. Oporowski, D. Vertigan. Partitioning into graphs with only small components, Journal Combin. Theory, Ser. B, 87 (2003) 231–243. [AM] I. Averbouch, J.A. Makowsky. The complexity of multivariate matching polynomials, Preprint, January 2007. [AMR91] N. Alon, C. McDiarmid, B. Reed. Acyclic coloring of graphs, Random Structures Algorithms, 2 (1991) 277–288. [AS87] K. Ambos-Spies. Polynomial time degrees of NP-sets, In E. Borger,¨ editor, Trends in Theoretical Computer Science, Computer Science Press 1987, 95–142. [BDM10] M. Blaser,¨ H. Dell, J. A. Makowsky. Complexity of the Bollobas-Riordan´ polynomial: Exceptional points and uniform reductions, Theory Comput. Systems, 46 (2010) 690–706. [Bei70] L. W. Beineke. Characterizations of derived graphs, J. Combin. Theory, 9 (1970) 129–135.

[BG05] A. Bulatov, M. Grohe. The complexity of partition functions, Theoret. Comput. Sci., 348 (2005) 148–186.

29 [Bir12] G.D. Birkhoff. A determinant formula for the number of ways of coloring a map, Ann. of Math., 14 (1912) 42–46. [BLS99] A. Brandstadt,¨ V.B. Le, J. Spinrad. Graph Classes: A survey, SIAM Monographs on Discrete Mathematics and Applications. SIAM, 1999.

[Bro96] J. I. Brown. The complexity of generalized graph colorings, Discrete Appl. Math., 69 (1996) 257–270. [CCL13] J. Cai, X. Chen, P. Lu. Graph homomorphisms with complex values: A dichotomy theorem, SIAM J. Comput., 42 (2013) 924–1029. [CFMY11] S. Chakraborty, E. Fischer, A. Matsliah, R. Yuster. Hardness and algo- rithms for rainbow connection, Journal Combin. Optim., 21 (2011) 330– 347. [CGJ97] L. Cowen, W. Goddard, C. E. Jesurum. Defective coloring revisited, J. Graph Theory, 24 (1997) 205–219.

[CGW14] J. Cai, H. Guo, T. Williams. The complexity of counting edge colorings and a dichotomy for some higher domain holant problems, Res. Math. Sci., 3 (2016) 18. [CH96] N. Creignou, M. Hermann. Complexity of generalized satisfiability counting problems, Inform. and Comput., 125 (1996) 1–12.

[CJMZ08] G. Chartrand, G.L. Johns, K.A. McKeon, P. Zhang. Rainbow connection in graphs, Math. Bohem., 133 (2008) 85–98. [CLX11] J. Cai, P. Lu, M. Xia. Computational complexity of holant problems, SIAM J. Comput., 40 (2011) 1101–1132.

[DBG17] E. Drgas-Burchardt, K. Gibek. Harmonious colourings of graphs, Discrete Appl. Math., 217 (2017) 175–184. [DG00] M. Dyer, C. Greenhill. The complexity of counting graph homomor- phisms, Random Structures Algorithms, 17 (2000) 260 – 289. [Edm67] J. Edmonds. Systems of distinct representatives and linear algebra, Jour- nal of Research of the National Bureau of Standards Section B, 71B (1967) 241–245. [Edw97] K. Edwards. The harmonious chromatic number and the achromatic num- ber, In R. A. Bailey, editor, Survey in , London Math. Soc. Lecture Note Ser., 241 (1997) 13–47.

[EM95] K. Edwards, C. McDiarmid. The complexity of harmonious colouring for trees, Discrete Appl. Math., 57 (1995) 133–144. [Far04] A. Farrugia. Vertex-partitioning into fixed additive induced-hereditary properties is NP-hard, Electron. J. Comb., 11 (2004).

30 [GJ79] M.G. Garey, D.S. Johnson. Computers and Intractability, Mathematical Series. W.H. Freeman and Company, 1979. [GKS94] J. Gimbel, D. Kratsch, L. Stewart. On cocolourings and cochromatic numbers of graphs, Discrete Appl. Math., 48 (1994) 111–127.

[GN08] A. J. Goodall, S. D. Noble. Counting cocircuits and convex two- colourings is#P-complete, arXiv preprint arXiv:0810.2042v1, 2008 [Gru73] B. Grunbaum. Acyclic colorings of planar graphs, Israel J. Math., 14 (1973) 390–412. [HIMRS98] H. B. Hunt III, M. V. Marathe, V. Radhakrishnan, R. E. Stearns. The complexity of planar counting problems, SIAM J. Comput., 27 (1998) 1142–1167. [HJL77] L. Straight, H.J. Lesniak. The cochromatic number of a graph, Ars Com- bin., 3 (1977) 39–46.

[HK83] J.E. Hopcroft, M.S. Krishnamoorthy. On the harmonious coloring of graphs, SIAM J. Algebraic Discrete Methods, 4 (1983) 306–311. [HKSS02] G. Hahn, J. Kratochvil, J. Siran, D. Sotteau. On the injective chromatic number of graphs, Discrete Math., 256 (2002) 179–192. [KH83] D.G. Kirkpatrick, P. Hell. On the complexity of general graph factor problems, SIAM J. Comput., 12 (1983) 601–609. [KM14] T. Kotek, J.A. Makowsky. Connection matrices and the definability of graph parameters, Log. Methods Comp. Sci., 10 (2014). [KMR17] T. Kotek, J.A. Makowsky, E.V. Ravve. On sequences of graph polynomi- als arising from graph invariants, arXiv preprint arXiv:1701.08564v2. [KMZ08] T. Kotek, J.A. Makowsky, B. Zilber. On counting generalized colorings, In: Computer Science Logic, CSL’08, Lecture Notes in Computer Sci- ence, 5213 (2008) 339–353. [KMZ11] T. Kotek, J.A. Makowsky, B. Zilber. On counting generalized colorings, In: M. Grohe, J.A. Makowsky, editors, Model Theoretic Methods in Fi- nite Combinatorics, Contemporary Mathematics, 558 (2011) 207–242. [Kos78] A. V. Kostochka. Upper bounds of chromatic function, PhD thesis, Ph. D. Thesis, Novosibirsk, 1978 (in Russian), 1978.

[Kot12] T. Kotek. Definability of combinatorial functions, PhD thesis, Technion - Israel Institute of Technology, Haifa, Israel, March 2012. [Lad75] R.E. Ladner. On the structure of polynomial time reducibility, J. of ACM, 22 (1975) 155–171.

31 [Lin86] M. Linial. Hard enumeration problems in geometry and combinatorics, SIAM J. Algebraic Discrete Methods, 7 (1986) 331–335. [LMST07] N. Linial, J. Matousek, O. Sheffet, G. Tardos. with no large monochromatic components, Electron. Notes Discrete Math., 29 (2007) 115–122.

[Mak08a] J.A. Makowsky. From a zoo to a zoology: Towards a general theory of graph polynomials, Theory Comput. Syst., 43 (2008) 542–562. [Mak08b] J.A. Makowsky. Problem posed at the problem session at “Building Bridges: A conference on mathematics and computer science in honour of Laci Lovasz”,´ 2008. [MKR13] J.A. Makowsky, T. Kotek, E.V. Ravve. A computational framework for the study of partition functions and graph polynomials, In: Proceedings of the 12th Asian Logic Conference ’11, World Scientific, (2013), 210– 230.

[MRB14] J.A. Makowsky, E.V. Ravve, N.K. Blanchard. On the location of roots of graph polynomials, European J. Combin., 41 (2014) 1–19. [MS07] S. Moran, S. Snir. Efficient approximation of convex recolorings, J. Comput. System Sci., 73 (2007) 1078–1089.

[MZ06] J.A. Makowsky, B. Zilber. Polynomial invariants of graphs and totally categorical theories, MODNET Preprint No. 21, 2006, http://www.logique.jussieu.fr/modnet/Publications/Preprint%20server. [Pap94] C. Papadimitriou. Computational Complexity, Addison Wesley, 1994. [PB83] J.S. Provan, M.O. Ball. The complexity of counting cuts and of comput- ing the probability that a graph is connected, SIAM J. Comput., 12 (1983) 777–788. [Val79] L.G. Valiant. The complexity of enumeration and reliability problems, SIAM J. Comput., 8 (1979) 410–421.

[Val08] L. G. Valiant. Holographic algorithms, SIAM J. Comput., 37 (2008) 1565–1594.

32