Julio Araujo

Nicolas Nisse

Stéphane Pérennes

Weighted Coloring in Trees *

Keywords: Weighted Coloring, Exponential Time Hypothesis, 3-SAT, Trees Coloration pondérée, ETH, 3-SAT, arbre

A proper coloring of a graph is a partition of its vertex set into stable sets, where each part corresponds to a color. For a vertex-weighted graph, the weight of a color is the maximum weight of its vertices. The weight of a coloring is the sum of the weights of its colors. Guan and Zhu defined the weighted chromatic number of a vertex-weighted graph G as the smallest weight of a proper coloring of G (1997). If vertices of a graph have weight 1, its weighted chromatic number coincides with its chromatic number. Therefore, the problem of computing the weighted chromatic number is NP-complete in general graphs. This problem remains NP-complete in some particular graph classes as bipartite graphs.

In their seminal paper, Guan and Zhu asked whether the weighted chromatic number of bounded tree-width graphs (partial k-trees) can be computed in polynomial-time. Escoffier et al. designed a polynomial-time approximation scheme for computing the weighted chromatic number of partial k-trees (2006), and Kavitha and Mestre provided polynomial-time exact algorithms for sub-classes of trees (2009). Surprisingly, the time-complexity of computing this parameter in trees is still open. The Exponential Time Hypothesis (ETH) states that 3-SAT cannot be solved in sub-exponential time. We show that, assuming ETH, the best algorithm to compute the weighted chromatic number of n-node trees has time-complexity n Θ(log n) . Our result mainly relies on proving that, when computing an optimal proper weighted coloring of a graph G, it is hard to combine colorings of its connected components, even when G is a forest.

Introduction

Given a loop-less graph G = (V, E), a (proper) k-coloring of G is a surjective function c : V → {1, • • • , k} that assigns to each vertex v ∈ V a color c(v) ∈ {1, • • • , k}, such that, for any {u, v} ∈ E, c(u) = c(v). Equivalently, a k-coloring of G is a partition c = (S 1 , . . . , S k ) of V such that, for any 1 ≤ i ≤ k, S i is a non-empty independent set of vertices that have the same color i. One of the most studied problems in Graph Theory consists in minimizing the number of colors of a proper coloring of a graph. Namely, Graph Coloring aims at computing the chromatic number of a graph G, denoted by χ(G), which is the minimum k for which G has a k-coloring. This is one of the Karp's NP-hard problems [START_REF] Karp | Reducibility among combinatorial problems[END_REF].

In [START_REF] Guan | A coloring problem for weighted graphs[END_REF], Guan and Zhu generalized Graph Coloring to vertex-weighted graphs. A (vertex) weighted graph (G, w) consists of a loop-less graph G = (V, E) and a weight function w : V → R + over the vertices of G. Given a k-coloring c = (S 1 , . . . , S k ) of a weighted graph (G, w), the weight of color i (1 ≤ i ≤ k) is defined by w(i) = max v∈Si w(v). The weight of coloring c is w(c) = k i=1 w(i). The weighted chromatic number of (G, w), denoted by χ w (G), is the minimum weight of a proper coloring of (G, w). The Weighted Coloring Problem takes a weighted graph (G, w) as input and aims at computing χ w (G) [START_REF] Guan | A coloring problem for weighted graphs[END_REF].

Observe that if the weight of each of the vertices of a graph (G, w) is equal to one, then the weight of a coloring is the number of its colors and thus, χ w (G) = χ(G). Therefore, Weighted Coloring generalizes Graph Coloring to weighted graphs, and, as a consequence, this problem is NP-hard in general graphs. Moreover, Weighted Coloring has been shown NP-hard in bipartite graphs [START_REF] Demange | Weighted node coloring: When stable sets are expensive[END_REF], where Graph Coloring is trivial. In the last years, the Weighted Coloring Problem has been addressed several times, however the complexity of this problem is surprisingly still unknown in the class of trees.

Here, we show that, if 3-SAT cannot be solved in sub-exponential time (Exponential Time Hypothesis), then Weighted Coloring in trees is not in P.

Related work. Guan and Zhu defined the Weighted Coloring Problem to model various problems of shared resources allocation. For instance, many problems consider a set of processes that use some common resources (memory, medium of communication, etc.) and aim at minimizing the total amount of used resources. Indeed, it is possible to mutualize resources: given a subset of processes that do not simultaneously use the resources, they can be assigned the same resources. The amount of resources necessary for this subset of processes is given by the process that uses the maximum amount of resources. Such problems can clearly be modeled as Weighted Coloring in a conflict graph where processes are the nodes, the weight of a node is the amount of resources required by the corresponding process, and two nodes are adjacent if and only if the corresponding processes use resources simultaneously. More precisely, Guan and Zhu studied practical applications such as the Dynamic Storage Allocation Problem and the Distributed Dual Bus Network Media Access Control Protocol, which is a standard IEEE802.6 for metropolitan networks [START_REF] Guan | A coloring problem for weighted graphs[END_REF].

Weighted Coloring has been shown to be NP-hard in the classes of split graphs, interval graphs, triangle-free planar graphs with bounded degree, and bipartite graphs [START_REF] Demange | Weighted node coloring: When stable sets are expensive[END_REF][START_REF] De Werra | Weighted coloring on planar, bipartite and split graphs: Complexity and approximation[END_REF][START_REF] Escoffier | Weighted coloring: further complexity and approximability results[END_REF]. On the other hand, the weighted chromatic number of cographs and of some subclasses of bipartite graphs can be found in polynomial-time [START_REF] Demange | Weighted node coloring: When stable sets are expensive[END_REF][START_REF] De Werra | Weighted coloring on planar, bipartite and split graphs: Complexity and approximation[END_REF]. In their seminal paper, Guan and Zhu showed that, given a fixed parameter r ∈ N, the minimum weight of a coloring using at most r colors can be computed in polynomial-time 1 in the class of bounded treewidth graphs (a.k.a. partial k-trees) [START_REF] Guan | A coloring problem for weighted graphs[END_REF]. They let open the question of the time-complexity of the Weighted Coloring Problem in this class (partial k-trees) and, in particular, in trees. Later on, Escoffier et al. proposed a polynomialtime approximation scheme to compute the weighted chromatic number of bounded treewidth 1 We emphasize that this algorithm is exponential in r RR n°8249 graphs [START_REF] Escoffier | Weighted coloring: further complexity and approximability results[END_REF]. Kavitha and Mestre recently presented polynomial-time algorithms for subclasses of trees [START_REF] Kavitha | Max-coloring paths: tight bounds and extensions[END_REF]. More precisely, they show that computing the weighted chromatic number can be done in linear time in the class of trees where nodes with degree at least three induce a stable set [START_REF] Kavitha | Max-coloring paths: tight bounds and extensions[END_REF].

In the last years, many studies have been done on the Weighted Coloring Problem, however the complexity of this natural problem was still unknown on trees. Indeed, Weighted Coloring in trees has some intriguing properties: on the one hand, a reduction to another NP-hard problem was unlikely to exists due to the existence of a sub-exponential algorithm that we present in Section 2; on the other hand, all the classical methods to derive polynomial-time algorithms on trees failed [START_REF] Escoffier | Weighted coloring: further complexity and approximability results[END_REF][START_REF] Kavitha | Max-coloring paths: tight bounds and extensions[END_REF]. We provide here some explanation for these facts.

Our results. We show that, under the Exponential Time Hypothesis (ETH) (see Section 2), the best algorithm to compute the weighted chromatic number of trees has time-complexity n Θ(log n) , where n is the number of vertices of the input tree.

The existence of an algorithm that solves the Weighted Coloring Problem in time n Θ(log n) follows easily from previous results. The difficulty is to prove that it is optimal under ETH. For this purpose, we show that computing the weighted chromatic number of an n-node tree is as hard as deciding whether a 3-SAT formula with size log 2 n can be satisfied. So, our reduction is rather complex, but we hope that it contains ideas that may be used in other contexts. Along the line of our reduction, one will discover another surprising aspect: the difficulty of the problem not only comes from the graph structure, but rather relies on the way weights are structured. This implies that choosing the right color for a node is hard. We indeed use non binary constraint satisfaction formulae as main tool. Lastly, our reduction also proves that computing an optimal weighted coloring of a disconnected graph may be hard even if optimal colorings of each of its components can be done in polynomial-time.

Organization of the paper. The reminder of the paper is organized as follows. In Section 2, we formally state the main results of the paper: in Section 2.1, an n O(log n) -time algorithm is derived from previous works, and in Section 2.2 we prove our main result assuming a technical reduction (Proposition 2). The remaining part of the paper is devoted to the proof of Proposition 2. In Section 3, we give the main ideas of its proof. Finally, in Section 4, we prove the Proposition 3 which allows to prove Proposition 2.

Preliminaries

Sub-exponential algorithm

In this section, we show that there exists a sub-exponential algorithm to solve the Weighted Coloring Problem in trees and more generally in the class of bounded treewidth graphs. Actually, this is an almost trivial consequence of previous works that mainly relies on the number of colors used by weighted colorings in this class of graphs.

It is easy to see that there exist weighted graphs G for which any optimal weighted coloring uses strictly more than χ(G) colors. For instance, let us consider the 4-node path P 4 with V (P 4 ) = {a, b, c, d}, w(a) = w(d) = 4 and w(b) = w(c) = 1 (see Figure 1). Any coloring of P 4 with 2 = χ(P 4 ) colors has weight 8, and the optimal coloring {{a, d}, {b}, {c}} of P 4 has weight χ w (P 4 ) = 6 but uses 3 colors.

Hopefully, the number of colors used by optimal weighted colorings can be bounded by O(log n) in the class of bounded treewidth graphs with n nodes. Indeed, in their seminal paper, Guan and Zhu studied the number of colors used by an optimal weighted coloring [START_REF] Guan | A coloring problem for weighted graphs[END_REF]. More precisely, they proved that the maximum number of colors of an optimal weighted coloring of a weighted graph (G, w) is its first-fit chromatic number χ F F (G) (a.k.a., Grundy number) [START_REF] Guan | A coloring problem for weighted graphs[END_REF]. Moreover, for any graph G, there exists a weight function w such that an optimal weighted coloring of (G, w) uses χ F F (G) colors. On the other hand, for any n-node graph G with tree-width at most k, χ F F (G) = O(k log n) [START_REF] Sales | Weighted coloring on graphs with bounded tree width[END_REF]. In particular, this implies that, for any n-node tree, there is an optimal weighted coloring using O(log n) colors. Finally, in the class of bounded treewidth graphs and when the number r ∈ N of colors is fixed, there is an algorithm (using dynamic programming on the tree-decomposition) that computes the minimum weight of a coloring using at most r colors in time O(n r ) where n is the number of vertices of the input graph [START_REF] Guan | A coloring problem for weighted graphs[END_REF].

Inria

By combining these results, the following proposition is straightforward:

Proposition 1 There exists an algorithm that solves the Weighted Coloring Problem in time n O(log n) in the class of bounded treewidth graphs, where n is the number of vertices of the input graph.

Main Result

We now state formally our results that are subject to the Exponential Time Hypothesis.

Recall that an instance of the 3-SAT Problem is any Boolean formula

Φ(v 1 , • • • , v η ) over the variables v 1 , • • • , v η in
the conjunctive normal form (CNF) where each clause involves three variables. The size of Φ is η if it depends on η variables and its number of clauses is polynomial in η. The 3-SAT Problem aims at deciding whether there exists a truth assignment to the variables such that Φ(v 1 , • • • , v η ) is true. It is well known that the 3-SAT Problem is NP-complete [START_REF] Cook | The complexity of theorem-proving procedures[END_REF]. A fundamental question is to know whether it can be solved in sub-exponential time.

Conjecture 1 (Exponential Time Hypothesis (ETH)) 3-SAT cannot be solved in time 2 o(η) where η is the size of the instance [START_REF] Impagliazzo | On the complexity of k-sat[END_REF].

Observe that proving ETH would imply that P = N P . The main part of this paper is devoted to prove the following result.

Proposition 2 For any Boolean formula Φ of size η, there exist a weighted tree (T, w) with n = 2 O( √ η) vertices and M ∈ R such that Φ is satisfiable if and only if χ w (T ) < M . Moreover, (T, w) and M are computable in polynomial time in n, i.e., in time 2 o(η) .

Proposition 2 allow us to prove that there is no polynomial-time algorithm to solve the Weighted Coloring Problem in trees, unless ETH fails.

Theorem 2 If ETH is true, then the best algorithm to compute the weighted chromatic number of a tree T has time-complexity n Θ(log n) where n is the number of nodes of T .

Proof. The existence of such an algorithm directly follows from Proposition 1.

For purpose of contradiction, let us assume that there exists an algorithm A that solves the Weighted Coloring Problem in time n o(log n) in the class of trees, where n is the number of vertices of the input tree.

Let Φ be any Boolean formula of size η. By Proposition 2, there exists a weighted tree (T, w)

with n = 2 O( √ η) = 2 o(η) vertices and M ∈ R such that Φ is satisfiable if and only if χ w (T ) < M .
Consider the following algorithm to solve 3-SAT. For any Boolean formula Φ of size η, first compute (T, w) and M in time η) . By definition, Φ is satisfiable if and only if χ w (T ) < M . Therefore, the above algorithm solves the 3-SAT Problem in time 2 o(η) where η is the size of the instance. This contradicts ETH.

2 o(η) , then use Algorithm A to compute χ w (T ) in time n o(log n) = 2 o((log n) 2 ) = 2 o(
The remaining part of the paper is devoted to the proof of Proposition 2.

Guideline of the proof of Proposition 2

Proposition 2 establishes a link between the Weighted Coloring Problem and 3-SAT. Our proof is quite technical, so this section is devoted to describe the main difficulties and ingredients of the proof. We also try to give some intuitions. When computing a coloring of a weighted graph, we are facing choices of the following kind: to color a node v, either we use a color c that is already used without increasing its weight, i.e., c has already been assigned to a vertex with weight greater than v, or the color c used for v increases the global weight, i.e., either c has not been used yet or the weight of v is greater than the weights of nodes previously colored with c. For instance, in the example of Figure 1, once the first two colors have been assigned to a and b, we have to decide either to assign a new color to c which increases the global weight, or to use again the color of a. Of course, there are other ways to proceed, but this example illustrates a choice that consists in either increasing the weight of one color or not doing it. In the example, we can choose to increase the weight of a new color from 0 to w(c) (by assigning this new color to c) or not to do it; this latter choice would however lead to a worse coloring. Intuitively, for a boolean formula Φ, we will build a tree such that the choices of the weights of the colors, in any coloring with small (depending on Φ) weight, will reflect the truth assignment of the variables of Φ.

From boolean variables to integral variables

Informally, to evaluate the time-complexity of the Weighted Coloring Problem, the ideal way would be to reduce any 3-SAT formula Φ to a weighted tree (T, w) such that (1) there is a correspondence between truth assignments of the variables of Φ and the optimal colorings of T , and (2) Φ is satisfiable if and only if χ w (T ) is at most some pre-defined value M (depending on Φ). To do such a reduction, we would like to proceed as follows: given a boolean formula Φ of size η, we build a tree T such that any truth assignment of Φ for which Φ is satisfied, we have a coloring of T or bounded weight, where the weight of a color reflects the truth assignment of a variable. However, proceeding that way, since the number of colors in an optimal weighted coloring of an n-node tree is at most O(log n), T must have at least n = 2 η nodes. Hence, a polynomial-time algorithm to solve the Weighted Coloring Problem in T would only lead to an exponential-time algorithm for deciding whether Φ is satisfiable.

From 3-SAT to INT-SAT.

To bypass this problem, we will use an auxiliary formula. Intuitively, given a 3-SAT formula with η boolean variables, we will translate it into another logical formula with √ η integral variables.

Using this new formula, we build a tree with 2 √ η nodes, where the weights of the colors in Inria coloring of bounded weight will correspond to the integral values of the variables. More formally, Definition 1 Given a set of n×m boolean variables (y i j ) i<n,j<m , an integral assignment of these variables is a truth assignment such that, for any 0 ≤ i < n, at most one variable y i j , ≤ j < m, receives value 1.

A boolean formula Φ with n × m boolean variables (y i j ) i<n,j<m is integrally satisfiable w.r.t. (y i j ) i<n,j<m if there is an integral assignment of its variables that satisfies Φ.

The INT-SAT Problem takes a formula Φ with variables (y i j ) i<n,j<m as input and aims at deciding whether Φ is integrally satisfiable w.r.t. (y i j ) i<n,j<m . It is important to note that there is a one-to-one mapping between any integral assignment of a set of n × m boolean variables (y i j ) i<n,j<m and the set of n-tuples

(x 1 , • • • , x n ) of integers in {0, • • • , m}.
Indeed, for any i < n, x i = j if and only if y i j = 1, and x i = 0 if y i j = 0 for any j < m.

We now show that 3-SAT can be sub-exponentially reduced to INT-SAT. This is an important ingredient of the proof of Proposition 2. We also think this result has its own interest and could be used in other context. Theorem 3 For any instance Φ of 3-SAT with size η, there is a Boolean formula

Φ int of size n = 2 O( √ η) , with variables (y i j ) i< √ η,j<2 √ η , such that Φ is satisfiable if and only if Φ int is integrally satisfiable w.r.t. (y i j ) i,j
. Moreover, Φ int can be computed in time n and it is a CNF formula where all variables appear positively.

Proof. Let Φ(u 1 , • • • , u η ) be a instance of 3-SAT of size η = N 2 (if η = N 2 ,
we can add dummy variables). For any two integers a < N and b < 2 N , let bit(a, b) correspond to the a-th bit of the binary representation of b.

Let Φ int be the formula obtained from Φ by replacing each literal u iN +j , 0 ≤ i < N and 0 ≤ j < N , by { |bit(j, )=1, 0≤ <2 N } v i . Then, each literal ūiN+j , 0 ≤ i < N and 0 ≤ j < N is re-

placed by { |bit(j, )=0, 0≤ <2 N } v i . Hence, Φ int has N •2 N variables (v 1 0 , • • • , v 1 2 N -1 , v 2 0 , • • • , v 2 2 N -1 , • • • , v N 0 , • • • , v N 2 N -1
) and poly(N ) clauses of size O(2 N ). Because Φ is in CNF, it is also the case for Φ int . Moreover, all variables appear positively in Φ int .

It remains to show that Φ int is integrally satisfiable if and only if Φ is satisfiable. First, let us assume that Φ is satisfiable. Let u 1 , • • • , u η be a valid assignment of its variables and, for any 0 ≤ i < N , let x i be the integer with (u N (i-1)+1 , • • • , u N (i-1)+N ) as binary representation. Finally, for any i < N and j < 2 N , let us define v i j = 1 if x i = j and v i j = 0 otherwise. By definition of Φ int , (v i j ) 0≤i<N, 0≤j<2 N is a valid assignment and Φ int is therefore integrally satisfiable.

Conversely, let us assume that Φ int is integrally satisfiable and let

(x 1 , • • • , x N ) be N integers representing a valid assignment for it. Let u 1 , • • • , u η be defined such that, for any 0 ≤ i < N , (u N (i-1)+1 , • • • , u N (i-1)+N ) is the binary representation of x i . Then, u 1 , • • • , u η is a valid assignment for Φ which is satisfiable. 3.1.3 Proof of Proposition 2.
Hence, the above Theorem allows us to reduce any 3-SAT instance Φ of size η into an INT-SAT instance Φ int with size 2 O( √ η) . The key point is that this reduction allows us to turn the choice of η boolean variables into the choice of

√ η integers in {0, • • • , 2 √ η }.
Then, in further sections, we build a tree T with 2 O( √ η) vertices from the formula Φ int , such that there is a one to one mapping between any optimal weighted coloring of T and the √ η-tuples of integers in

{0, • • • , 2 √ η }.
Finally, our reduction ensures that the value of χ w (T ) depends on the integral satisfiability of Φ int and therefore, on the satisfiability of Φ. More formally, the next sections are devoted to prove the following result:

Proposition 3 For any CNF Boolean formula Φ int of size n where all variables (y i j ) i,j appear positively, there exist a weighted tree (T (Φ int ), w) with a number of vertices polynomial in O(n) and M ∈ R such that Φ int is integrally satisfiable w.r.t. (y i j ) i,j if and only if χ w (T (Φ int )) < M . Moreover, (T (Φ int ), w) and M are computable in time polynomial in O(n).

The proof of Proposition 2 is straightforward from Theorem 3 and Proposition 3.

Main ingredients of the proof of Proposition 3

In this section, we give the main ideas of the proof of Proposition 3. In particular, we describe the main property of the tree that we aim at building. The formal proof of it can be found in Section 4.

Let n, m ∈ N. Let Φ int be any CNF Boolean formula with variables (y i j ) i<n,j<m . Let (T (Φ int ), w) be a weighted tree, with O(n • m) nodes and weights can be encoded with O(n • m) bits. Let M ∈ R, be a positive real value obtained from Φ int . The precise definitions of (T (Φ int ), w) and M are given in next section.

Let C be the set of all colorings of (T (Φ int ), w) with weight at most M . We show in Section 4 that χ w (T (Φ int )) ≤ M and, therefore, C = ∅.

Weights structure and coloring constraints.

We ensure that the weights of the nodes of T (Φ int ) belong to some particular set that can be partitioned into O(n) classes. Our construction ensures that, for any coloring in C and for any class of weights, there is at most one color with weight in this class (see Corollary 1).

This property is very useful because it implies that, in any such coloring, each color is well identified by its weight. More precisely, any color of a coloring in C is well identified as the unique one having weight in some interval. In particular, when building a coloring, we can affect a color c to a node v if the weight of v is not larger than the maximum weight that can take color c (and, of course, if v is not adjacent to any node with color c).

The second important property ensured by the construction is that there is a correspondence between C, i.e., the set of colorings of (T (Φ int ), w) with weight at most M , and Y , the set of the all integral assignments of the boolean variables (y i j ) i<n,j<m . More precisely, we will show that:

• from any integral assignment y ∈ Y , if y is valid for Φ int (i.e., Φ int (y) is true), then we can derive a coloring c y of T (Φ int ) with weight strictly less than M (Lemma 6);

• on the other hand, for any coloring c with weight at most M , there is an integral assignment

y c ∈ Y such that Φ(y c ) is true if and only if w(c) < M (Lemma 7).
This is the cornerstone of the proof of Proposition 3. Indeed, if Φ int is integrally satisfiable, then an integral assignment y ∈ Y that satisfies it (i.e., such that Φ int (y) is true) leads to a coloring c y with weight strictly less than M . On the other hand, if Φ int is not integrally satisfiable, for any coloring c with weight at most M , then y c does not satisfy Φ int and therefore w(c) ≥ M . This means that, in that case, no coloring of weight strictly smaller than M exists.

Inria

A bit further into the proof of Proposition 3.

To conclude this section, we give some hints of the proof of the previous two properties.

A tree per boolean variable.

The tree T (Φ int ) will be built from a family of subtrees (T (y j i )) i<n,j<m , each of which corresponds to a variable y j i (i < n, j < m) of the formula Φ int . Then, these subtrees will be combined in order to represent Φ int . More precisely, for any i < n, j < m, and for each occurrence of y j i in Φ int , there will be a copy of a rooted tree T j i as a subtree of T (Φ int ). We say that the root of such a subtree T j i is representing the variable y j i . Moreover, they will satisfy the following properties.

Let W 0 and W 1 be two particular colors that we will prove to be used in any coloring in C (recall that, we can univocally identify the colors by their weight).

• First, let y ∈ Y be any integral assignment of the boolean variables (y i j ) i<n,j<m of Φ int . For any node v representing a variable y j i = 1, let c v be arbitrarily chosen in {W 0 , W 1 } (possibly, two roots of two distinct (isomorphic) subtrees representing the same variable receive distinct colors). Then, there is a coloring c ∈ C such that, for any v representing a variable y j i = 0, c(v) = W 1 and, for any v representing a variable y j i = 1, c(v) = c v . This means that we can color T (Φ int ), without exceeding a weight of M , and such that, for any i < n, j < m such that y j i = 1, we can arbitrary choose the color of each node representing y j i to be either W 0 or W 1 . Moreover, for any i < n, j < m such that y j i = 0, the color of each node representing y j i is W 1 . • On the other hand, we will show that, for any coloring c ∈ C, there exists an integral assignment y ∈ Y of the boolean variables (y i j ) i<n,j<m of Φ such that, for any node v representing a variable y j i , then c(v) = W 1 if y j i = 0, and c(v) ∈ {W 0 , W 1 } otherwise (Lemma 3). Intuitively, it means that any coloring of T (Φ int ) with weight at most M has a particular form that will be used to show that the coloring exceeds some weight when the formula is not satisfiable.

Intuitively, above properties say that a coloring of T (Φ int ) with weight at most M can be seen as an integral assignment of the variables. For any node v representing a variable, having a choice to color v means that the corresponding variable is assigned to true, while if the color of v is forced (to be W 1 ), the corresponding variable is assigned to false.

Combining the subtrees.

We now briefly describe how T (Φ int ) is obtained by combining the subtrees corresponding to the occurrences of the variables in Φ int . First, recall that Φ int is in Conjunctive Normal Form with all variables appearing positively. That is, each clause Q with |Q| variables is of the form ∨ 1≤k≤|Q| u k where u k ∈ i<n,j<m {y i j } for any k ≤ |Q|. For any 1 < k ≤ |Q|, we recursively build a rooted subtree T (Q k ) from the rooted subtree T (Q k-1 ) and a copy of the rooted subtree representing u k .

The key point is that, we can choose a coloring c ∈ C with the color of the root of T (Q k ) being arbitrary W 0 or W 1 if and only if there is a coloring in C where either the root of T (Q k-1 ) or the root of the subtree representing u k can arbitrary have color W 0 or W 1 . Otherwise, the color of the root of T (Q k ) is forced to be W 1 . That is, our construction simulates an OR where a true variable corresponds to a choice of a color, while a false variable corresponds to no choice. By using this fact, the combination of these subtrees is done in such a way that we extend the properties of the subtrees representing the variables to the subtrees representing the clauses. Roughly, we ensure that, in any coloring c ∈ C corresponding to an assignment y ∈ Y , the root of the subtree representing the clause Q must have color W 1 if Q(y) = 0 and can be arbitrary chosen in {W 0 , W 1 } otherwise.

To conclude, we have one tree per clause, such that, to any coloring in C corresponds an integral assignment such that the color of the root of the clause-trees is forced to be W 1 if the corresponding clause is false and can be arbitrary chosen in {W 0 , W 1 } otherwise. Finally, we connect all the roots of the clause-trees to a same node r whose color, in any coloring c ∈ C, must be either W 1 or a color W 3 not used yet. Moreover, using W 3 will imply that w(c) ≥ M . Therefore, if at least one clause is false, W 3 is forced in r and w(c) ≥ M . Finally, if all clauses are true, r can be colored W 1 and w(c) < M .

It is interesting to note that to optimally color the trees in the forest is easy and that the difficulty of the coloring of the final tree will arise from their combination.

Proof of Proposition 3

This section is devoted to the proof of Proposition 3.

Proposition 3 Let m = 2 n . For any CNF Boolean formula Φ int of size O(nm) where all variables (y i j ) i≤n,j≤m appear positively, there exist a weighted tree (T (Φ int ), w) with size polynomial in O(nm) and M ∈ R such that Φ int is integrally satisfiable w.r.t. (y i j ) i,j if and only if χ w (T (Φ int )) < M .

Moreover, (T (Φ int ), w) and M are computable in time polynomial in O(nm).

In order to prove Proposition 3, let us introduce some notations. Let n ∈ N and let m = 2 n . Let Φ int be a Boolean formula with n × m variables {y j i | 0 ≤ i < n, 0 ≤ j < m} and L clauses, where L is polynomial in n. We assume that Φ int is in the Conjunctive Normal Form and that each variable appears positively. Moreover, we may assume that each variable appears at least once. That is, Φ int = ∧ ≤L Q and, for any ≤ L, Q is the disjunction of p ≥ 1 positive variables.

Let

∈ R * such that nm = o( 1 2 4n ). Let M = 4n+3 i=0 1 2 i + n(m -1) < 2.
Let w j i = 1/2 i + j , for any 0 ≤ i ≤ 4n + 3 and 0 ≤ j ≤ m. Let W = {w j i | 0 ≤ i ≤ 4n + 3, 0 ≤ j ≤ m} denote a set of weights. For any 0 ≤ k ≤ 3, let W k = w 0 4i+k = 1/2 4n+k . Finally, for any rooted tree T , let r(T ) denote its root. A rooted tree S is a (proper) subtree of a rooted tree T if there is an edge e of T such that S is the connected component of T \ {e} that does not contain r(T ). We now define various subtrees required to build (T (Φ int ), w).

Binomial trees.

We first define a particular family of binomial trees B j i , 0 ≤ i ≤ 4n + 2, 0 ≤ j ≤ m. They will be used in the construction of T (Φ int ). Their role is to force the color of most of the nodes in any coloring c of T (Φ int ) with w(c) ≤ M . Definition 2 For any 0 ≤ i ≤ 4n + 2, 0 ≤ j ≤ m, let B j i be the weighted rooted tree defined recursively as follows (see Figure 2):

Inria

• if i = 0, then B j 0 has a unique node with weight w j 0 ;

• otherwise, B j i has a root of weight w j i whose children are the roots of

B 0 0 , B 0 1 , • • • , B 0 i-1 .
Note that B j i has 2 i nodes.

w j 0 w j 1 B 0 0 B j 0 B j 1 w j i w 0 0 B 0 0 B 0 2 B 0 k B 0 i-1 B j i w 0 i-1 w 0 k w 0 2 w 0 1 B 0 1 Figure 2:
The construction of the binomial tree B i,j .

Lemma 1 Let 0 ≤ i ≤ 4n + 2, 0 ≤ j ≤ m.
Let (T, w) be any weighted tree having B j i as subtree. If there exists a coloring c of (T, w) with w(c) ≤ M , then, for any 0 ≤ k ≤ i: Proof. The proof is by induction on the index i. In case i = 0, we prove both statements of the lemma at once by observing that any two vertices of (T, w) of weight in {w j 0 | 0 ≤ j ≤ m} must belong to the same color class S 0 , otherwise we would conclude that w(c) ≥ 2, that would be a contradiction to the fact that w(c) ≤ M < 2. Now, observe that the set of nodes of B j i with weight in {w j k | 0 ≤ j ≤ m} is an independent set that dominates the nodes with smaller weights (i.e., in {w j k | k < k ≤ i, 0 ≤ j ≤ m}). By induction hypothesis, for any 0 ≤ k < i, the set of nodes of B j i with weight in {w j k | 0 ≤ j ≤ m} receive the same color S k of c and this color class is the unique with weight in {w j k | 0 ≤ j ≤ m}. Then, for any 0 ≤ k < i, the root of B j i cannot be colored S k , since it has a neighbor with weight w 0 k . Let S i be color of the root of B j i in c. We prove that the color S i cannot contain nodes with weight greater than w m-1 i and that c cannot have another color S i = S i with weight in {w j i | 0 ≤ j ≤ m}, because, otherwise the weight of c would be at least

1 2 i + i k=0 1 2 k = 2 > M in both cases.
Corollary 1 Let (T, w) be any weighted tree having B 0 4n+2 as subtree. Let c be any coloring of (T, w) such that w(c) ≤ M . Then, c = (S 0 , • • • , S k ) with k ≥ 4n + 2 and, for any 0 ≤ i ≤ 4n + 2, S i is the unique color with weight in {w j i | 0 ≤ j ≤ m}.

The trees we consider below will always satisfy the requirements of Corollary 1. Therefore, we are able to identify a color by its weight. In other words, in what follows, for any coloring c = (S 0 , • • • , S k ) of weight at most M and for any i ≤ 4n + 2, S i will be the unique color such that w(S i ) ∈ {w j i | 0 ≤ j ≤ m}. Recall that we defined, for any 0 ≤ k ≤ 3, W k = w 0 4i+k = 1/2 4n+k . By a slight abuse of notation, for any 0 ≤ k ≤ 3, we denote W k = S 4i+k be the unique color with weight W k .

Auxiliary trees and Variable-trees.

The family of auxiliary trees A j i , 0 ≤ i < 4n, 0 ≤ j ≤ m, will be used to introduce some choice when coloring T (Φ int ).

Definition 3 For any 0 ≤ i < 4n, 0 ≤ j ≤ m, let A j i be the weighted rooted tree defined as follows (see Figure 3(a)): 1. let u be its root with weight w(u) = W 0 , and connect it to a node v (its subroot) with weight w(v) = w j i ; 2. v is made adjacent to the root of a copy of B 0 , for any 0 ≤ < i -1;

3. u is made adjacent to the root of a copy of B 0 , for any 0 ≤ < 4n, = i -1.

Note that A j i consists of 2 4n nodes.

Figure 3: (a) (left) Auxiliary tree j i . It is made from B 0 0 , • • • , B 0 i-2 , B 0 i , • • • , B 0 4n-1 and a subtree of B j i (i.e., B j i \ B 0 i-1 ). (b) (right)
The variable tree T (y j i ).

Lemma 2 Let 0 ≤ i < 4n and 0 ≤ j ≤ m. Let (T, w) be any weighted tree having B 0 4n+2 and A j i as subtrees. Let u and v be the root and the sub-root of A j i , respectively. If there exists a coloring c of (T, w) with weight w(c) ≤ M , then:

• either v is colored S i-1 and u must be colored with the color W 0 ;

• or v is colored S i (and therefore, w(S i ) ≥ w j i ) and u can be colored with S i-1 .

Inria

Proof. Recall that, by Corollary 1, we can identify the colors of c and their weights. By Lemma 1, the root of each subtree B 0 k , 0 ≤ k < 4n, must be colored with S k and then the sub-root v can be colored only with color S i-1 or S i . Note that, if v is colored with color S p for some p > i, then w(S p ) ≥ w j i , contradicting Corollary 1. In the first case, u is adjacent to a node with color S k , for any k < 4n. Therefore, u must be colored with color S 4n = W 0 . Otherwise, u may be colored with color S i-1 .

Intuitively, the previous lemma states that, either we "pay" j in the weight of color S i , or v must be colored with the color W 0 . We now define the variable-trees T (y j i ) using the auxiliary trees.

Definition 4 For any 0 ≤ i < n, 0 ≤ j < m, let T (y j i ) be the weighted rooted tree, representing the variable y j i , defined as follows (see Figure 3(b)):

• let u be its root with weight w(u) = W 1 and connected to the root of a copy of B 0 , for any 0 ≤ < 4n;

• take one copy of A j 4i+1 , A j+1 4i+1 , A m-j 4i+3 and A m-1-j 4i+3 and:

connect r(A j 4i+1 ) to r(A m-j 4i+3 ), and r(A j+1 4i+1 ) to r(A m-1-j 4i+3

);

connect u with r(A j 4i+1 ) and r(A m-j-1

4i+3

).

Note that T (y j i ) consists of O(2 4n ) nodes (i.e. polynomial in O(nm)).

Lemma 3 Let (T, w) be any weighted tree having B 0 4n+2 as subtree and containing T (y j i ) as subtree, for all 0 ≤ i < n and 0 ≤ j < m. Let c be a coloring of T with weight w(c) ≤ M .

Then, there are (j 0 , • • • , j n-1 ) ∈ {0, • • • , m -1} n such that each root u of each subtree T (y j i ), for any 0 ≤ i < n and 0 ≤ j < m, satisfies:

• if j = j i , then the color of u in c must be W 1 ;

• otherwise, none of the two neighbors of u is colored W 0 or W 1 .

Proof. Since T contains B 0 4n+2 , by Corollary 1, a coloring c = (S 0 , • • • , S k ) of weight w(c) ≤ M is such that k ≥ 4n + 2, and, for any 0 ≤ i ≤ 4n + 2, S i is the unique color such that w(S i ) ∈ {w j k | 0 ≤ j ≤ m}. In particular, w(c) ≥ 4n+2 i=0 1/2 i = M -n(m -1) . For any 0 ≤ i < n, let j i ≤ m be such that w(S 4i+1 ) = w ji 4i+1 . First, let us assume that j i < m. In particular, this means that every sub-root of a subtree A r 4i+1 , for each j i < r ≤ m, is colored S 4i (recall that its color is either S 4i or S 4i+1 , by Lemma 2). Consequently, any root of a subtree A r 4i+1 , for each j i < r ≤ m, must be colored W 0 . Therefore, by the construction of the variable-trees, any root of a subtree A m-r 4i+3 , for each j i < r ≤ m, cannot be colored W 0 because it is adjacent to a root of a subtree A r 4i+1 . Thus, by Lemma 2, it must be colored S 4i+2 and the color of each sub-root of A m-r 4i+3 must be S 4i+3 . Consequently, w(S 4i+3 ) ≥ w m-(ji+1) 4i+3

. Hence, for any 0 ≤ i < n, if j i < m, we conclude that

w(S 4i+3 ) + w(S 4i+1 ) ≥ w ji 4i+1 + w m-(ji+1) 4i+3
= (m -1) + 1/2 4i+1 + 1/2 4i+3 . On the other hand, if j i = m, it follows directly that w(S 4i+3 ) + w(S 4i+1 ) ≥ m + 1/2 4i+1 + 1/2 4i+3 .

Since w(c) ≤ M , it implies that, for any 0 ≤ i < n, j i < m and w(S 4i+3 ) = w m-ji-1 4i+3 and, for any 0 ≤ 2k < 4n, w(S 2k ) = w 0 2k . Consequently, by a similar argument, the roots of all subtrees A m-j 4i+3 , for each 0 ≤ j ≤ j i , must be colored W 0 and, then, the roots of all subtrees A r 4i+1 , for each 0 ≤ j ≤ j i , must be colored S 4i .

Let 0 ≤ i < n and 0 ≤ j < m. Consider a subtree T (y j i ) of T . If j = j i , then (exactly) one of the roots of A j 4i+1 and A m-1-j 4i+3 must be colored W 0 . In that case, the color of the root u of T (y j i ) must be W 1 . Indeed, u is adjacent to the root of B 0 k , 0 ≤ k ≤ 4n, and therefore it cannot be colored S k . Moreover, if u is colored W 2 , then we have a contradiction as w(c) > M , because w(u) = W 1 . On the other hand, if j = j i , none of the roots of A j 4i+1 and A m-1-j 4i+3 are colored W 0 (for instance, if the root of A j 4i+1 is colored W 0 , then the copy of A m-1-j 4i+3 that is adjacent to it would imply w(S 4i+3 ) ≥ w m-ji-1 4i+3 , a contradiction). Finally, none of the roots of A j 4i+1 and A m-1-j 4i+3 can be colored W 1 because their weight is W 0 (it would imply w(c) > M ).

Clause-trees and definition of T (Φ int ).

Definition 5 Let Q = ∨ 1≤k≤p u k be any clause of Φ int (recall that, for any 1 ≤ k ≤ p , u k ∈ {y j i | 0 ≤ i < n, 0 ≤ j < m} and that ≤ L). For any 1 ≤ k ≤ p , let T (Q k ) be the rooted weighted tree defined recursively as follows (see Figure 4(a)):

1. T (Q 1 ) = T (u 1 ); 2. for any k > 1, start with one copy of T (Q k-1 ) with root a and one copy of T (u k ) with root b.

Let c, d be two nodes with weight W 1 and e, f be two nodes with weight W 2 . For each node v ∈ {a, b, c, d}, and for any 0 ≤ i < 4n, add one copy of B 0 i and make its root adjacent to v. Add one copy of B 0 4n+1 and make its root adjacent to e. Finally, we add the edges {{a, f }, {b, c}, {c, f }, {d, e}, {e, f }} and d is chosen as the root.

Let us note T (Q ) = T (Q p ) the clause-tree corresponding to Q and that consists of O(p 2 4n ) nodes (i.e. polynomial in O(nm)). Lemma 4 Let (T, w) be any weighted tree having B 0 4n+2 as subtree and containing a subtree T (Q k ) as a subtree ( ≤ L, k ≤ p ). Let c be any coloring of T with weight w(c) ≤ M . If a and b are colored W 1 , then the color of the root d of T (Q k ) must be W 1 ;

Inria

Proof. We prove it by induction on the number of variables k of Q k . Observe that in case k = 1, then T (Q k ) is a variable-tree and the lemma trivially holds as the vertex b does not exist, thus the first statement is trivially satisfied, and, by Lemma 3, the color of its root must be either W 0 or W 1 . Now, consider that a and b are roots of a variable-tree and of a clause-tree on k -1 variables T (Q k-1 ), respectively. By Lemma 3 and by the inductive hypothesis, the colors of a and b are either W 0 or W 1 .

In case c(a) = c(b) = W 1 , by the hypothesis w(c) ≤ M , by Lemma 1 and Corollary 1, we conclude that c is colored W 0 , f is colored W 2 , e is colored W 0 and d is forced to be colored W 1 . This proves the first statement of the lemma. Finally, by the construction of T (Q k ), by Lemma 1 and Corollary 1, the root d may be colored either W 0 or W 1 , since w(c) ≤ M . Definition 6 Let T (Φ int ) be the weighted rooted tree obtained as follows (see Figure 4(b)). Let r be the root with weight W 3 . For any 1 ≤ ≤ L, the root of one copy of T (Q ) is made adjacent to r. For any 0 ≤ i ≤ 4n + 2, i = 4n + 1, r is made adjacent to the root of one copy of B 0 i .

Lemma 5 T (Φ int ) has size polynomial in m = 2 n .

Proof. Observe that each clause-tree T (Q ) has size O(p 2 4n ) (see Definition 5), where p is polynomial in m (since p is at most the number nm of variables). Moreover, the number L of clauses is polynomial in m by the definition of Φ int .

Lemma 6 If Φ int is integrally satisfiable, then χ w (T (Φ int )) < M .

Proof. Let (y j i ) i<n,j<m be a valid integral assignment for Φ int . For any 0 ≤ i < n, let j i be the (unique) index such that y ji i is true. We construct a coloring c of (T (Φ int ), w) such that w(c) < M .

By Lemma 1, in any coloring c of T (Φ int ) such that w(c) ≤ M , the colors of all nodes of the binomial subtrees of T (Φ int ) are forced. Consequently, we only need to decide the colors of the following nodes: the roots and sub-roots of any copy of A j i , the roots of the trees T (y j i ), and the nodes added to connect the variables-trees into clause-trees (the nodes a, b, c, d, e, f in Figure 4(a)), for any 0 ≤ i < n and 0 ≤ j < m.

We first set the weight of color S i for any 0 ≤ i < 4n. In particular, for any 0 ≤ i < n, the color S 4i+1 must have weight w ji 4i+1 . As we observed in the proof of Lemma 3, this choice fixes the colors of all roots and sub-roots of all the A j i trees, i.e. all the nodes in the variable trees, except to the roots of the variable-trees T (y ji i ), by Lemma 3. More precisely, for any 0 ≤ i < n and 0 ≤ j < m, let us consider a subtree T (y j i ). Let j ∈ {j, j + 1}. The sub-root of A j 4i+1 receives color S 4i+1 if j ≤ j i and receives color S 4i otherwise. The root of A j 4i+1 receives color S 4i if j ≤ j i and receives color W 0 otherwise. The sub-root of A m-j 4i+3 receives color S 4i+3 if j > j i and receives color S 4i+2 otherwise. The root of A m-j 4i+3 receives color S 4i+2 if j > j i and receives color W 0 otherwise. Finally, if j = j i , the root of T (y j i ) is colored W 1 . On the other hand, if j = j i , none of the neighbors of the root of T (y j i ) is colored W 0 , therefore, we can color it either W 0 or W 1 . Now, let Q = ∨ 1≤k≤p u k be any clause of Φ int . We will show that we can extend the previous coloring such that the root of the clause-tree T (Q ) is colored W 0 and the weight of the coloring is < M . This is by induction on p . Indeed, if p = 1, then Q consists of a unique variable and this variable must be assigned to true (since the formula is true). Hence, Q = y ji i for some 0 ≤ i < n. That is T (Q ) is a subtree T (y ji i ). By paragraph above, we can color the root of it with W 0 . Now, assume that the result is correct for any clause of length p ≥ 1 and let p = p + 1. Thus, Q = u p+1 ∨ (∨ 1≤k≤p u k ). Recall that T (Q ) is built from a variable subtree T (u p+1 ) and a clause-subtree T (Q p ). There are two cases to consider: either our assignment satisfies ∨ 1≤k≤p u k or not. In the first case, the root of the clause-tree T (Q p ) (node b in Figure 4(a)) is colored W 0 by induction. Moreover, by above paragraphs, the root of T (u p+1 ) (node a in Figure 4(a)) can be colored W 1 . It is then easy to extend this coloring such that the root of T (Q ) is colored W 0 : in Figure 4(a), node c is colored W 1 , node e is colored W 2 and nodes f and d are colored W 0 . If our assignment does not satisfy ∨ 1≤k≤p u k , then it must satisfy u p+1 . That is, u p+1 = y ji i for some 0 ≤ i < n. By a similar induction, we prove that the root of T (Q p ) can be colored W 1 . Moreover, by above paragraphs, the root of T (u p+1 ) = T (y ji i ) can be colored W 0 . It is then easy to extend this coloring such that the root of T (Q ) is colored W 0 : in Figure 4(a), node f is colored W 1 , node e is colored W 2 and nodes c and d are colored W 0 .

Thus, we color the roots of all the clause-trees with color W 0 and the root of T (Φ int ) with the color W 1 .

Consequently, the weight of this coloring c is w(c) = 4n+2 i=0

1 2 i + n(m -1) < M .
Lemma 7 If Φ int is integrally satisfiable, then χ w (T (Φ int )) ≥ M .

Proof. Φ int is not integrally satisfiable Let c be a coloring of T (Φ int ) with weight at most M . By Lemma 3, there are integers (j 0 , • • • , j n-1 ) such that the color of the root of any subtree T (v j i ) is forced to be W 1 , if j = j i . Let Y = (y j i ) i<n,j<m be the corresponding integral assignment. In other words, for any variable y j i (0 ≤ i < n, 0 ≤ j < m), y j i = 0 if j = j i . Since Φ int is not integrally satisfiable, there is a clause Q that is not satisfied by this assignment. Let us consider the clause-subtree T (Q). It has been built from variable-trees corresponding to the variables constituting the clause Q. Because all these variables are assigned to false, the roots of these variable-trees are all colored with W 1 , by Lemma 3.

By induction on the length of Q and by Lemma 4, the color of the root of T (Q ) must be W 1 . Thus, the root of T (Φ int ) can just be colored W 3 . Consequently, the coloring c has weight w(c) ≥

Figure 1 :

 1 Figure 1: The (unique) optimal weighted coloring of the path P 4 uses strictly more than χ(P 4 ) colors.

3. 1 . 1

 11 Weighted Coloring vs. SAT.

1 .

 1 the vertices of B j i with weight in {w j k | 0 ≤ j ≤ m} receive the same color S k of c; and 2. there exists a unique color class S k in c of weight in {w j k | 0 ≤ j ≤ m}.

Figure 4 :

 4 Figure 4: (a) (left) The clause tree T (Q k ). (b) (right) The final tree T (Φ int ).

4n+3 i=0 1 2

 1 i + n(m -1) = M .Proposition 3 follows directly from Lemmas 5, 6 and 7.

RR n°8249

route des Lucioles -BP 93 06902 Sophia Antipolis Cedex Publisher Inria Domaine de Voluceau -Rocquencourt BP 105 -78153 Le Chesnay Cedex inria.fr ISSN 0249-6399

* This work was partly funded by the ANR projects AGAPE and GRATEL, and promoted by the IN-RIA/FUNCAP project ALERTE and the INRIA associate-team AlDyNet. Due to lack of space, most of the proofs have been sketched. The full