Hierarchical Colorings of Cographs

by   D. I. Valdivia, et al.

Cographs are exactly hereditarily well-colored graphs, i.e., the graphs for which a greedy coloring of every induced subgraph uses only the minimally necessary number of colors χ(G). In recent work on reciprocal best match graphs so-called hierarchically coloring play an important role. Here we show that greedy colorings are a special case of hierarchical coloring, which also require no more than χ(G) colors.



There are no comments yet.


page 1

page 2

page 3

page 4


Hierarchical and Modularly-Minimal Vertex Colorings

Cographs are exactly the hereditarily well-colored graphs, i.e., the gra...

Two lower bounds for p-centered colorings

Given a graph G and an integer p, a coloring f : V(G) →ℕ is p-centered i...

Total Colourings - A survey

The smallest integer k needed for the assignment of colors to the elemen...

Exact square coloring of subcubic planar graphs *

We study the exact square chromatic number of subcubic planar graphs. An...

Connected greedy coloring H-free graphs

A connected ordering (v_1, v_2, ..., v_n) of V(G) is an ordering of the ...

Treedepth Bounds in Linear Colorings

Low-treedepth colorings are an important tool for algorithms that exploi...

Deep Learning-based Hybrid Graph-Coloring Algorithm for Register Allocation

Register allocation, which is a crucial phase of a good optimizing compi...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction and Preliminaries

Let be an undirected graph. A (proper vertex) coloring of is a surjective function such that implies . The minimum number of colors such that there is a coloring of is known as the chromatic number . A greedy coloring of is obtained by ordering the set of colors and coloring the vertices of in a random order with the first available color. The Grundy number is the maximum number of colors required in a greedy coloring of [2]. Obviously . Determining [7] and [12] are NP-complete problems. A graph is called well-colored if [12]. It is hereditarily well-colored if every induced subgraph is well-colored.

Definition 1.1 ([3]).

A graph is a cograph if , is the disjoint union of cographs , or is a join of cographs .

This recursive construction induces a rooted tree , whose leaves are individual vertices corresponding to a and whose interior vertices correspond to the union and join operations. We write for the leaf set and for the set of inner vertices of . The set of children of is denoted by . For edges in we adopt the convention that is a child of . We define a labeling function , where an interior vertex of is labeled if it is associated with a disjoint union, and for joins. The set denotes the leaves of that are descendants of . To simplify the notation we will write for the subgraph of induced by the vertices in . Note that is the graph consisting of the single vertex if is a leaf of .

Given a cograph , there is a unique discriminating cotree111In [3] the discriminating cotree is defined as the cotree associated with . Here we call every tree arising from Def. 1.1 a cotree of . in which adjacent operations are distinct, i.e., for all interior edges . It is possible to refine the discriminating cotree by subdiving a disjoint union or join into multiple disjoint unions or joins, respectively [1, 3]. It is well known that every induced subgraph of a cograph is again a cograph. A graph is a cograph if and only if it does not contain a path on four vertices as an induced subgraph [3]. The cographs are also exactly the hereditarily well-colored graphs [2]. The chromatic number of a cograph can be computed recursively, as observed in [3, Tab.1]. Starting from as base case we have


Hierarchically colored cograph (hc-cographs) were introduced in [5] as the undirected colored graphs recursively defined by


, i.e., a colored vertex, or


and , or


and ,

where for every , and and are hc-cographs.

This recursive construction of an hc-cograph implies a binary cotree . Its inner vertices can be associated with the intermediate graphs in the construction. We say that is an hc-coloring w.r.t. .

Obviously, the graph underlying an hc-cograph is a cograph.

Definition 1.2.

Let be a cograph. A coloring of is an hc-coloring of if there is binary cotree of such that is hc-cograph w.r.t. .

This contribution aims to investigate the properties of hc-colorings and their relationships with other types of cograph colorings.

2 Existence of hc-Colorings

As noticed in [5], a coloring of a cograph may be an hc-coloring w.r.t. some cotree but not w.r.t. to another cotree that yields the same cograph. An example is shown in Fig. 1.

Figure 1: The induced cotree of a cograph affects the hc-coloring property of , where . In , the first tree from left to right, (K1)-(K3) are satisfied making an hc-coloring. However the second tree does not satisfy (K3) since the parent node of and corresponds to a disjoint union operation and . Thus is not an hc-coloring w.r.t. .
Theorem 2.1.

Let be an hc-coloring of a cograph . Then .


We proceed by induction w.r.t. . The statement is trivially true for , i.e. , since . Now suppose . Thus or for some graphs and with . By induction hypothesis we have and .

First consider . Since for all and we have , and hence . Thus, and therefore,

We note that the coloring condition in (K2) therefore only enforces that is a proper vertex coloring.

Now suppose . Axiom (K3) implies . Hence,

As detailed in [2], we have . Thus, it seems natural to ask whether every greedy coloring is an hc-coloring. Making use of the fact that , we assume w.l.o.g. that the color set is whenever we consider greedy colorings of a cograph. By definition of greedy colorings and the fact that cographs are hereditarily well-colored, we immediately observe

Lemma 2.2.

Let be a greedy coloring of a cograph and a connected component of . Then is colored by .

We shall say that a cograph is a minimal counterexample for some property if (1) does not satisfy and (2) every induced subgraph of (i.e., every “smaller” cograph) satisfies .

Lemma 2.3.

Let be a cograph, an arbitrary binary cotree for and a greedy coloring of . Then is an hc-coloring w.r.t. .


Assume is a minimal counterexample, i.e., is a minimal cograph for which a coloring exists that is a greedy coloring but not an hc-coloring. If is connected, then , for some and , i.e., (K2) is satisfied. By assumption, is not an hc-coloring, hence must fail to be an hc-coloring on at least one of the connected components , contradicting the assumption that is a minimal counterexample. Thus, cannot be connected.

Therefore, assume for some . Since is represented by a binary cotree , the root of must have exactly two children and . Hence, we can write . Since is a minimal counterexample, we can conclude that induces an hc-coloring on and . However, since is, in particular, a greedy coloring of and , or most hold. But this immediately implies that satisfies (K3) and thus is an hc-coloring of . Therefore, is not a minimal counterexample, which completes the proof. ∎

As an immediate consequence we find

Corollary 2.4.

Every cograph has an hc-coloring.

The converse of Lemma 2.3 is not true. Fig. 2 shows an example of an hc-coloring that is not a greedy coloring.

Figure 2: Both colorings A and B of are hc-colorings. However, only A is a greedy coloring since the two single-vertex components have different colors in B.
Theorem 2.5.

A coloring of a cograph is greedy coloring if and only if it is an hc-coloring w.r.t. every binary cotree of .


By Lemma 2.3, every greedy coloring is an hc-coloring for every binary cotree . Now suppose is an hc-coloring for every binary cotree and let be a minimal cograph for which is not a greedy coloring. As in the proof of Lemma 2.3 we can argue that cannot be a minimal counterexample if is connected: in this case, and for all colorings, and thus is a greedy coloring if and only if it is a greedy coloring with disjoint color sets for each . Hence, a minimal counterexample must have at least two connected components.

Let for some and define a partition of into sets , , such that for every , if and only if . Since every , , is a cograph, each can be represented by a (not necessarily unique) binary cotree . Note, we have for all . Now, we can construct a binary cotree for as follows: let be a caterpillar with leaf set . We choose (in Newick format). Note, if , then . Now, the root of every tree is identified with a unique leaf in such that the root of is identified with and the root of is identified with , where if and only if . This yields the tree . The labeling for is provided by keeping the labels of each and by labeling all other inner vertices of by . It is easy to see that is a binary cotree for . By hypothesis, this in particular implies that is an hc-coloring w.r.t. . We denote by the set of inner vertices of . Since is an hc-coloring w.r.t.  and thus in particular w.r.t. any subtree , we have for any , , by (K3). Hence, as , it must necessarily hold for all , i.e., all connected components with the same chromatic number are colored by the same color set. By construction, at every node of the caterpillar structure, with children and , the components and satisfy . Invoking (K3) we therefore have and is colored by the color set . These set inclusions therefore imply a linear ordering of the colors such that colors in come before those in . Thus is a greedy coloring provided that the restriction of to each of the connected components of is a greedy coloring, which is true due to the assumption that is a minimal counterexample. Thus no minimal counterexample exists, and the coloring is indeed a greedy coloring of . ∎

Given an hc-cograph, it is not difficult to recover a corresponding binary cotree. To this end, we proceed top down. Denote the root of by . It is associated with the graph . In the general step we consider an induced subgraph of associated with a vertex of . If is connected, then and is the joint of pair of induced subgraphs and . To identify these graphs, consider the connected components of the complement of . We have


We therefore set and . By construction, we therefore have with disjoint color sets . If is disconnected, define , identify one of the components, say , with the smallest numbers of colors and set and . The fact that is an hc-cograph ensures that . In both the connected and the disconnected case we attach and as the children of in . The reconstruction of can be preformed in linear time.

3 Recursively-Minimal Colorings

Not every minimal coloring of a cograph is an hc-coloring. For instance, if is a disconnected cograph, i.e., , then it suffices that . In this case, we may use more colors than necessary on a connected component of , resulting in . Thus, Theorem 2.1 implies that is not an hc-coloring of and hence, by definition, not an hc-coloring of . This suggests to consider another class of colored cographs.

Definition 3.1.

A color-minimal cograph is either a , the disjoint union of color-minimal cographs or the join of color-minimal cographs, and satisfies . A coloring of a color-minimal cograph will be called recursively minimal.

Color-minimal cographs thus are those colorings for which every constituent in their construction along some binary cotree is colored with the minimal number of colors. Since every greedy coloring of every cograph satisfies this condition, every cograph has a recursively minimal coloring.

Theorem 3.1.

Let be a cograph. A coloring of is recursively minimal if and only it is an hc-coloring.


Since every hc-coloring of a cograph uses exactly colors, the recursive definition of hc-colorings immediately implies that is recursively minimal.

Now suppose there is a minimal cograph with a coloring that is recursively minimal but not an hc-coloring. If is connected, then for some and the restrictions of to the connected components use disjoint color sets. Hence, is an hc-coloring whenever the restriction to each is an hc-coloring. Thus a minimal counterexample cannot be connected. Now suppose for some . Since is by assumption a minimal counterexample, each connected component is an hc-cograph. By Equ. (1) there is a connected component, say w.l.o.g. , such that . By definition, induces a recursively minimal coloring on and on . Since is a minimal counterexample, and are hc-colorings of and , respectively, in other words and are hc-cographs. Moreover, implies . In summary, therefore, satisfies (K3), thus it is a cograph with hc-coloring . Hence, there cannot exist a minimal cograph with a coloring that is recursively minimal but not an hc-coloring. ∎

Recursively minimal colorings can be constructed in a very simply manner by stepwisely relabeling colors of disconnected subgraphs as outlined in Alg. 1.

0  Cograph
1   discriminating cotree of
2  initialize all with different colors
3  for all , from bottom to top do
4     if  then
5         set of connected components of
8        for all  do
9           randomly choose an injective map
10           for all  do
Algorithm 1 Recursively minimal coloring of a cograph
Theorem 3.2.

Given a cograph , Algorithm 1 returns a recursively minimal coloring of . Moreover, every recursively minimal coloring of a cograph can be constructed with this algorithm.


The bottom-up traversal of the cotree ensures that for every inner vertex of , the subgraphs induced by its children are color-minimal cographs. In particular this means that for all . Take an arbitrary . Suppose . The fact that is a discriminating cotree implies that all , for all , and therefore are connected components. Futhermore, there exists a such that . These observations and Equ. (1) guarantee that lines 5-7 obtain a set of color such that . Explicitly, and . An injective recoloring , in lines 8-11, assures that and therefore . This implies that is a color-minimal cograph with a recursively minimal coloring. The converse is followed by the fact that every recursively minimal coloring can be obtained with a particular injection . ∎

Algorithm 1 can be modified easily to construct a recursively minimal coloring of with respect to a user defined cotree . It suffices to replace the connected components of by the (not necessarily connected) induced subgraphs corresponding to the children of . Since , it suffices to choose the color set of the child that uses the largest number of colors and re-color all other child-graphs with this color set. For completeness, we summarize this variant in Algorithm 2.

0  Cograph and co-tree
1  initialize all with different colors
2  for all , from bottom to top do
3     if  then
7        for all  do
8           randomly choose an injective map
9           for all  do
Algorithm 2 Recursively minimal coloring of a cograph w.r.t. a given cotree.

The recursive structure of hc-cographs can also be used to count the number of distinct hc-colorings of a cograph that is explained by a cotree . For an inner vertex of denote by the number of hc-colorings of . If is a leaf, then . Recall that is binary by Def. 1.2, i.e., . For , we have since the color sets are disjoint. If , assume, w.l.o.g. , , where is the number of injections between a set of size into a set of size , i.e., .

The total number of hc-colorings can be obtained by considering a caterpillar tree for the step-wise union of connected components. For each connected component with , and there are choices of the colors, i.e., injections and thus colorings. We note in passing that the chromatic polynomial of a cograph, and thus the number of colorings using the minimal number of colors, can be computed in polynomial time [8]. There does not seem to be an obvious connection between the hc-colorings and the chromatic polynomial, however.

4 Concluding Remarks

The cotrees associated with a cograph are a special case of the modular decomposition tree [4], which in addition to disjoint unions and joins also contains so-called prime nodes. The latter have a special structure known as spiders, which also admit a well-defined unique decomposition in so-called -sparse graphs [6]. For this type of graphs it also makes sense to consider recursively minimal colorings. More generally, many interesting classes of graphs admit recursive constructions [10, 9]. For every graph class that has a recursive construction, one can ask whether minimal colorings can be constructed from optimal colorings, i.e., whether recursively minimal colorings exist. In some cases, such Cartesian products of graphs, where equals the maximum of the chromatic numbers of the factors [11]

, this seems rather straightforward. In general, however, the answer is probably negative.


This work was support in part by the German Federal Ministry of Education and Research (BMBF, project no. 031A538A, de.NBI-RBC) and the Mexican Consejo Nacional de Ciencia y Tecnología (CONACyT, 278966 FONCICYT2).


  • [1] Sebastian Böcker and Andreas W. M. Dress. Recovering symbolically dated, rooted trees from symbolic ultrametrics. Adv. Math., 138:105–125, 1998.
  • [2] C. A. Christen and S. M. Selkow. Some perfect coloring properties of graphs. J. Comb. Th., Ser. B, 27:49–59, 1979.
  • [3] D. G. Corneil, H. Lerchs, and L. Steward Burlingham. Complement reducible graphs. Discr. Appl. Math., 3:163–174, 1981.
  • [4] T. Gallai. Transitiv orientierbare graphen. Acta Math Acad. Sci. Hungaricae, 18:25–66, 1967.
  • [5] Manuela Geiß, Marc Hellmuth, and Peter F. Stadler. Reciprocal best match graphs. 2019. submitted, arxiv q-bio 1903.07920.
  • [6] B. Jamison and S. Olariu. A tree representation for -sparse graphs. Discrete Appl. Math., 35:115–129, 1992.
  • [7] Richard M. Karp. Reducibility among combinatorial problems. In R E Miller, J W Thatcher, and J D Bohlinger, editors, Complexity of Computer Computations, pages 85–103. Plenum, New York, 1972.
  • [8] J. A. Makowsky, U. Rotics, I. Averbouch, and B. Godlin. Computing graph polynomials on graphs of bounded clique-width. In F. V. Fomin, editor, Graph-Theoretic Concepts in Computer Science, volume 4271 of Lecture Notes Comp. Sci., pages 191–204, Berlin, Heidelberg, 2006. Springer.
  • [9] Marc Noy and Ares Ribó. Recursively constructible families of graphs. Adv. Appl. Math., 32:350–363, 2004.
  • [10] Andrzej Proskurowski. Recursive graphs, recursive labelings and shortest paths. SIAM J. Comput., 10:391–397, 1981.
  • [11] Gerd Sabidussi. Graphs with given group and given graph-theoretical properties. Canad. J. Math., 9:515–525, 1957.
  • [12] Manouchehr Zaker. Results on the Grundy chromatic number of graphs. Discr. Math., 306:3166–3173, 2006.