Connected greedy coloring H-free graphs

Connected greedy coloring -free graphs

Esdras Mota Instituto Federal de Educação, Ciência e Tecnologia do Ceará (UFC) - Quixadá, CE, Brazil
   Ana Silva Departamento de Matemática, Universidade Federal do Ceará (UFC) - Fortaleza, CE, Brazil
anasilva@mat.ufc.brPartially supported by CNPq/Brazil, Project Universal 401519/2016-3, and FUNCAP/CNPq/Brazil, Project PRONEM PNE-0112-00061.01.00/16.
   Leonardo Rochafootnotemark: Universidade Estadual do Ceará (UECE) - Fortaleza, CE, Brazil

A connected ordering of is an ordering of the vertices such that has at least one neighbour in {} for every . A connected greedy coloring (CGC for short) is a coloring obtained by applying the greedy algorithm to a connected ordering. This has been first introduced in 1989 by Hertz and de Werra, but still very little is known about this problem. An interesting aspect is that, contrary to the traditional greedy coloring, it is not always true that a graph has a connected ordering that produces an optimal coloring; this motivates the definition of the connected chromatic number of , which is the smallest value such that there exists a CGC of with colors. An even more interesting fact is that for every graph (Benevides et. al. 2014).

In this paper, in the light of the dichotomy for the coloring problem restricted to -free graphs given by Král in 2001, we are interested in investigating the problems of, given an -free graph : (1). deciding whether ; and (2). given also a positive integer , deciding whether . We have proved that Problem (2) has the same dichotomy as the coloring problem (i.e., it is polynomial when is an induced subgraph of or of , and it is -complete otherwise). As for Problem (1), we have proved that always hold when is an induced subgraph of or of , and that it is -complete to decide whether when is not a linear forest or contains an induced . We mention that some of the results actually involve fixed and fixed .

Vertex coloring, Greedy coloring, Connected greedy coloring, -free graphs, computational complexity.

1 Introduction

A -coloring (or simply a coloring) of a graph is a surjective function . We refer to the values assigned to vertices as their colors. A proper coloring is such that for any edge . A proper -coloring can also be given as a partition of the vertex set of into disjoint stable sets , . In this case, is the color class, formed by the vertices such that . The graph is -colorable if it admits a proper -coloring. In what follows, by a coloring we always mean a proper coloring.

Graph colorings are a natural model for problems in which a set of objects is to be partitioned according to some prescribed rules. Usually, the rules are related to conflicts between the objects to be partitioned. This model is remarkably useful for scheduling problems [Werra.85], such as frequency assignment [Gamst.86], register allocation [Chow.Hennessy.84, Chow.Hennessy.90], and the finite element method [Saad.96].

While it is easy to find a coloring when no bound is imposed on the number of color classes, for most of these applications the challenge consists in finding one that minimizes the number of colors. The chromatic number of a graph is the minimum number of colors in a coloring of ; it is denoted by and we say that is -chromatic if . An optimal coloring is any coloring with colors. To decide if a given graph is -colorable is an -complete problem, even if is not part of the input [Hol81]. The chromatic number is even hard to approximate: for all , there is no algorithm that approximates the chromatic number within a factor of unless  [Has96, Zuc07].

Because of the hardness results and the existing practical applications, the study of coloring heuristics is motivated. In most coloring heuristics, such as the well studied DSATUR [Bre79], the greedy algorithm is present. The greedy algorithm works on an input graph and an ordering of its vertices. For each from up to , we color with the smallest color such that no vertex in is already colored . We call a coloring obtained by the greedy algorithm a greedy coloring.

A nice property is that there always exists an ordering that produces an optimal coloring of . To see this, let be a -coloring of graph . The order obtained by ordering every vertex of color 1 first, then the vertices of color 2, and so on, clearly produces a coloring that uses at most colors. Hence, minimizing the number of colors used by the greedy algorithm equals to finding the chromatic number of . This is why the parameter studied is related to the worst-case scenario, i.e., the maximum value for which the greedy algorithm produces a coloring with colors. This is called the Grundy number and is denoted by . It is a very well studied parameter, but we refrain from citing any work on it here because we will focus on a special type of greedy colorings.

Connected greedy colorings. In this paper we consider a variant of the greedy algorithm called the connected greedy algorithm. A connected ordering of is an ordering of the vertices with the property that has at least one neighbour in {} for every . The connected greedy algorithm works similar as the greedy algorithm, but only takes as input connected orderings. A connected greedy coloring is one obtained by the connected greedy algorithm. Up to our knowledge, this has been first introduced in [hertz1989connected], where the authors call the connected greedy algorithm SCORE (Sequential coloring based on a Connected ORdEr).

The concept of Connected Grundy Number is naturally defined as being the maximum for which has a connected greedy coloring. But observe that, contrary to the traditional greedy algorithm, it is not obvious that there always exists a connected ordering that produces an optimal coloring. Indeed, in [babel1994hard], the authors present a graph on 18 vertices for which this does not hold. They believed that it was the smallest such graph, but up to our knowledge a formal proof has not been given yet. Also, we mention that there is an infinite number of such graphs, as shown in [BCD+14]. Therefore, it makes sense to define the minimization parameter related to connected greedy colorings. The connected chromatic number of a graph is defined as the minimum integer for which admits a connected greedy -coloring; it is denoted by . Interestingly enough, this cannot be larger than the chromatic number plus one [BCD+14]:


Given graph parameters and , a graph is called -perfect if for every induced subgraph of . In [ChSe79], the authors prove that the -perfect graphs are exactly the cographs. Following this result, concerning connected greedy colorings, in [hertz1989connected] the authors characterize a subclass of -perfect graphs (they make other constraints on the order), while in [KT.18] the authors characterize the claw-free -perfect graphs. We mention that the complexity of recognizing -perfect, -perfect, and -perfect are all open.

Concerning complexity results, in [BCD+14] it is proved that deciding if is -hard, while in [BFKS.15] the authors prove that it is -complete to decide whether has a connected greedy coloring with colors, for every fixed . The latter result has been generalized in this article, as will be seeing forward.

Here, we are interested about whether there exists a hard dichotomy for the -free graphs, as the one below for the traditional coloring problem, proved by Král et. al. in 2001 (a graph is -free if it does not contain a copy of as induced subgrah). In what follows, denotes the graph obtained from the union of and . Also, given a graph , we denote by the class of -free graphs.

Theorem 1.1 ([kral2001complexity])

Let be fixed. Given and a positive integer , deciding whether can be done in polynomial time if is an induced subgraph of or , and is an -complete problem otherwise.

Even before this result was presented, it was already known that deciding whether is -complete for line graphs for every fixed  [Hol81]. Because line graphs are claw-free, it follows that deciding is -complete for -free graphs, when contains a claw. Also, in 2007 Kaminski and Lozin [KL.07] proved that for every fixed and , given a graph with girth at least , deciding whether is -complete. This gives us that deciding for is -complete for every fixed and every fixed . Therefore, if the problem is polynomial in , then must be a linear forest (forest of paths). This is why much work has been done on the problem of deciding, for fixed values of , whether for graphs with no certain induced paths. It has been proved that it is polynomial-time solvable for -free graphs and every positive integer  [HKLSS.10], and when for -free graphs [RS.04] and, more recently, -free graphs [B.etal.17]. Also, it is -complete for -free graphs and , and for -free graphs and  [huang2016improved]. Therefore, the only open cases are: 4-coloring -free graphs, and 3-coloring -free graphs, for . These results are summarized in Table 1.


3 4 5
6 ?
8 ?
Table 1: The complexity of deciding for when and are fixed.

Now, coming back to our problem, observe that asking whether is not the same as asking whether for a given . Indeed, the former question is not in , while the latter is. Below, we formally define these problems.


myproblem dccclxxxvii

      Input: A graph .
      Question: ?

myproblem dccclxxxvii

      Input: A graph and an integer .
      Question: ?

Concercing Problem CGC-Decision, part of our results follow directly from previous ones. This is because of the following easy proposition and the fact that some of the classes are closed under the addition of an universal vertex. To see that the proposition holds, just observe that , where is obtained from by adding a universal vertex.

Proposition 1

Let be a graph class and suppose that deciding is -complete if for fixed . If is closed under the addition of a universal vertex, then deciding is -complete on

Observe however that, when is the cycle on 3 vertices or is a claw, then the class is not closed under the addition of universal vertices. Without getting much ahead of ourselves, we mention that we actually investigate the complexity of deciding for fixed , when is a -chromatic -free graph. This gives us hardness results for both problems. However, because we were not able to obtain such hardness results for every possible configuration of , we do not have a dichotomy for the Problem CGC-Equality, while Problem CGC-Decision have the same dichotomy as in Theorem 1.1.

Theorem 1.2

Let be a fixed graph, and be a positive integer. If is an induced subgraph of or , then Problem CGC-Decision can be solved in polynomial time. Otherwise, the problem is -complete. Furthermore, if is considered to be fixed and is at least 7, then it remains -complete when is not a linear forest or contains a as induced subgraph.

Theorem 1.3

Let be a fixed graph and . If is not a linear forest or contains a as induced subgraph, then CGC-Equality is -hard. Also, if is an induced subgraph of or of , then .

Observe that the polynomial case of CGC-Equality in the theorem above consists of a very simple algorithm: it always says “yes” if is -free, for an induced subgraph of or . We ask whether this is always the case when is a path:

Question 1

Does there exist such that for every , while deciding whether is -hard for every ?

Also, as already mentioned, we actually prove that deciding is -hard even if is a -chromatic graph, for some fixed values of . The only proof where we did not succeed in fixing was for the -free graphs. Therefore, we ask:

Question 2

For fixed , given a -free -chromatic graph , can one decide in polynomial time whether ?

Now, concerning only -free graphs, from Table 1 and Proposition 1 we get the situation depicted in Table 2. Position of this table tells us the complexity of deciding for . The -completeness results propagate along the rows because of the proposition above, and along the columns because . The row related to is entirely polynomial because of the result in [HKLSS.10] previously mentioned and by Theorem 1.2. The question marks are open problems and they propagate along the rows in a column.


3 4 5
6 ? ? ?
7 ? ?
8 ? ?
Table 2: The complexity of deciding for when and are fixed.

We mention that to prove Theorems 1.2 and 1.3, we actually investigate the edge version of the problems. Since every line graph is claw-free, we get that the problem is -hard for claw-free graphs as well, which means that if is a non-linear forest, then the problem is -hard on -free graphs. Let denote the connected chromatic index of (which equals the connected chromatic number of , the line graph of ). Observe that, by Vizing’s Theorem and Equation 1, we get , for every graph . However, we were not able to find a graph with ; note that such a graph would necessarily be a Class 2 graph (a graph is Class 2 if ). Hence, we pose the following question.

Question 3

Does there exist a Class 2 graph such that ?

Another aspect that relates to our investigation is the notion of hard-to-color graphs. In [babel1994hard], a connected graph is called globally hard-to-color if, for every and every , if is greedily colored using a connected order starting at with color , then the produced coloring uses more than colors. To prove the hardness results for -free graphs, we construct a globally hard-to-color -free graph. This leads us to the following question (by our results, we know that the answer is in ):

Question 4

What is the smallest such that there exists a globally hard-to-color -free graph?

Finally, although not directly related to the studied problem, we would like to expose another interesting and non-trivial aspect of greedy colorings in order to pose one last question. In [ChSe79], the authors prove that for every integer , there exists a greedy coloring of with colors. We ask whether the same holds for connected greedy colorings.

Question 5

Let be any graph. Does there always exist a connected greedy coloring with colors, for every ?

Many other questions can be posed on these colorings since, up to our knowledge, very little is known about both parameters, with only the aforementioned articles having been published on the subject.

In Section 2, we briefly discuss the proof of Theorems 1.2 and 1.3 as a whole. In Sections 3 through 5, we prove the -hardness results, and in Section 6, we prove that when is either a -free graph or a -free graph.

2 Outline of the proof

First, observe that, for , the graph classes and are closed under the addition of a universal vertex. Therefore, by Proposition 1 and Theorem 1.1, we get that CGC-Decision is -complete on and on , for and . In fact, we get stronger results since these problems are -complete even for fixed , as we mentioned before. However, these results do not imply that CGC-Equality is also -hard on these graph classes. Here, we actually prove the following results, which imply -hardness of both CGC-Equality and CGC-Decision.

Lemma 1

For every and , deciding if is -complete even when restricted to -chromatic graphs in .

We mention that the hardness for follows from a result in [BCD+14].

Lemma 2

For every , deciding if is -complete for -free -edge-chromatic graphs.

These lemmas finish the proof of Theorem 1.2. As for Theorem 1.3, it remains to study the case where is a linear forest, which is done in the following lemmas.

Lemma 3

Deciding if is -hard for -free graphs, for every .

Lemma 4

If is an induced subgraph of or of , then , for every -free graph .

Before, we begin, we need one last definition. Given a vertex , an integer and a coloring of , we say that is a -connected greedy coloring of (or -CGC for short) if there exists a connected order of , , such that starts with and is obtained by coloring with and applying the greedy algorithm on . The similar is used for edge-coloring. Also, from now on we call a connected greedy coloring and a connected greedy edge-coloring by CGC and ECGC, for short .

3 -free graphs

Here, we prove Lemma 1. It is known that deciding whether is -complete for planar graphs [GJS76]. Observe that this and the Four Color Theorem imply that the following problem is also -complete for every fixed . It suffices to add universal vertices to a planar graph to obtain such that if and only if .


myproblem dccclxxxvii

      Input: A graph with a universal vertex such that .
      Question: ?

Given an instance of the problem above, we construct a -chromatic -free graph such that if and only if . Lemma 1 follows because Problem -COL -COLORABLE is -complete for every . We first construct a gadget that will admit cycles of undesired length, and afterwards we replace some of the edges in order to get rid of such cycles. Start with three disjoint cliques each of size , and let be a vertex of . Obtain by adding vertices and making complete to , complete to , complete to , and complete to . See Figure 1 for the construction of .

Figure 1: Gadget .

Now, given a -colorable graph that contains a dominant vertex, denote by the graph obtained from by appending a copy of on each vertex of , identifying on vertex of . We first prove that if and only if , and then we show how to get rid of the undesired cycles. This is actually the proof presented in [BCD+14]. Note that, because deciding for a -free graph is -complete for every fixed and  [KL.07] and by previously mentioned aspects, this gives us that CGC-Decision is -complete even when restricted to -free -chromatic graphs, for every ( or ) and . For the first part of the proof, it is essential to understand the following properties of graph .

Lemma 5

Let be the graph obtained as above, where is a positive integer, .

  1. ;

  2. In every -coloring of , vertices receive the same color;

  3. For every and every , we get that vertices receive color at most in every -CGC of with colors.


The first and second properties can be easily verified: it suffices to see that the colors used in cannot be used in any of the cliques . For the last property, consider any connected order starting with and suppose, without loss of generality, that . Then, no matter which one between and gets colored first, we get that it will have at most colored neighbors and, therefore, cannot have color bigger than . The property then follows from Property 2.

Now, observe that if , then Property 3 trivially implies that . On the other hand, if , because has an universal vertex, we get that . A CGC of with colors can be easily constructed from a CGC of with colors. This proves that if and only if , as we wanted to show.

Now, we construct gadgets that will replace the edges of so as to ensure that the obtained graph has no cycles of length , for and . In fact, we need a different gadget for each case because, when avoiding cycles of length 3, we end up creating cycles of length 5, and vice-versa. First, we show the gadget necessary for the case .

Let be obtained as follows. Start with a , , a clique of size , and a clique of size . Let every vertex in be complete to , and let be complete to . Finally, add vertex and make it complete to . Figure 2 depicts .

Figure 2: Gadget to replace the edges on when ; denoted by .

Now, let be obtained from by replacing every edge with a copy of , except the edges of incident to the copies of in the gadgets of type . Observe that has no induced cycles of length 5; also, because the distance between and in is 4, we get that also does not have cycles of length 5. Now, we prove that if and only if , thus finishing the proof of the case . For this, we need the following properties to hold.

Lemma 6

Let be obtained as above, where is a positive integer, .

  1. and in every -coloring of , vertices and receive distinct colors;

  2. For every , , there exists a -CGC of in which is colored with , and a -CGC in which is colored with .


To see that just observe that and that a -coloring of can be obtained by giving colors to , color 2 to , color 1 to , and colors to . Now, let be a -coloring of . Because and are complete to of size , they receive the same color; similarly, and also receive the same color, and since is adjacent to , Property (i) follows. Now, given , , we construct the desired -CGC as follows: color with and enough vertices of so that colors through appear in ; then, color with . If , color with , with , and finish coloring . Otherwise, color with , some vertices of with , with , and finish coloring . It is easy to see that this can be extended to as desired, and also that we could have started in and made our way to (this is because vertices and are symmetric with relation to ).

Observe that Property (ii) makes it possible to construct a CGC of , given a CGC of ; hence, if , then . Also, note that Property (i) and the fact that the edges incidents to the copies of vertices were not replaced ensures that Properties (1)-(3) still hold on the copies of . Therefore, if , then Property (3) ensures us that , and the previous argument gives us that .

Now, we present the gadget needed for the case . We prove that Lemma 7 also holds for the consutrcted gadget, thus finishing our proof since the same arguments can be applied. For this, we introduce an operation on graphs. Let be any graph. The double myscielskian of is the graph obtained from as follows (observe Figure 3 to see the operation applied to the ): add two copies and of , and denote the copy of in by ; for every edge , add edges and , for and ; finally, add two adjacent vertices and and make complete to , for and . It is well known that the Mycieslki of a triangle-free -chromatic graph produces a triangle-free -chromatic graph [M55]. Also, if , an -coloring of can be constructed from an optimal coloring of by coloring with and with , ; hence . Now, let be obtained by applying times the double mycielskian operation, starting with the . By what was said before, we get that and that is triangle-free. Also, since and are not adjacent, the graph constructed as before is also triangle-free. It remains to prove Properties (i) and (ii).

Figure 3: Edge gadget for -free graphs. In the figure, only one application of the double Mycielski is made, i.e., it depicts the graph .
Lemma 7

Let be obtained as above, where is a positive integer, .

  1. and in every -coloring of , vertices and receive distinct colors;

  2. For every , , there exists a -CGC of in which is colored with , and a -CGC in which is colored with .


Let be the additional vertices added at the last application of the double Myscielski operation. To see that , recall that the Mycielski operation increases the chromatic number by one. Hence, the double Mycielski operation increases by at least one; the fact follows because a -coloring can be obtained from a -coloring of by giving a new color to and using colors 1 and 2 in . Now, we prove the second part of Property (i) by induction on . Note that it trivially holds for the initial . So, suppose by contradiction that is a -coloring of such that . Because , we can suppose that . Note that, by switching the color of every such that to , we obtain a -coloring of : the color of certainly does not appear in , and we only change the colors of vertices contained in a stable set. But since , this coloring is a -coloring of in which and receive the same color, contradicting the induction hypothesis.

Finally, consider , ; we prove Property (ii) also by induction on . Observe that, because and are symmetric in , we only need to prove the existence of a -CGC in which is colored with . If , then and the property trivially holds. Now, suppose it holds for and consider the following cases:

  • : let be a -CGC of in which . Then, let be obtained from by coloring with , for every , with , with 1 and with , for every (observe that this is at most );

  • : if , let and be a -CGC in which is colored with ; and if , let and be a -CGC in which is colored with . Also, let be any neighbor of in . Give color to , color to , color to , and color to . Let be the order that produces , and denote by the partial coloring of . Now, for each , if and , then let ; otherwise, let . Because for every , we know that if and , then color 1 does not appear in and color 1 is allowed for . Otherwise, because for each the neighbor of in is now colored with (including if ), we just need to prove that also has neighbors of colors 1 and 2 in in order to prove that is greedily colored. Let . If , then and has a neighbor in of color 2; otherwise, and has a neighbor of color 1 in . To finish coloring , give color , for every (observe that this is at most ), and color 3 to . Because , we know that as desired.

  • : a similar argument can be applied by getting a -CGC of in which is colored with , when , or in which is colored with 1, otherwise.

4 Line graphs

Here we prove Lemma 2 by making a reduction from the problem of deciding whether is 3-edge-colorable when is a triangle-free cubic graph, which is known to be -complete [Hol81]. The idea follows the one applied for -free graphs: for each , given an instance of the problem above, we append on each vertex some copies of a gadget that ensures that the obtained graph is such that if and only if . For this, we first construct what we call edge gadgets.

For each , let be obtained from a complete bipartite graph with parts and by adding , making complete to , complete to and adding edges and . Graph is depicted in Figure 4.

Figure 4: Edge-gadget in the reduction for line graphs; is depicted.

Now, we construct the gadget that will be appended on the vertices of . Observe Figure 5 to follow the construction. Consider copies of the edge gadget and denote them by and , . Let be obtained by identifying vertices into vertex , vertices into vertex , vertices into vertex , and finally adding a new vertex adjacent to .

Figure 5: Gadget in the reduction for line graphs.
Lemma 8

Let , and be an edge-gadget obtained as above. Then the following hold:

  1. In every -edge coloring of , edges and receive the same color; and

  2. For every , there exists a -ECGC of .

Furthermore, let be constructed as before. Then, is triangle-free -edge-chromatic graph and the following holds.

  1. has a -CGC with colors if and only if .


Because is a bipartite graph, it has no triangles and, by König’s line coloring Theorem, we know that . In fact, observe that the only perfect matching containing must also contain , which gives us Property (1) below. Property (2) is also easy to be verified.

Now, by Property (1), the colors in are the same as the colors in . This means that, in every -edge coloring of , edge must get the same color as edges and . Because edge has only 3 adjacent edges that are incident in , and edge has only edges that are incident in , we get that if we start to color in with color , we end up using colors only if (recall that ). Using Property (2), one can verify that a -ECGC exists when .

We are finally ready to finish our proof. So, let be a triangle-free cubic graph, and let be obtained from by appending copies of on each vertex of . If , then a ECGC of with colors can be constructed as follows. Let be a connected order of and let be a 3-edge-coloring of that uses colors . For each , color the copies of incident to using colors 1 through on the appended edges (this is possible by Property (3)), then color the uncolored edges incident to in ascending order of their colors. Now, suppose that . By Property (3) and the fact that for every , we get that the colors 1 through are all used in the copies of appended on . This means that the edges of can only use colors , which gives us a 3-edge-coloring of .

5 -free graphs

In this section, we prove Lemma 3. In [huang2016improved], it is proved that deciding is -complete when is a -free graph. Observe that if is a -free graph and is obtained from by adding a universal vertex, then is also -free and is such that if and only if . Therefore, deciding whether is -complete even if is a -free graph with a universal vertex. We reduce this problem to the problem of deciding whether for -free graphs. For shortness, we call the former problem 5-Col -free and the latter CGC -free.

The following lemma proved in [BCD+14] will be useful.

Lemma 9

Let be a connected graph, and be any positive integer. Then, there exists a -CGC of with at most colors.

In our reduction, we use an auxiliary graph with the following properties.

  1. is connected, and for every and every , there is no -CGC of with 5 colors;

  2. There exists such that there are no induced with extremity in ;

  3. is a -free graph.

We first assume that such a graph exists, and later we show how to construct it. Let be an instance of 5-Col -free and let be its universal vertex. Also, let be obtained from by identifying vertices and ; denote the resulting vertex by , the vertices corresponding to by and the vertices corresponding to by . Because of Properties (2) and (3), the fact that is -free and that dominates in , we know that is also a -free graph. We claim that if and only if . This finishes the proof.

First, let , and observe that, because , we get that . Let be an optimal coloring of . Since is universal in , we know that ; it suffices to start by coloring with 1 and using any optimal greedy ordering for (recall that it always exists). Also, because , by Lemma 9 we know that there exists a -CGC of with at most colors. This means that can be extended to a connected greedy coloring of with colors.

Now, suppose that and let be an optimal connected greedy coloring of . Note that, since , we get that . Also, note that either starts in , in which case restricted to is a CGC of , or starts in , in which case restricted to is a -CGC of . In both situations, we get that the number of used colors is bigger than 5 by Property (1).

It remains to construct the desired auxiliary graph. Observe Figure 6 to follow the construction. We start with a complete graph on vertices