Graph Coloring Major Themes Vertex Colorings Χ(G) =
Total Page:16
File Type:pdf, Size:1020Kb
CSC 1300 – Discrete Structures 17: Graph Coloring Major Themes • Vertex coloring • Chromac number χ(G) Graph Coloring • Map coloring • Greedy coloring algorithm • CSC 1300 – Discrete Structures Applicaons Villanova University Villanova CSC 1300 - Dr Papalaskari 1 Villanova CSC 1300 - Dr Papalaskari 2 What is the least number of colors needed for the verFces of Vertex Colorings this graph so that no two adjacent verFces have the same color? Adjacent ver,ces cannot have the same color χ(G) = Chromac number χ(G) = least number of colors needed to color the verFces of a graph so that no two adjacent verFces are assigned the same color? Source: “Discrete Mathemacs” by Chartrand & Zhang, 2011, Waveland Press. Source: “Discrete Mathemacs with Ducks” by Sara-Marie Belcastro, 2012, CRC Press, Fig 13.1. 4 5 Dr Papalaskari 1 CSC 1300 – Discrete Structures 17: Graph Coloring Map Coloring Map Coloring What is the least number of colors needed to color a map? Region è vertex Common border è edge G A D C E B F G H I Villanova CSC 1300 - Dr Papalaskari 8 Villanova CSC 1300 - Dr Papalaskari 9 Coloring the USA Four color theorem Every planar graph is 4-colorable The proof of this theorem is one of the most famous and controversial proofs in mathemacs, because it relies on a computer program. It was first presented in 1976. A more recent reformulaon can be found in this arFcle: Formal Proof – The Four Color Theorem, Georges Gonthier, NoFces of the American Mathemacal Society, December 2008. hp://www.printco.com/pages/State%20Map%20Requirements/USA-colored-12-x-8.gif hcp://www.ams.org/noFces/200811/tx081101382p.pdf hp://people.math.gatech.edu/~thomas/FC/usa.gif Villanova CSC 1300 - Dr Papalaskari 11 Villanova CSC 1300 - Dr Papalaskari 12 Dr Papalaskari 2 CSC 1300 – Discrete Structures 17: Graph Coloring Four color theorem Four color theorem Every planar graph is 4-colorable Every planar graph is 4-colorable Do you always need four colors? What about non-planar graphs? K3,3 K5 Villanova CSC 1300 - Dr Papalaskari 13 Villanova CSC 1300 - Dr Papalaskari 14 Example Example Source: “Discrete Mathemacs with Ducks” by Sara-Marie Belcastro, 2012, CRC Press, Fig 13.1. Villanova CSC 1300 - Dr Papalaskari 15 Villanova CSC 1300 - Dr Papalaskari 16 Dr Papalaskari 3 CSC 1300 – Discrete Structures 17: Graph Coloring Chromac Numbers of Some Graphs Example • χ(G) = 1 iff ... • For Kn, the complete graph with n verces, χ(Kn) = Corollary: If a graph has Kn as its subgraph, then χ(Kn)= • For Cn, the cycle with n verces, χ(Cn) = • For any biparFte graph G, χ(G) = • For any planar graph G, χ(G) ≤ 4 (Four Color Theorem) Source: “Discrete Mathemacs with Ducks” by Sara-Marie Belcastro, 2012, CRC Press, Fig 13.1. Villanova CSC 1300 - Dr Papalaskari 17 Villanova CSC 1300 - Dr Papalaskari 18 Applica,ons of Graph Coloring Example: Schedule these exams, avoiding conflicts • map coloring • scheduling Monday Tuesday Wednesday – eg: Final exam scheduling • Frequency assignments for radio staons CSC 2053 CSC 1052 CSC 1300 CSC 2400 CSC 4480 • Index register assignments in compiler CSC 1700 opFmizaon CSC 2014 • Phases for traffic lights Villanova CSC 1300 - Dr Papalaskari 19 Villanova CSC 1300 - Dr Papalaskari 20 Dr Papalaskari 4 CSC 1300 – Discrete Structures 17: Graph Coloring Earlier example – seen as scheduling constraints Revised Exam Schedule: CSC 2053 CSC 1700 Monday Tuesday Wednesday CSC 1700 ?? CSC 1052 CSC 2014 CSC 2053 CSC 2400 CSC 4480 CSC 1300 CSC 4480 CSC 2014 CSC 2400 CSC 1300 CSC 1052 Villanova CSC 1300 - Dr Papalaskari 21 Villanova CSC 1300 - Dr Papalaskari 23 Compung the Chromac Number Graph coloring algorithm? There is no efficient algorithm for finding χ(G) for arbitrary graphs. Most computer scienFsts believe that no such algorithm exists. Greedy algorithm: sequen7al coloring: 1. Order the verFces in nonincreasing order of their degrees. 2. Scan the list to color each vertex in the first available color, i.e., the first color not used for coloring any vertex adjacent to it. Not always opFmal! (order maers) Source: “Discrete Mathemacs with Ducks” by Sara-Marie Belcastro, 2012, CRC Press, p374. Villanova CSC 1300 - Dr Papalaskari 24 hcp://upload.wikimedia.org/wikipedia/commons/0/00/Greedy_colourings.svgVillanova CSC 1300 - Dr Papalaskari 25 Dr Papalaskari 5 CSC 1300 – Discrete Structures 17: Graph Coloring Another Applicaon of vertex coloring: Example: Index Registers Traffic lights • see also example 13.3.9 & Figure 13.12 source: hcp://www.lighterra.com/papers/graphcoloring/ Villanova CSC 1300 - Dr Papalaskari 26 Villanova CSC 1300 - Dr Papalaskari 29 Another Applicaon of vertex coloring: Traffic lights • see also example 13.3.9 & Figure 13.12 Villanova CSC 1300 - Dr Papalaskari 30 Dr Papalaskari 6 .