Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graph Coloring prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University March 2014Graph Coloring1.

Similar presentations


Presentation on theme: "Graph Coloring prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University March 2014Graph Coloring1."— Presentation transcript:

1 Graph Coloring prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University March 2014Graph Coloring1

2 Vertex Coloring March 2014Graph Coloring2 A k-coloring of a graph G is a labeling f : V(G) → { 1,…,k }. A coloring is proper if no two vertices x and y, connected with an edge have same color, xy ϵ E(G) => f(x) ≠ f(y). G is k-colorable if it has proper k-coloring. The chromatic number χ(G) is the smallest k such that G has proper k-coloring. G is called k-chromatic. If χ(G) = k, but χ(H) < k for every proper subgraph H, then G is k-critical.

3 March 2014Graph Coloring3 The vertices having same color in a proper k-coloring must be independent. Therefore, χ(G) is the minimum number of independent sets covering G. Hence, G is k-colorable iff G is k-partite. Examples. Every bipartite graph is 2-colorable. Every even cycle graph is 2-colorable (it is bipartite). Every odd cycle graph is 3-colorable and 3-critical. 2-colorability can be tested with BFS. (how?) We compute the distance from a vertex u. A connected graph is bipartite iff G[X] and G[Y] are independent sets, where X and Y are vertices of even and odd distance from u, respectively.

4 G χ(G) = s+3 whereas ω(G) = s+2! Hence χ(G) > ω(G). K s with any two adjacent of C 5 vertices turn into K s+2. K s+2 March 2014Graph Coloring4 The largest clique size ω(G) satisfies χ(G) ≥ ω(G). The largest independent set size α(G) satisfies χ(G) ≥ n(G) / α(G). Is it possible that χ(G) > ω(G)? KsKs Yes, χ(G) may exceed ω(G)! Proper coloring of K s requites s colors. s s s s s C5C5 Could it be constructed with C 3 rather than C 5 ?

5 Upper Bounds of Chromatic Number March 2014Graph Coloring5 Easy bounds are χ(G) ≤ n(G), χ(G) ≥ ω(G), and χ(G) ≥ n(G) / α(G), all hold with equality for cliques. Better than χ(G) ≤ n(G) upper bounds can be obtained by coloring algorithms. A greedy algorithm w.r.t V(G) order v 1,…,v n, assigns to v i the smallest color index not incident so far to v i. Proposition. There is χ(G) ≤ ∆(G) + 1. (∆(G) is the largest vertex degree.) Proof. By construction. A vertex has no more than ∆(G) neighbors. Upon v i coloring there must be at least one of 1,…, ∆(G)+1 colors unused. ■

6 March 2014Graph Coloring6 Different orderings may yield smaller upper bounds. Finding the best ordering is hard. Is there an ordering yielding χ(G)? It can be shown that such one exists. Example. Register allocation and interval graphs. Consider the registers used by a compiler, each has start and end time. What is the smallest number of physical registers that can be used? Assign the symbols a, b, c, … to the registers in the code, and draw their usage time intervals. a b c de f g Proposition. If G is an interval graph then χ(G) = ω(G).

7 March 2014Graph Coloring7 Proof. By left-to-right traversal of the time intervals, pre sorted by their starting time. Initializing k=0. Increasing to k+1 at starting point and decreasing to k-1 at ending point. ■ The bound χ(G) ≤ ∆(G)+1 may still be very poor. For (n+1)-vertex star graph ∆(G) = n, whereas χ(G) = 2. For (n+1)-vertex wheel graph ∆(G) = n, whereas χ(G) ≤ 4.

8 March 2014Graph Coloring8 The bound χ(G) ≤ ∆(G)+1 can be further improved by considering the vertices with high degree first. Proposition. (Welsh-Powell 1967) If the vertices are ordered in non increasing degree, d 1 ≥ d 2 ≥ … d n, then χ(G) ≤ 1 + max i min { d i, i-1 }. Proof. When vertex i is colored, at most min { d i, i-1 } of its neighbors have already been colored. Its color is therefore 1 + min{ d i, i-1 }. Maximization over i yields the upper bound. ■ The minimum degree δ(G) in G can also be used to deduce upper bounds.

9 March 2014Graph Coloring9 Lemma. If H is k-critical graph, then δ(H) ≥ k-1. Proof. Assume in contrary that δ(H) < k-1. Let x ϵ H be any vertex. We could therefore drop one of the missing colors for x. Since H is k-critical, H-x is (k-1)-colorable. If d H (x) < k-1, then not all the k-1 colors used in H-x are used for N(x). That holds for any x. By color renaming we can obtain a proper k-1 coloring of H, hence a contradiction. ■

10 March 2014Graph Coloring10 Corollary. (Szekeres-Wilf 1968). Proof. Let and H’ be a k-critical subgraph of G. By the above lemma. There is also, yielding the desired bound. ■

11 Coloring of Directed Graphs March 2014Graph Coloring11 Theorem. Let a graph G be directed with longest path l(G), then χ(G) ≤ 1 + l(G). Furthermore, there are orientations of G’s edges such that equality holds. Proof. Let G’ be a maximal acyclic sub digraph of G (not necessarily a tree). G G’G’ G’ must have vertices with outgoing arcs only. Define f(v) to be a coloring function assigning color 1+l(v). 1 1 2 3 4 5 6

12 March 2014Graph Coloring12 f is strictly increasing along a path in G’ using colors 1+l(G’) on V(G) = V(G’). For each edge uv ϵ E(G) there exists a path in G’ between u and v, since either there was uv ϵ E(G’) or the edge is closing a cycle of G. That implies f(u) ≠ f(v) since f increases along paths of G’. Consequently, f is a proper coloring and χ(G) ≤ 1 + l(G). To show orientations of G’s edges satisfying χ(G) = 1 + l(G), an orientation satisfying χ(G) ≥ 1 + l(G) is shown.

13 March 2014Graph Coloring13 Each edge uv ϵ E(G*) is oriented u → v iff f(u) < f(v). Since f is a proper coloring, this defines an orientation. Since the color labels along paths in G* strictly increase, and there are only χ(G) labels, there is l(G*) ≤ χ(G*) – 1, hence χ(G) = 1 + l(G). ■ 1 2 3 4 G G*G* Let f be an optimal coloring satisfying f(G) = χ(G). We derive digraph G* as follows.

14 Brook’s Theorem March 2014Graph Coloring14 The bound χ(G) ≤ ∆(G) + 1 holds for any graph. Brook showed that cliques and odd cycles are essentially the only graphs where χ(G) = ∆(G) + 1 holds. Theorem. (Brook 1941) If G is connected and other than a clique or an odd cycle, then χ(G) ≤ ∆(G). Proof. Let G have n nodes and be connected, neither a clique, nor an odd cycle. Let k = ∆(G) and assume k ≥ 3, as otherwise for k = 1 it is a clique, and bipartite or an odd cycle for k = 2. Consider first the case where G is not k-regular. Choose a vertex v n for which d(v n ) < k and grow a spanning tree rooted at v n (by any search).

15 March 2014Graph Coloring15 Index the vertices in decreasing order as they are being reached by the search, yielding the order v 1, v 2, …,v n. Each vertex other than v n has a higher-indexed neighbor along its path to root, hence it has at most k-1 lower- indexed neighbors. Using the greedy coloring with the vertex decreasing order obtains proper k-coloring. In the remaining cases G is k-regular. 1 st case: G is 1-connected. Let x be a cut-vertex. Let G’ be a component of G-x together with x. The degree of x in G’ is less than k and a proper k-coloring is possible.

16 G’G’ March 2014Graph Coloring16 This can be repeated for every components of G-x, yielding k-proper coloring for each (x included). By permuting colors within the subgraphs, we can make the colorings agree on x, yielding k-proper coloring of G. 2 nd case: G is not 2-connected. Find a vertex v n with neighbors v 1 and v 2 (non adjacent ) whose deletion leaves a connected subgraph. G x

17 vnvn March 2014Graph Coloring17 v1v1 v2v2 G - {v 1, v 2 } is connected and a spanning tree rooted at v n can be constructed. The labels 3, …, n are assigned to the vertices in decreasing order as they are reached. Starting coloring from v 1 and v 2, they use same color. Then, each vertex other than v n has at most k-1 lower- indexed neighbors and k colors can be used for those.

18 x = v n March 2014Graph Coloring18 All in all, k proper coloring of G has been obtained. v n has k neighbors, of which v 1 and v 2 already used the same color. The rest neighbors used at most other k-2 colors, and v n can therefore be properly colored. 3 rd case: G is 2-connected. Choose a vertex x such that vertex connectivity κ(G-x) = 1.

19 x = v n March 2014Graph Coloring19 x has a neighbor in every block of G-x obtained by deleting the 2 nd vertex in a cut-set, else G is 1-connected rather than 2-connected. v1v1 v2v2 There is no edge connecting v 1 and v 2 since they are in different blocks. G - {x, v 1, v 2 } is connected since blocks have no cut- vertices and v 1, v 2 are no such.

20 March 2014Graph Coloring20 k ≥ 3 implies G - {v 1, v 2 } is also connected. All in all this is the same situation as the case of G not 2- connected. ■ Brook’s Theorem implies that the cliques and the odd cycles are the only (k-1)-regular k-critical graphs. (homework)

21 Chromatic Polynomials March 2014Graph Coloring21 We shall associate with any graph a function telling whether or not it is 4-colorable. This study was motivated by the hope to prove the Four- Color Theorem, which by that time was a conjecture. Let P G (k) denote the number of proper colorings of a graph G with k colors. P G (k) is called the chromatic function of G. Example. P G (k) = k (k - 1) 2. The first vertex can be colored in k ways, while each of the other two in k-1 ways. For a tree T of n vertices there is P T (k) = k (k - 1) n-1.

22 March 2014Graph Coloring22 For G = K 3 there is P G (k) = k (k - 1) (k - 2) and for G = K n there is P G (k) = k (k - 1) (k - 2) · · · (k – n + 1). If k 0. The Four-Color Theorem for planar graph G is equivalent to the statement that P G (4) > 0. It is difficult to compute P G (k) by inspection, but it can be systematically obtained as a sum of chromatic functions of complete graphs. Theorem. Let u,v ϵ V(G) be not incident, G 1 be obtained by adding the edge uv to G, and G 2 be obtained by identifying u and v in G. Then P G (k) = P G 1 (k) + P G 2 (k).

23 March 2014Graph Coloring23 uv G k(k-1)(k-2) 2 = uv G1G1 uv G2G2 k(k-1)(k-2)(k-3)k(k-1)(k-2 + Proof. In a proper coloring of G, u and v may have either the same color or different colors. The number of proper colorings where u and v have different colors does not change if an edge uv would exist, yielding P G 1 (k).

24 March 2014Graph Coloring24 Similarly, the number of proper colorings where u and v have same color does not change if an u and v are merged, yielding P G 2 (k). ■ Corollary. The chromatic function is a polynomial. Proof. The procedure of the theorem results in two graphs. In G 1 the number of edges is increased. In G 2 the number of vertices is decreased. The process is finite. It ends with producing complete graphs, whose chromatic functions are polynomial. The chromatic function is therefore a finite sum of polynomials, which must be polynomial too. ■

25 March 2014Graph Coloring25 For n-vertex graph G the degree of P G (k) is n, the coefficient of k n is 1 and that of k n-1 is |E(G)|, the sign of the coefficients is alternating, and the free coefficient is zero. P G (k) = k 5 - 7k 4 + ak 3 - bk 2 + ck Example. v w = v w v w +

26 March 2014Graph Coloring26 = v w v w + + + = + + + 2 P G (k) = k(k - 1)(k - 2)(k - 3)(k - 4) + 3k(k - 1)(k - 2)(k - 3) + 2k(k - 1)(k - 2) = k 5 - 7k 4 + 19k 3 - 23k 2 + 10k

27 March 2014Graph Coloring27 Example: Scheduling feasibility. A schedule for certain lectures is required, for which some time slots are given (e.g., campus is open). There is no limit of available rooms. It is known that some lectures cannot take place in parallel (e.g. students are registered to both). Is scheduling feasible? How many schedules there are? Solution. Define a graph where lectures are vertices and edges correspond to lectures that cannot be scheduled at the same time slot. The chromatic polynomial, where k is the number of time slots answer the questions. ■

28 Edge Coloring March 2014Graph Coloring28 Edge coloring partitions E(G) into k sets (some possibly empty) { E 1, E 2, …, E k }. An edge coloring is proper if adjacent edges have different colors. All coloring henceforth are meant to be proper. Edge coloring thus partitions E(G) into k sets { M 1, M 2, …, M k } of matchings. (Only loopless graphs admit proper edge coloring). A k-edge-coloring of a graph G is a labeling f : E(G) → { 1, …,k }.

29 March 2014Graph Coloring29 G is k-edge-colorable if it has k-edge-coloring. The edge chromatic number is the smallest k such that G has k-edge-coloring. G is called k-edge-chromatic. Clearly, χ’(G) ≥ Δ(G). Clearly, G is m-edge-colorable, where m = |E(G)|. Not 3-edge-colorable, hence χ’(G) = 4. Example. (Timetabling) m teachers x 1, x 2, …, x m and n classes y 1, y 2, …, y n are given. Teacher x i is required to teach class y j a lessen of period p ij. Schedule a complete timetable having minimum duration.

30 March 2014Graph Coloring30 Solution. The scheduling is represented by a bipartite graph H[X,Y], X = { x 1, x 2, …, x m }, Y = { y 1, y 2, …, y n } vertices x i and y j are connected with p ij parallel edges. The minimum number of colors required for H edge- coloring ensures minimum duration. No schedule overlap for a teacher. No two lesson schedules overlap in a class. ■

31 Edge Coloring of Bipartite Graphs March 2014Graph Coloring31 Let the subgraph H span G (V(H) = V(G)), and C := { M 1, M 2, …, M k } be a k-edge-coloring of H. A color is available for an e ϵ E(G) \ E(H) if it is available in its two end vertices. If e is uncolored, any of its available colors can be assigned to extend C to a k-edge-coloring of H + e. For i ≠ j, each component of H ij := H[M i U M j ] is either an even cycle or a path (called ij-path). (why?) Theorem. If G is bipartite then χ’(G) = Δ(G).

32 March 2014Graph Coloring32 Proof. By induction on m = |E(G)|. Let e = uv ϵ E(G). Assume that H = G \ e has a Δ-edge-coloring { M 1, M 2, …, M Δ }. If a color is available for e we are done. Otherwise, each of the Δ colors is represented either at u or at v. Since the degrees of u and v in G \ e are Δ-1 at most, there are colors i ≠ j, where i is available at u and exists in v, and j is available at v and exists in u. Consider the subgraph H ij := H[M i U M j ]. Because u has a degree one in H ij, the component containing u is an ij- path P.

33 March 2014Graph Coloring33 P cannot terminate at v. If it did, it would started from u with color j and end at v with color i, hence comprising even number of edges. P + e would then be an odd cycle in G, impossible for a bipartite graph. Interchanging the colors of P, a new Δ-edge-colorable H is obtained, where color j is available at u and v. u v P u v P e Assigning color j to e obtains a Δ-edge-coloring of G. ■

34 March 2014Graph Coloring34 Clearly, there is χ’(G) ≥ Δ(G), and for bipartite graphs there is χ’(G) = Δ(G). What can be said about an upper bound? Surprisingly, it is very tight. Theorem. (Vizing 1964, Gupta 1966). Let G be a simple (no parallel edges, loopless) graph. Then χ’(G) ≤ Δ(G) + 1. Proof. Let G’, a proper subgraph of G, be edge-colored with Δ(G) + 1 colors, but uv could not be colored. We present a recoloring procedure to include uv. Since more than Δ(G) colors are used, every vertex has a color not presented. Let a 0 be missing from u and a 1 from v. (a 0 must be presented at v and a 1 at u.) u v

35 March 2014Graph Coloring35 Let v 1 be neighbor of u along the edge colored a 1. At v 1 some color a 2 must be missing. u v v1v1 Suppose a 2 does not appear on u. We could recolor uv 1 with a 2, free a 1 from u, and then color uv with a 1. u v v1v1 So we suppose that a 2 appears on u. The process continues for i ≥ 2. Finding a new color a i that appears at u, let v i be the neighbor of u along the edge colored a i.

36 March 2014Graph Coloring36 At v i some color a i+1 must be missing. u v v1v1 v2v2 vivi a i+1 u v v1v1 v2v2 vivi u v v1v1 v2v2 vivi If a i+1 is missing at u, we downshift color a j from uv j to uv j-1 for 1 ≤ j ≤ i (uv 0 = uv). We are finished, unless a i+1 appears at u, in which case the process continues. There are only Δ(G) + 1 colors, hence the iterative selection of a i+1 eventually repeats a color.

37 March 2014Graph Coloring37 Let a 1, …, a l be the shortest non repetitive color list such that a l+1 is missing at v l and repeats one of a 1, …, a l-1. Let a l+1 = a k for some 1 ≤ k ≤ l-1. This color is missing from v k-1 and appears on uv k. If v l lacks a 0, we downshift colors from v l and use a 0 on uv l to complete the augmentation. Hence we assume that a 0 appears at v l and a k does not. Let P be the longest alternating path of edges colored a 0 and a k that begins at v l (with a 0 ). P u v v1v1 v2v2 v k-1 vkvk vlvl

38 March 2014Graph Coloring38 P is unique. (why?) Depending on the opposite end of P, recoloring can take place to complete the augmentation. Three possibilities exist: P ends at v k, P ends at v k-1, and P ends elsewhere. If P ends at v k, it is with a 0 since uv k is colored with a k. u v v1v1 v2v2 v k-1 vkvk vlvl akak akak a0a0 a0a0 Downshifting from v k, switching colors of P, and coloring uv k with a 0, completes the augmentation. u v v1v1 v2v2 v k-1 vkvk vlvl a0a0 akak a0a0 akak

39 March 2014Graph Coloring39 If P ends at v k-1, it is with a 0 since v k-1 lacked a k. u v v1v1 v2v2 v k-1 vkvk vlvl akak akak a0a0 a0a0 u v v1v1 v2v2 vkvk vlvl akak a0a0 akak akak Downshifting from v k-1, switching colors of P, and coloring uv k-1 with a 0, completes the augmentation. Finally, suppose that P neither reaches v k nor v k-1, so it ends at some vertex outside { u, v l, v k, v k-1 }

40 March 2014Graph Coloring40 P terminates with a 0 (a k ) colored edge, a case were the far end vertex lacks a k (a 0 ). (The vertices along P can also touch any of u neighbors N(u) - {v k, v k-1 }, as a 0 assumed presented at those.) akak u v v1v1 v2v2 v k-1 vkvk vlvl akak akak a0a0 a0a0 P We downshift from v l, give color a 0 to uv l, and switch colors of P. ■ a0a0 u v v1v1 v2v2 v k-1 vkvk vlvl akak a0a0 akak akak P

41 Line Graphs March 2014Graph Coloring41 Many questions about vertices have natural analogues involving edges. Definition. The line graph L(G) is defined by V(L(G)) ≡ E(G) and ef ϵ E(L(G)) if e = uv and f = vw, where u,v,w ϵ V(G). Independent sets have no pairs of adjacent vertices; matchings have no adjacent edges. Vertex coloring partitions the vertices into independent sets; edges can instead be partitioned into matchings. e f g h G e f g h L(G)L(G) u v w

42 Line Graphs Characterization March 2014Graph Coloring42 Theorem. (Krausz 1943) A simple graph G is the line graph of some simple graph iff E(G) has a partition into cliques using each vertex of G at most twice. Proof. Denote by H the original graph. Necessity follows from the fact that the edges adjacent at a vertex of H are represented in L(H) by vertices connected in a clique. Since an edge connects two vertices, those vertices imply two cliques at most. uN(u)N(u) vN(v)N(v) vertex in L(H) cliques in L(H)

43 March 2014Graph Coloring43 For sufficiency, suppose E(G) has such a partition, using cliques { S 1, …, S k }. We shall construct H satisfying G = L(H). Assume that G has no isolated varices. Let v 1, …, v l be the vertices of G (if any) that appear in a single clique of { S i }. We define a vertex in H for each set of A = S 1, …, S k, { v 1 }, …, { v l }. Edges of H are defined such that H vertices are adjacent if the corresponding sets of A intersect. Each vertex of G appears exactly in two sets of A. Also, two vertices cannot both appear in two sets of A, as otherwise a clique was split among the sets.

44 March 2014Graph Coloring44 Hence there are no parallel edges in H, so it is simple, and there is one edge in H for each vertex of G. Adjacent vertices in G appear together in some S i and the corresponding edges of H share the vertex corresponding to S i. Hence G = L(H). ■ The above theorem does not directly yield an efficient test for line graph, which the following does. clique impossible G = L(H) => H

45 March 2014Graph Coloring45 Theorem. (Bieneke 1968) A simple graph G is the line graph of some simple graph iff G does not contain any of the following subgraphs as an induced subgraph.


Download ppt "Graph Coloring prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University March 2014Graph Coloring1."

Similar presentations


Ads by Google