Locally identifying coloring of graphs with few P4s

Locally identifying coloring of graphs with few P4s

JID:TCS AID:11353 /FLA Doctopic: Algorithms, automata, complexity and games [m3G; v1.224; Prn:31/10/2017; 12:27] P.1 (1-8) Theoretical Computer Sci...

539KB Sizes 2 Downloads 46 Views

JID:TCS AID:11353 /FLA

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.1 (1-8)

Theoretical Computer Science ••• (••••) •••–•••

Contents lists available at ScienceDirect

Theoretical Computer Science www.elsevier.com/locate/tcs

Locally identifying coloring of graphs with few P4s Nicolas Martins, Rudini Sampaio ∗ Universidade Federal do Ceará, Fortaleza, Brazil

a r t i c l e

i n f o

Article history: Received 5 April 2017 Received in revised form 6 October 2017 Accepted 19 October 2017 Available online xxxx Communicated by T. Calamoneri Keywords: Locally identifying coloring Cographs

a b s t r a c t A lid-coloring (locally identifying coloring) of a graph is a proper coloring such that, for any edge uv, if u and v have distinct closed neighborhoods, then the set of colors used on vertices of the closed neighborhoods of u and v are distinct. The lid-chromatic number is the minimum number of colors used in a lid-coloring. In this paper we prove a relation between lid-coloring and a variation, called strong lid-coloring. With this, we obtain linear time algorithms to calculate the lid-chromatic number for some classes of graphs with few P 4 ’s, such as cographs, P 4 -sparse graphs and (q, q − 4)-graphs. We also prove that the lid-chromatic number is O (n1−ε )-inapproximable in polynomial time for every ε > 0, unless P = NP. © 2017 Elsevier B.V. All rights reserved.

1. Introduction Given a simple graph G, the neighborhood N ( v ) of a vertex v ∈ V (G ) is the set of vertices adjacent to v in G, and the closed neighborhood is N [ v ] = N ( v ) ∪ { v }. Given a subset S of vertices of G, let G [ S ] be the subgraph of G induced by S. A coloring c of G is a function which associates a color c ( v ) to each vertex v ∈ V (G ). A coloring is proper if c (u ) = c ( v ) for any two adjacent vertices u and v of G. The chromatic number χ (G ) of G is the minimum number of colors in a proper coloring of G. Given a coloring c of G and a set S ⊆ V (G ), let c ( S ) be the set of colors of the vertices in S: c ( S ) = {c ( v ) | v ∈ S }. We often use c and |c | as the set of colors and the number of colors in the coloring c. We say that a proper coloring c of G locally identifies an edge uv of G if N [u ] = N [ v ] implies that c ( N [u ]) = c ( N [ v ]). A locally identifying coloring (lid-coloring) of G is a proper coloring c of G which locally identifies all edges of G. The locally identifying chromatic number (lid-chromatic number) χlid (G ) of G is the minimum number of colors in a lid-coloring of G. Locally identifying colorings are related to distinguishing colorings [3–5] and identifying codes [13], and were recently introduced in 2012 by Esperet et al. [8]. They proved that the lid-chromatic number is NP-hard even in bipartite graphs but it is polynomial time computable for trees [8]. They also proved that χlid (G ) is bounded by a function of χ (G ) in interval graphs, split graphs, cographs and k-trees, and conjectured that χlid (G ) ≤ 2χ (G ) in chordal graphs [8]. Foucaud et al. proved that for any graph G with maximum degree , χlid (G ) ≤ 22 − 3 + 3 [9], answering positively a question of [8]. Gonçalves et al. proved that every planar graph has a lid-coloring with 1280 colors [10] answering an other question of [8]. Esperet et al. [8] also proved that the lid-chromatic number is linear time computable in cographs with bounded clique number, using monadic second order logic. For this, they introduced the concept of strong lid-coloring. A strong lid-coloring is a lid-coloring c such that, if N [ v ] = V (G ), then c ( N [ v ]) = c ( V (G )) for every vertex v. In other words, if c ( N [ v ]) has all

*

Corresponding author. E-mail addresses: [email protected] (N. Martins), [email protected] (R. Sampaio).

https://doi.org/10.1016/j.tcs.2017.10.015 0304-3975/© 2017 Elsevier B.V. All rights reserved.

JID:TCS AID:11353 /FLA

2

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.2 (1-8)

N. Martins, R. Sampaio / Theoretical Computer Science ••• (••••) •••–•••

Fig. 1. Reduction example for the Grötzsch graph. The numbers are the colors.

 colors of c, then v is a universal vertex. The strong lid-chromatic number χ lid ( G ) of G is the minimum number of colors in a strong lid-coloring of G. In this paper, we first prove in Section 2 that the lid-chromatic number is O (n1−ε )-inapproximable in polynomial time, for any ε > 0, unless P = NP. In other words, unless P = NP, there is no polynomial time approximation algorithm with factor O (n1−ε ) to compute the χlid (G ), where n is the number of vertices.  In Section 3, we study the relation between χlid (G ) and χ lid ( G ) for general graphs, and prove an important relation:  χlid (G ) ≤ χ lid ( G ) ≤ χlid ( G ) + 1.  In Section 4, we use this relation to obtain linear time algorithms to compute χlid (G ) and χ lid ( G ) for classes of graphs with few P 4 ’s, such as cographs, P 4 -sparse graphs and (q, q − 4)-graphs, which are the graphs such that every set with at most q ≥ 4 vertices induces at most q − 4 P 4 ’s, extending the result of [8] in cographs with bounded clique number. The algorithm for (q, q − 4)-graphs is fixed parameter tractable in q. 2. Inapproximability of the lid-chromatic number Given an optimization problem P , let opt P ( I ) denote the optimal solution value of an instance I of P and, for a solution S of I , let val P ( I , S ) denote the value of the solution. Given a function r (n) ≥ 1 on positive integers n, an r (n)-approximation algorithm for a minimization problem P is an algorithm that, applied to any instance I of P , produces a solution S such that val( I , S ) ≤ r (| I |) · opt P ( I ), where | I | is the size of I . We say that P is O (r (n))-inapproximable in polynomial time if there is no polynomial time r (n)-approximation algorithm for P , unless P = NP, where r (n) = O (r (n)). Given minimization problems P 1 and P 2 , a reduction from P 1 to P 2 consists of a pair ( f , g ) of polynomial-time computable functions such that, for any instance I of P 1 , (a) f ( I ) is an instance of P 2 , and (b) g ( I , S ) is a feasible solution of I in P 1 , for any feasible solution S of f ( I ) in P 2 . An approximation preserving reduction from P 1 to P 2 is a 3-tuple ( f , g , α ), where ( f , g ) is a reduction from P 1 to P 2 and α ≥ 1 is a constant such that, if val P 2 ( f ( I ), S ) ≤ r · opt P 2 ( f ( I )) (r ≥ 1), then val P 1 ( I , g ( I , S )) ≤ α r · opt P 1 ( I ) for each instance I of P 1 and for every feasible solution S of f ( I ). Then, if P 2 is r-inapproximable in polynomial time for some function r (n) ≥ 1, then P 1 is α r-inapproximable in polynomial time. Theorem 1. The lid-chromatic number χlid (G ) is O (n1−ε )-inapproximable in polynomial time for any ε > 0, unless P = NP. Proof. We obtain an approximation preserving reduction from the chromatic number. Given a graph G with no isolated vertex, let G be the graph obtained from G by adding a pendent vertex v to every vertex v of G. See Fig. 1 for an example with the Grötzsch graph, the minimum triangle-free graph with χ (G ) = 4. Notice that any lid-coloring c of G induces a proper coloring on the original vertices of G. Thus χ (G ) ≤ χlid (G ). Moreover, from any proper coloring c of G with k colors, we obtain a strong lid-coloring c of G using 2k colors. If v has color i in G, color v with color i in G and its pendent vertex with color i in G . Notice that c is a strong lid-coloring of G , since, for any edge uv of G, c (u ) ∈ c ( N [u ]) but c (u ) ∈ / c ( N [ v ]) (because c (u ) = c ( v )) and, for any pendent vertex v of a vertex v of G, c ( N [ v ]) = c ( N [ v ]) (because v is not isolated and then c (u ) ∈ c ( N [ v ]) but c (u ) ∈ / c ( N [ v ]) for every neighbor u of v in G). Therefore χ (G ) ≤ χlid (G ) ≤ 2χ (G ). Let f be the function that given a graph G returns the graph G and g be the function that given a lid-coloring c of G returns the proper coloring c of G induced by c . Since both functions are polynomial-time computable and χ (G ) ≤ χlid (G ) ≤ 2χ (G ), then the triple ( f , g , 2) is an approximation preserving reduction from the chromatic number to the lid-chromatic number. It is known that there is no polynomial time algorithm that approximates the chromatic number of a graph to within a factor O (n1−ε ), for any ε > 0, unless P = NP [14]. Since | V (G )| = 2 · | V (G )|, then χlid (G ) is O (n1−ε )-inapproximable in polynomial time, for any ε > 0, unless P = NP. 2

JID:TCS AID:11353 /FLA

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.3 (1-8)

N. Martins, R. Sampaio / Theoretical Computer Science ••• (••••) •••–•••

3

3. Relation between lid-colorings and strong lid-colorings In this section, we prove an important relation between lid-colorings and strong lid-colorings, which is used in Section 4 to obtain linear time algorithms for graphs with few P 4 ’s. Lemma 2. Let c be a lid-coloring of a graph G and v a vertex of G. A coloring c obtained from c changing only the color of the vertex v to a new color is also a lid-coloring of G. Proof. Let u and w be two neighbors in G such N [u ] = N [ v ]. Then c ( N [u ]) = c ( N [ w ]) (since c is a lid-coloring) and, without loss of generality, u has a neighbor z such that c ( z) ∈ / c ( N [ w ]). If z = v, then c (z) ∈ c ( N [u ]) but c (z) ∈ / c ( N [ w ]). If z = v, then c ( v ) ∈ c ( N [u ]) but c ( v ) ∈ / c ( N [ w ]), since c ( v ) is a new color, and we are done. 2 Given a lid-coloring c of G, we say that a vertex v ∈ V (G ) is a bad vertex if v is not universal and c ( N [ v ]) = c ( V (G )). Recall that a lid-coloring c is strong if and only if it has no bad vertex. We use Lemma 2 to prove the following theorem. Lemma 3. Let c be a lid-coloring of a graph G with a bad vertex v. Let c be the coloring of G obtained from c by changing the color of v to a new color and, if v is the only vertex with color c ( v ) in c, by changing the color of a non-neighbor w of v to the color c ( v ). Then, c is a strong lid-coloring of G. Proof. Assume without loss of generality that the colors of c are in {1, . . . , k} and c ( v ) = 1. By Lemma 2, we still have a lid-coloring if the color of v is changed to the new color k + 1. If there is other vertex u ∈ V (G ) with c (u ) = 1, we do not make any other changes in the coloring. If there is no vertex with color 1, then there is at least one vertex w ∈ V (G ) not adjacent to v, since v is not a universal vertex. Notice that there is a neighbor of v with the same color c ( w ) of w, since v is a bad vertex. By Lemma 2, we still have a lid-coloring if the color of w is changed to the color 1 (which is a new color). With this, we obtain a lid-coloring c with colors in {1, ..., k + 1}. We claim that c has no bad vertex. Firstly, v is not a bad vertex of c , since no neighbor of v has color 1 in c . By contradiction, suppose that c has a bad vertex u ∈ V (G ). Then u is adjacent to v, since v is the only vertex with color k + 1 in c . Furthermore u is adjacent to a vertex with color 1 in c and thus N [u ] = N [ v ]. However, since u is a bad vertex in c , then u is also a bad vertex in c, and consequently c ( N [u ]) = {1, ..., k} = c ( N [ v ]) and N [u ] = N [ v ], a contradiction since c is a lid-coloring of G. 2

 Theorem 4. Given a graph G, χlid (G ) ≤ χ lid ( G ) ≤ χlid ( G ) + 1.  Proof. Since every strong lid-coloring of G is a lid-coloring, then χlid (G ) ≤ χ lid ( G ). Let c be a minimum lid-coloring of G  using colors in {1, ..., χlid (G )}. If c has no bad vertex, then c is a strong lid-coloring, and then χlid (G ) = χ lid ( G ) and we are done. Thus, assume that there is a bad vertex v ∈ V (G ) in c. Then from Lemma 3 there exists a strong lid-coloring c with  χlid (G ) + 1 colors obtained from c by changing the color of v to a new color. Thus, χ lid ( G ) ≤ χlid ( G ) + 1. 2 4. Lid-coloring of graphs with few P 4 ’s In this section, we obtain linear time algorithms for cographs, P 4 -sparse graphs and (q, q − 4)-graphs. A cograph is a graph with no induced P 4 [6]. A graph G is P 4 -sparse if every set of five vertices in G induces at most one P 4 [11]. A graph G is (q, q − 4) for some integer q ≥ 4 if every subset with at most q vertices induces at most q − 4 P 4 ’s [2]. Cographs and P 4 -sparse graphs are exactly the (4, 0)-graphs and the (5, 1)-graphs. In [2], polynomial time algorithms are obtained for several optimization problems in (q, q − 4)-graphs. 4.1. Lid-coloring cographs Given graphs G 1 = ( V 1 , E 1 ) and G 2 = ( V 2 , E 2 ), the union of G 1 and G 2 is the graph G 1 ∪ G 2 = ( V 1 ∪ V 2 , E 1 ∪ E 2 ) and the join of G 1 and G 2 is the graph G 1 ∨ G 2 = ( V 1 ∪ V 2 , E 1 ∪ E 2 ∪ {uv : u ∈ V 1 , v ∈ V 2 }). Cographs are self-complementary, since the complement of a P 4 is also a P 4 . Therefore, cographs have a nice structure [7] described as follows:

• K 1 is a cograph; • if G is a cograph, then G is also a cograph; • if G 1 and G 2 are cographs, then G 1 ∪ G 2 is also a cograph. It follows that every cograph G is associated with a unique rooted tree T (G ), called the cotree of G, whose leaves are precisely the vertices of G and whose internal nodes are of two types: union (∪) or join (∨).

JID:TCS AID:11353 /FLA

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.4 (1-8)

N. Martins, R. Sampaio / Theoretical Computer Science ••• (••••) •••–•••

4

Theorem 5 ([7]). If G is a cograph, then precisely one of the following holds:

• G has at most one vertex; • G = G 1 ∪ G 2 is the union of two cographs G 1 and G 2 ; • G = G 1 ∨ G 2 is the join of two cographs G 1 and G 2 . In the following, we determine

 χlid (G ) and χ lid ( G ) for the union and join operations.

Lemma 6. Given two graphs G 1 and G 2 , let G = G 1 ∪ G 2 . Then χlid (G ) = max{χlid (G 1 ), χlid (G 2 )} and

 χ lid ( G ) =

⎧ ⎪  max{ χlid (G 1 ), χ lid ( G 2 )}, ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪  max{χlid (G 1 ) + 1, χ ⎪ lid ( G 2 )}, ⎪ ⎪ ⎨

if G 1 and G 2 do not have universal vertices; if only G 1 has universal vertices;

⎪ χlid (G 1 ), χlid (G 2 ) + 1}, if only G 2 has universal max{ ⎪ ⎪ ⎪ ⎪ ⎪ vertices; ⎪ ⎪ ⎪ ⎪ { χ ( G ), χ ( G )} + 1 , if G 1 and G 2 have universal max ⎪ 1 2 lid lid ⎪ ⎪ ⎩ vertices.

Proof. Let G = G 1 ∪ G 2 . Notice that every lid-coloring c of G induces lid-colorings c 1 and c 2 of G 1 and G 2 , respectively, and vice-versa, since there is no edge from G 1 to G 2 in G. For this, we write c ↔ (c 1 , c 2 ). Then we have directly that χlid (G ) = max{χlid (G 1 ), χlid (G 2 )}. Now let us consider strong lid-colorings of G. Let c be a lid-coloring of G and let c 1 and c 2 lid-colorings of G 1 and G 2 such that c ↔ (c 1 , c 2 ). Suppose that G 1 and G 2 do not have universal vertices. Then every bad vertex of c in G 1 is also a bad vertex of c 1 and every bad vertex of c in G 2 is also a bad vertex of c 2 . Thus, if c is a strong lid-coloring, then it uses at least  max{ χlid (G 1 ), χ lid ( G 2 )} colors. Moreover, if c 1 and c 2 are strong lid-colorings, then c is a strong lid-coloring, and we are done. Now suppose that only G 1 has universal vertices. Then every bad vertex of c in G 2 is also a bad vertex of c 2 . Then c  uses at least χ lid ( G 2 ) colors. However, a bad vertex of c in G 1 is either a bad vertex of c 1 or a universal vertex of G 1 . Thus, if c is a strong lid-coloring, then c 2 has a color not appearing in c 1 , since otherwise a universal vertex of G 1 is a bad vertex of c. Then c uses at least χlid (G 1 ) + 1 colors. Moreover, if c 1 is a lid-coloring and c 2 is a strong lid-coloring with a color not appearing in c 1 , then c is a strong lid-coloring, and we are done. The case when only G 2 has universal vertices is analogous to the previous case. Now consider that both G 1 and G 2 have universal vertices. Thus, if c is a strong lid-coloring, then c 1 has a color not appearing in c 2 and c 2 has a color not appearing in c 1 , since otherwise a universal vertex of G 1 or G 2 is a bad vertex of c. Then c uses at least max{χlid (G 1 ), χlid (G 2 )} + 1 colors. Moreover, if c 1 is a lid-coloring with a color not appearing in c 2 and c 2 is a lid-coloring with a color not appearing in c 1 , then c is a strong lid-coloring, and we are done, because there is a lid-coloring c 1 using colors in {1, 3, . . . , χlid (G 1 ) + 1} and a lid-coloring c 2 using colors in {2, 3, . . . , χlid (G 2 ) + 1}. 2

   Lemma 7. Given two graphs G 1 and G 2 , let G = G 1 ∨ G 2 . Then, χ lid ( G ) = χ lid ( G 1 ) + χ lid ( G 2 ) and

χlid (G ) =

⎧ ⎪  χlid (G 1 ) + χlid (G 2 ), χlid (G 1 ) + χ lid ( G 2 )}, if G 1 and G 2 don’t have ⎨min{ ⎪ ⎩

 χlid (G 1 ) + χ lid ( G 2 ),

universal vertices; otherwise.

Proof. Let G = G 1 ∨ G 2 . Notice that every pair (c 1 , c 2 ) of proper colorings c 1 and c 2 of G 1 and G 2 , respectively, with no color in common induces a proper coloring c of G, and vice-versa. For this, we write c ↔ (c 1 , c 2 ). The restriction of no color in common is because there are all edges from G 1 to G 2 in G. Let c , c 1 , c 2 be proper colorings of G, G 1 and G 2 , respectively, such that c 1 and c 2 have no color in common and c ↔ (c 1 , c 2 ). Then |c | = |c 1 | + |c 2 |. Suppose that c is a strong lid-coloring. Thus, if v ∈ V (G ) has c ( N [ v ]) = V (G ), then v is universal in G. Consequently, if v ∈ V (G 1 ) has c 1 ( N [ v ]) = V (G 1 ), then v is universal in G 1 . The same for G 2 . This implies that c 1 and c 2 are strong lid-colorings. Moreover, if c 1 and c 2 are strong lid-colorings, then c is a strong lid-coloring of G. Therefore    χ lid ( G ) = χ lid ( G 1 ) + χ lid ( G 2 ). Now suppose that c is a lid-coloring, not necessarily strong. Assume first that G 1 or G 2 has a universal vertex u. Then u is a universal vertex of G and consequently c has no bad vertex v, since otherwise c ( N [ v ]) = c ( N [u ]) = c ( V (G )), a contra   diction. Then χlid (G ) = χ lid ( G ) = χ lid ( G 1 ) + χ lid ( G 2 ).

JID:TCS AID:11353 /FLA

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.5 (1-8)

N. Martins, R. Sampaio / Theoretical Computer Science ••• (••••) •••–•••

5

Finally assume that G 1 and G 2 have no universal vertex. If c 1 and c 2 have bad vertices v 1 ∈ V (G 1 ) and v 2 ∈ V (G 2 ), then c ( N [ v 1 ]) = c ( N [ v 2 ]) = c ( V (G )), a contradiction, since N [ v 1 ] = N [ v 2 ], v 1 is adjacent to v 2 and c is a lid-coloring. Then either c 1 is a strong lid-coloring or c 2 is a strong lid-coloring. Moreover, if c 1 and c 2 are lid-colorings and either c 1 or c 2 is  strong, then c is a strong lid-coloring of G. Therefore, χlid (G ) = min{ χlid (G 1 ) + χlid (G 2 ), χlid (G 1 ) + χ lid ( G 2 )}. 2 With this, we obtain a linear time algorithm for general cographs, extending the results of [8].

 Theorem 8. Given a cograph G, we can compute χlid (G ) and χ lid ( G ) in linear time O (m + n). Proof. Directly from Theorem 9 and Lemmas 6 and 7.

2

4.2. Lid-coloring P 4 -sparse graphs P 4 -sparse graphs are also self-complementary and also have a nice structural decomposition in terms of unions, joins and spiders. A spider is a graph whose vertex set has a partition ( R , C , S ), where C = {c 1 , . . . , ck } and S = {s1 , . . . , sk } for k ≥ 2 are respectively a clique and a stable set; si is adjacent to c j if and only if i = j (a thin spider), or si is adjacent to c j if and only if i = j (a thick spider); and every vertex of R is adjacent to each vertex of C and non-adjacent to each vertex of S. Notice that the complement of a thin spider is a thick spider, and vice-versa. Theorem 9 ([11]). If a graph G is P 4 -sparse, then

• • • •

G G G G

has at most one vertex;

= G 1 ∪ G 2 is the union of two P 4 -sparse graphs G 1 and G 2 ; = G 1 ∨ G 2 is the join of two P 4 -sparse graphs G 1 and G 2 ; is a spider ( R , C , S ) such that G [ R ] is P 4 -sparse.

In the following, we determine

 χlid (G ) and χ lid ( G ) for thin spiders and thick spiders.

Lemma 10. Let G be a thin spider with partition ( R , C , S ), with k = |C | = | S |. If G is not a P 4 , then:



χlid (G ) =

 χ lid ( G [ R ]) + 2k − 1, if G [ R ] has no universal vertex; χlid (G [ R ]) + 2k, otherwise.

  Furthermore if k ≥ 3, then χ lid ( G ) = χlid ( G ). Otherwise, χ lid ( G ) = χlid ( G [ R ]) + 4. Proof. Let G be a graph which is not a P 4 . At first, notice that, if c is a lid-coloring of G [ R ], then the coloring c of G obtained from c by coloring all vertices of C ∪ S with new colors is a lid-coloring of G. Then χlid (G ) ≤ χlid (G [ R ]) + 2k. Let c be a lid-coloring of G and let c be the coloring of G [ R ] induced by c. Notice that c is also a lid-coloring, since two vertices of R with distinct closed neighborhoods in G [ R ] also have distinct closed neighborhoods in G, and vice-versa. Moreover, any color of c used in a vertex of C cannot appear in other vertex of R ∪ C , since c is a proper coloring, C induces a clique and there are all possible edges from C to R. If two vertices si , s j ∈ S have the same color α = c (si ) = c (s j ) in c, then the vertices c i , c j ∈ C which are adjacent to si and s j , respectively, are such that N [c i ] = N [c j ] and c ( N [c i ]) = c ( N [c j ]) = c ( R ∪ C ∪ {α }), a contradiction. Similarly, at most one vertex of S receives a color appearing on a vertex of R ∪ C , since otherwise there are two vertices c i , c j ∈ C such that c ( N [c i ]) = c ( N [c j ]) = c ( R ∪ C ), a contradiction. Thus all vertices of S receive distinct colors from each other in c, and at most one has a color also used in R ∪ C . Then, χlid (G ) ≥ χlid (G [ R ]) + 2k − 1. Now suppose that there is a universal vertex u in G [ R ] and that a vertex si ∈ S receives a color also used in a vertex of R ∪ C . Then, the vertices u and c i (the neighbor of si in C ) are such that N [c i ] = N [u ] and c ( N [c i ]) = c ( N [u ]) = c ( R ∪ C ), a contradiction since c is a lid-coloring. Then, if G [ R ] has a universal vertex, then no vertex of S has a color of c ( R ∪ C ). Therefore χlid (G ) = χlid (G [ R ]) + 2k. By the same reason, if c has a bad vertex in R, then no color in S appears in R ∪ C and then |c | ≥ χlid (G [ R ]) + 2k. If c  has no bad vertex in R, then |c | ≥ χ lid ( G [ R ]) + 2k − 1. Moreover, if G [ R ] has no universal vertex, we obtain a lid-coloring c of G from any strong lid-coloring c of G [ R ] by coloring all vertices of C ∪ S with a new color except the vertex s1 ∈ S which is colored by the color of c 2 ∈ C . This is because the vertex c 1 ∈ C is the only vertex of G with c [ N [c 1 ] = c ( R ∪ C ) (recall that G is not a P 4 ). Since, from Theorem 4,   χ lid ( G [ R ]) − 1 ≤ χlid ( G [ R ]), then χlid ( G ) = χ lid ( G [ R ]) + 2k − 1. Regarding the strong lid-chromatic number of G, notice that, if k ≥ 3, then no lid-coloring c of G has a vertex v such that c ( N [ v ]) = c ( V (G )), since as proved above all vertices of S receive distinct colors from each other in c, and at most one has  a color also used in R ∪ C . Thus, if k ≥ 3, then every lid-coloring of G is also strong and consequently χ lid ( G ) = χlid ( G ). Now

JID:TCS AID:11353 /FLA

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.6 (1-8)

N. Martins, R. Sampaio / Theoretical Computer Science ••• (••••) •••–•••

6

assume that k = 2. Notice that, if a lid-coloring c of G has a bad vertex, then it belongs to C = {c 1 , c 2 }. Suppose that c 1 ∈ C is a bad vertex of c. Then s2 (the neighbor of c 2 in S) has a color used in R ∪ C , since otherwise c 1 is not a bad vertex. Thus,  if c is a strong lid-coloring, then every vertex of S has a distinct color. Therefore, χ lid ( G ) = χlid ( G ) + 2k = χlid ( G ) + 4. 2 Since a thick spider with k = |C | = | S | = 2 is also a thin spider, we assume that k ≥ 3 in the next lemma. Lemma 11. Let G be a thick spider with partition ( R , C , S ), with k = |C | = | S |. Then χlid (G [ R ]) + 2k.

 χlid (G ) = χlid (G [ R ]) + 2k − 1 and χ lid ( G ) =

Proof. Let c be a lid-coloring of G. If two vertices si , s j ∈ S have the same color c (si ) = c (s j ) in c, then the vertices c i , c j ∈ C which are non-adjacent to si and s j , respectively, are such that N [c i ] = N [c j ] and c ( N [c i ]) = c ( N [c j ]) = c ( V (G )), a contradiction. For the same reason, at most one vertex of S receives a color appearing on a vertex of R ∪ C , since otherwise there are two vertices c i , c j ∈ C such that c ( N [c i ]) = c ( N [c j ]) = c ( V (G )), a contradiction. Thus all vertices of S receive distinct colors from each other in c, and at most one has a color also used in R ∪ C . Then, χlid (G ) ≥ χlid (G [ R ]) + 2k − 1. This also implies that no vertex of R is a bad vertex of any lid-coloring of G and, consequently, choosing one vertex of C , say c i , to be a bad vertex, we obtain a lid-coloring of G from any lid-coloring of G [ R ] by coloring all vertices of S with new colors except the vertex s1 ∈ S which is colored by the color of the vertex c 1 ∈ C . Then χlid (G ) = χlid (G [ R ]) + 2k − 1. Regarding strong lid-colorings, since we cannot have bad vertices, then all vertices of S receive new colors. Then  χ lid ( G ) = χlid ( G [ R ]) + 2k. 2 With this, we obtain a polynomial time algorithm for P 4 -sparse graphs.

 Theorem 12. Given a P 4 -sparse graph G, we can compute χlid (G ) and χ lid ( G ) in linear time O (m + n). Proof. Directly from Theorem 9 and Lemmas 6, 7, 10 and 11.

2

4.3. Lid-coloring (q, q − 4)-graphs For every q ≥ 4, the (q, q − 4)-graphs are also self-complementary and also have a nice structural decomposition in terms of unions, joins, spiders and separable p-components. A graph G is p-connected if, for every bipartition of the vertex set, there is a crossing P 4 (that is, an induced P 4 with vertices in both parts of the bipartition). A p-component of G is a maximal p-connected subgraph. A graph is separable if its vertex set has a particular bipartition ( H 1 , H 2 ) such that every induced P 4 wxyz with vertices in H 1 and H 2 satisfies x, y ∈ H 1 and w , z ∈ H 2 . It was proved that, if G and G are connected and G is not p-connected, then G has a separable p-component H with bipartition ( H 1 , H 2 ) such that every vertex of G − H is adjacent to every vertex of H 1 and non-adjacent to every vertex of H 2 , and every vertex of H 1 has a neighbor in H 2 [12]. Babel and Olariu [1] proved that every p-connected (q, q − 4)-graph is a spider ( R , C , S ) with R = ∅ or has less than q vertices. Theorem 13 ([1]). Let q ≥ 4. If G is a (q, q − 4)-graph, then one of the following holds:

• • • •

G = G 1 ∪ G 2 is the union of two (q, q − 4)-graphs G 1 and G 2 ; G = G 1 ∨ G 2 is the join of two (q, q − 4)-graphs G 1 and G 2 ; G is a spider ( R , C , S ) such that G [ R ] is a (q, q − 4)-graph. G contains a separable p-component H , with | V ( H )| < q and with separation ( H 1 , H 2 ), such that every vertex of G − H is adjacent to every vertex of H 1 and not adjacent to any vertex of H 2 ; • G has less than q vertices. In [2], polynomial time algorithms are obtained for several optimization problems in (q, q − 4)-graphs using this decomposition.  In the following, we determine χlid (G ) and χ lid ( G ) for separable p-components H with less than q vertices. Lemma 14. Let q ≥ 4 be a fixed integer and G be a graph with a separable p-component H = ( H 1 , H 2 ) with less than q vertices, such that every vertex of G − H is adjacent to all vertices of H 1 and non-adjacent to all vertices of H 2 . Given a minimum lid-coloring of G − H and a minimum strong lid-coloring of G − H , we can compute a minimum lid-coloring and a minimum strong lid-coloring of G in time O (q2q+5 ). Proof. Observe that every lid-coloring of G induces a lid-coloring of G − H , since all vertices of G − H have the same neighborhood in H . Thus, any lid-coloring of G has at least χlid (G − H ) colors in the vertices of G − H .

JID:TCS AID:11353 /FLA

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.7 (1-8)

N. Martins, R. Sampaio / Theoretical Computer Science ••• (••••) •••–•••

7

Firstly suppose that χlid (G − H ) ≥ q. Build the graph G from H , adding a new clique {x1 , . . . , xq } and joining all vertices of this clique to the vertices of H 1 . Since G has less than 2q vertices, we can generate every possible coloring of G with colors in {1, . . . , 2q} and verify if it is a lid-coloring , returning the minimum generated lid-coloring. This can be done in time O (q2q+4 ), since we can color the vertices x1 , . . . , xq with colors 1, . . . , q, respectively, and, for every vertex of H , we have at most 2q possible colors, resulting (2q)q colorings. Finally, for each possible coloring, we have to verify if it is a lid-coloring, which can be done in time O ((2q)4 ). Since q ≥ 4, then (2q)q+4 ≤ (q2 /2)q · (2q)4 ≤ q2q+4 . To simplify the notation, we assume without loss of generality that the colorings satisfy the following restrictions. Given colorings c , c , c of G , G , G − H , respectively: (R1) (R2) (R3)

c (G − H ) = {1, . . . , |c (G − H )|} and c (G − H ) ∩ c ( H ) = {1, . . . , |c (G − H ) ∩ c ( H )|}; c = {1, . . . , |c |}; c = {1, . . . , q} ∪ {|c | + 1, . . . , |c | + |c | − q} and c (xi ) = i for every i ∈ {1 . . . , q}.

Given colorings c , c of G , G − H , respectively, satisfying (R2) and (R3), we say that (c , c ) induces the coloring c of G / H , then c ( v ) = c ( v ); if v ∈ H , then c ( v ) = c ( v ). defined below (we write (c , c ) → c), which satisfies (R1). If v ∈ On the other hand, let c be a coloring of G satisfying (R1). Notice that |c (G − H ) ∩ c ( H )| < q, since H has less than q vertices. We say that c induces the colorings c , c of G and G − H , respectively, defined below (we write c → (c , c )), which satisfy (R2) and (R3). Let c ( v ) = c ( v ) for every vertex v of G − H . Let c (xi ) = i for every 1 ≤ i ≤ q and, for every v ∈ H , c ( v ) = c ( v ). Note that c → (c , c ) if and only if (c , c ) → c. With this, we simply write (c , c ) ↔ c. Observe that, if c is a lid-coloring of G, then c is a lid-coloring of G − H and c is a proper coloring of G (not necessarily a lid-coloring) which locally identifies the edges of H (that is, c ( N [ v 1 ]) = c ( N [ v 2 ]) for every edge v 1 v 2 of H with N [ v 1 ] = N [ v 2 ]). Thus, the question is to decide if c locally identifies the edges from H 1 to {x1 , . . . , xq } in G (recall that N [xi ] = N [ v ] for each v ∈ H 1 , since every vertex of H 1 has a neighbor in H 2 ). With this notation, we can proceed to the proof. The general idea of the proof is the following. In the left hand, we want to prove that, if c is a lid-coloring of G − H and c is a proper coloring of G with certain properties, then the coloring c such that (c , c ) → c is a lid-coloring of G. In the right hand, we want to prove that, if c is a lid-coloring of G, then c is a lid-coloring of G − H and c is a proper coloring of G with certain properties. Let us begin with the left hand. Let c , c proper colorings of G , G − H satisfying (R2) and (R3) such that c is a lid-coloring and c locally identifies the edges of H . Let c be the coloring of G such that (c , c ) → c. Suppose that either G − H has a vertex u universal in G − H or c is not a strong lid-coloring. Thus, if c is a lid-coloring of G , then c is a lid-coloring of G, since, for every vertex v of H 1 , c ⊆ c ( N [ v ]) and c ( N [ v ]) = {1, . . . , q} ∪ c ( H 1 ) = c ( N [x1 ]), and consequently c ( N [ v ]) = c ∪ c ( H 1 ) = c ( N [u ]). Now suppose that G − H has no universal vertex and c is a strong lid-coloring. Therefore, since c locally identifies all edges of H and c ( N [u ])  c ⊆ c ( N [ v ]) for every v ∈ H 1 and u ∈ V (G − H ), we have that c is a lid-coloring of G. Now let us deal with the right hand. Let c be a lid-coloring of G satisfying (R1) and let c and c such that c → (c , c ). Since χlid (G − H ) ≥ q, then |c | ≥ q. Suppose that either G − H has a vertex u universal in G − H or c has a bad vertex u. Thus c is a lid-coloring of G , since, for every vertex v of H 1 , c ( N [ v ]) = c ( N [u ]) = c ∪ c ( H 1 ) and therefore c ( N [ v ]) = {1, . . . , q} ∪ c ( H 1 ) = c ( N [x1 ]) (recall that N [x1 ] = N [ v ], since v ∈ H 1 has a neighbor in H 2 ). Now suppose that G − H has no universal vertex and c is a strong lid-coloring. Therefore, since c ⊆ c ( N [ v ]) for every v ∈ H 1 , we have that c not necessarily locally identifies edges from H 1 to {x1 , . . . , xq }. Summarizing, let c , c , c colorings of G, G and G − H , respectively, satisfying (R1), (R2) and (R3) such that (c , c ) ↔ c. Then, c is a lid-coloring of G if and only if c is a lid-coloring of G − H and: (a) c is a proper coloring of G which locally identifies all edges of H , if G − H has no universal vertex and c is a strong lid-coloring; or (b) c is a lid-coloring of G , otherwise. With this, given a lid-coloring c of G − H satisfying (R2), we have the following algorithm to obtain a minimum lid-coloring c of G which induces c . If c is a strong lid-coloring and G − H has no universal vertex, then, for every proper coloring c i of G satisfying (R3) and that locally identifies the edges of H , generate the coloring c i of G such that (c i , c ) → c i . Otherwise, for every lid-coloring c i of G , generate the coloring c i of G such that (c i , c ) → c i . Return the lid-coloring c i with minimum number of colors. This procedure can also return a strong lid-coloring of G (just reject the generated lid-colorings c i which are not strong).   Therefore, if χ lid ( G − H ) = χlid ( G − H ), let c be a minimum strong lid-coloring of G − H . If χ lid ( G − H ) > χlid ( G − H ), let c 1 be a minimum lid-coloring of G − H and c 2 be a minimum strong lid-coloring of G − H , and apply the algorithm to c 1 and c 2 returning the coloring c of G with minimum number of colors. Recall that, by Lemma 3 and Theorem 4, we can always obtain a strong lid-coloring from a non-strong lid-coloring with at most one more color. If χlid (G − H ) < q, the argument is similar: instead of having one graph G , we have a family of graphs G χ (G − H ) , . . . , G q , lid

where each G p is obtained as G replacing the clique of size q by a clique of size p. This is because a minimum lid-coloring c

JID:TCS AID:11353 /FLA

Doctopic: Algorithms, automata, complexity and games

[m3G; v1.224; Prn:31/10/2017; 12:27] P.8 (1-8)

N. Martins, R. Sampaio / Theoretical Computer Science ••• (••••) •••–•••

8

of G not necessarily induces a minimum lid-coloring c of G − H . By the same way, it is possible to compute all lid-colorings of each one of these graphs, which can be done in total time O (q2q+5 ). 2 2q+5  Theorem 15. Given a (q, q − 4)-graph G, we can compute χlid (G ) and χ (m + n)). lid ( G ) in linear time O (q

Proof. Directly from Theorem 13 and Lemmas 6, 7, 10, 11 and 14.

2

Acknowledgements This research was supported by CNPq (Universal 478744/2013-7, 425297/2016-0, Prod. 306187/2015-9) and FUNCAP (Pronem 4543945/2016). References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

L. Babel, S. Olariu, On the structure of graphs with few P 4 s, Discrete Appl. Math. 84 (1998) 1–13. L. Babel, T. Kloks, J. Kratochvíl, D. Kratsch, H. Muller, S. Olariu, Efficient algorithms for graphs with few P 4 s, Discrete Math. 235 (2001) 29–51. P.N. Balister, O.M. Riordan, R.H. Schelp, Vertex-distinguishing edge-colorings of graphs, J. Graph Theory 42 (2003) 95–109. A.C. Burris, R.H. Schelp, Vertex-distinguishing proper edge-colorings, J. Graph Theory 26 (1997) 73–83. ˘ J. Cerný, M. Hornák, R. Soták, Observability of a graph, Math. Slovaca 46 (1) (1996) 21–31. D. Corneil, H. Lerchs, L.K. Stewart, Complement reducible graphs, Discrete Appl. Math. 3 (3) (1981) 163–174. D.G. Corneil, Y. Perl, L.K. Stewart, A linear recognition algorithm for cographs, SIAM J. Comput. 14 (4) (1985) 926–934. L. Esperet, S. Gravier, M. Montassier, P. Ochem, A. Parreau, Locally identifying colorings of graphs, Electron. J. Combin. 19 (2) (2012). F. Foucaud Honkala, T. Laihonen, A. Parreau, G. Perarnau, Locally identifying colourings of graphs with given max degree, Discrete Math. 312 (2012) 1832–1837. D. Gonçalves, A. Parreau, A. Pinlou, Locally identifying coloring in bounded expansion classes of graphs, Discrete Appl. Math. 161 (18) (2013) 2946–2951. B. Jamison, S. Olariu, A tree representation for P 4 -sparse graphs, Discrete Appl. Math. 35 (1992) 115–129. B. Jamison, S. Olariu, P-components and the homogeneous decomposition of graphs, SIAM J. Discrete Math. 8 (1995) 448–463. M.G. Karpovsky, K. Chakrabarty, L.B. Levitin, On a new class of codes for identifying vertices in graphs, IEEE Trans. Inform. Theory 44 (1998) 599–611. D. Zuckerman, Linear degree extractors and the inapproximability of max clique and chromatic number, in: ACM Symp. Theory Computing STOC-2006, 2006, pp. 681–690.