CSC 1300 – Discrete Structures 17: Graph Coloring
Major Themes • Vertex coloring • Chroma c number χ(G) Graph Coloring • Map coloring • Greedy coloring algorithm • CSC 1300 – Discrete Structures Applica ons Villanova University
Villanova CSC 1300 - Dr Papalaskari 1 Villanova CSC 1300 - Dr Papalaskari 2
What is the least number of colors needed for the ver ces of Vertex Colorings this graph so that no two adjacent ver ces have the same color? Adjacent ver ces cannot have the same color χ(G) =
Chroma c number χ(G) = least number of colors needed to color the ver ces of a graph so that no two adjacent ver ces are assigned the same color?
Source: “Discrete Mathema cs” by Chartrand & Zhang, 2011, Waveland Press. Source: “Discrete Mathema cs 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 mathema cs, because it relies on a computer program. It was first presented in 1976. A more recent reformula on can be found in this ar cle:
Formal Proof – The Four Color Theorem, Georges Gonthier, No ces of the American Mathema cal Society, December 2008.
h p://www.printco.com/pages/State%20Map%20Requirements/USA-colored-12-x-8.gif h p://www.ams.org/no ces/200811/tx081101382p.pdf
h p://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 Mathema cs 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
Chroma c Numbers of Some Graphs Example • χ(G) = 1 iff ...
• For Kn, the complete graph with n ver ces, χ(Kn) =
Corollary: If a graph has Kn as its subgraph, then χ(Kn)=
• For Cn, the cycle with n ver ces, χ(Cn) =
• For any bipar te graph G, χ(G) =
• For any planar graph G, χ(G) ≤ 4 (Four Color Theorem)
Source: “Discrete Mathema cs 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 sta ons CSC 2053 CSC 1052 CSC 1300 CSC 2400 CSC 4480 • Index register assignments in compiler CSC 1700 op miza on 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
Compu ng the Chroma c Number Graph coloring algorithm?
There is no efficient algorithm for finding χ(G) for arbitrary graphs. Most computer scien sts believe that no such algorithm exists.
Greedy algorithm: sequen al coloring: 1. Order the ver ces 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 op mal! (order ma ers)
Source: “Discrete Mathema cs with Ducks” by Sara-Marie Belcastro, 2012, CRC Press, p374.
Villanova CSC 1300 - Dr Papalaskari 24 h p://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 Applica on of vertex coloring: Example: Index Registers Traffic lights
• see also example 13.3.9 & Figure 13.12
source: h p://www.lighterra.com/papers/graphcoloring/
Villanova CSC 1300 - Dr Papalaskari 26 Villanova CSC 1300 - Dr Papalaskari 29
Another Applica on of vertex coloring: Traffic lights
• see also example 13.3.9 & Figure 13.12
Villanova CSC 1300 - Dr Papalaskari 30
Dr Papalaskari 6