SlideShare a Scribd company logo
•Graph Coloring
1
Given a graph, colour all the vertices so that two adjacent
vertices get different colours.
4/20/2020 Graph Theory
2
A
B C
G1
4/20/2020 Graph Theory
A
B C
1
A
B C
2
1
3- colorable
graph
A
B C
1
2 3
Definition of Colorable
Let n be a positive number. A simple graph is n -
colorable if the vertices can be colored using n
colors so that no two adjacent vertices have the same
color.
34/20/2020 Graph Theory
44/20/2020 Graph Theory
A
B
D C
A
B
D C
5
2- colorable graph
4/20/2020 Graph Theory
A
B
D C
A
B
D C
A
B
D C
Optimal Colouring
What graphs have chromatic number one?
when there are no edges…
What graphs have chromatic number 2?
A path? A cycle? A triangle?
What graphs have chromatic number larger than 2?
Definition: min #colors for G is chromatic number, x(G)
4/20/2020 Graph Theory 6
Simple Cycles
even(C 2) =
odd(C 3) =
4/20/2020 Graph Theory 7
n n(K ) =
Complete Graphs
4/20/2020 Graph Theory 8
even(W 3) =odd(W 4) =
5W
Wheels
4/20/2020 Graph Theory 9
10
P
Q
RS
T
? - colorable graph
Poll Question#1: What is the chromatic number of above graph?
A. 2
B. 3
C. 4
D. 5
4/20/2020 Graph Theory
Graph Coloring Problem
Consider a fictional continent.
114/20/2020 Graph Theory
Map Coloring
•Suppose removed all borders but still wanted to see
all the countries.
•1 color insufficient.
124/20/2020 Graph Theory
134/20/2020 Graph Theory
So add another color. Try to fill in every country with
one of the two colors.
144/20/2020 Graph Theory
154/20/2020 Graph Theory
164/20/2020 Graph Theory
•PROBLEM: Two adjacent countries forced to have
same color. Border unseen.
174/20/2020 Graph Theory
•So add another color:
184/20/2020 Graph Theory
•Insufficient. Need 4 colors because of this country.
194/20/2020 Graph Theory
•With 4 colors, could do it.
204/20/2020 Graph Theory
From Map Coloring to Graph Coloring
The problem of coloring a map, can be reduced to a
graph-theoretic problem:
214/20/2020 Graph Theory
For each region introduce a vertex:
22
From Map Coloring to Graph Coloring
4/20/2020 Graph Theory
For each pair of regions with a positive-length
common border introduce an edge:
23
From Map Coloring to Graph Coloring
4/20/2020 Graph Theory
Map not 2-colorable, so dual graph not 2-colorable:
24
From Map Coloring to Graph Coloring
4/20/2020 Graph Theory
Map not 3-colorable, so graph not 3-colorable:
25
From Map Coloring to Graph Coloring
4/20/2020 Graph Theory
Map is 4-colorable, so Graph as well:
26
From Map Coloring to Graph Coloring
4/20/2020 Graph Theory
Coloring regions is equivalent to coloring vertices of graph.
27
From Map Coloring to Graph Coloring
4/20/2020 Graph Theory
284/20/2020 Graph Theory
Poll Question#2: Every bipartite graph is 2-colorable. ?
A. Yes
B. No
4/20/2020 Graph Theory 29
Poll Question#3: Every 2-colorable graph is a bipartite graph.?
A. Yes
B. No
A graph is bipartite graph iff it is 2 – colorable.
Some facts about Graph Coloring
4/20/2020 Graph Theory 30
• x(G) <= |V|
• If some subgraph requires some K colors then
x(G) >= |K|
• x(G) = maximum (x(C) | C is connected component in G)
Graph Coloring Problem
Suppose, want to schedule some final exams for CS courses with
following course codes:
1007, 3137, 3157, 3203, 3261, 4115, 4118, 4156
Suppose also that there are no common students in the following
pairs of courses because of prerequisites:
1007-3157, 3137-3157
1007-3203
1007-3261, 3137-3261, 3203-3261
1007-4115, 3137-4115, 3203-4115, 3261-4115
1007-4118, 3137-4118
1007-4156, 3137-4156, 3157-4156
How many exam slots are necessary to schedule exams?
314/20/2020 Graph Theory
•Turn this exam scheduling problem into a graph
coloring problem.
•Here, vertices are courses,
V1->1007, V2->3137, V3->3157, V4->3203, V5-
>3261, V6->4115, V7->4118, V8->4156
•And edges are the courses which cannot be scheduled
simultaneously because of possible students in
common i.e.
1007-3157, 3137-3157
1007-3203
1007-3261, 3137-3261, 3203-3261
1007-4115, 3137-4115, 3203-4115, 3261-4115
1007-4118, 3137-4118
1007-4156, 3137-4156, 3157-4156
4/20/2020 Graph Theory 32
4/20/2020 33
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
One way to do this is to put edges down where students
mutually excluded…
4/20/2020 34
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
…and then compute the complementary graph:
4/20/2020 35
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
Redraw:
4/20/2020 36
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
Not 1-colorable because of this edge
4/20/2020 37
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
Not 2-colorable because of this triangle
4/20/2020 38
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
Is 3-colorable. Try to color by Red, Green, Gray.
4/20/2020 39
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
V4->3203-Red, V3->3157-Gray, V7->4118-Green:
4/20/2020 40
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
So V8->4156 and V5->3261 must be Gray and Red
resp.
4/20/2020 41
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
So V6->4115 must be Red.
4/20/2020 42
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
V2->3137 and V1->1007 are easy to color.
4/20/2020 43
1007
3137
3157
3203
4115
3261
4156
4118
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
So need 3 exam slots:
4/20/2020 44
1007
3137
3157
3203
4115
3261
4156
4118
Slot 1
Slot 2
Slot 3
Graph Theory
V1
V2
V3
V4
V6
V5
V8
V7
Homework#1: Flight Gates
flights need gates, but times
overlap.
how many gates needed?
122
145
67
257
306
99
Flights
time
4/20/2020 Graph Theory 45
Conflict Graph
99
145
306
Needs gate at same time
• Each vertex represents a flight
• Each edge represents a conflict
4/20/2020 Graph Theory 46
257
67
9
145
306
122
Graph Colouring
There is a k-colouring in this graph iff the flights can be
scheduled using k gates.
=> If there is a schedule, the flights scheduled at the same gate
have no conflict, and so we can colour the graph by using one
colour for flights in each gate.
<= If there is a graph colouring, then the vertices using each
colour have no conflict, and so we can schedule the flights
having the same colour in one gate.4/20/2020 Graph Theory 47
257, 67
122,145
99
306
4 colors
4 gates
assign
gates:
257
67
99
145
306
122
Colouring the Vertices
4/20/2020 Graph Theory 48
Better Colouring
3 colors
3 gates
257
67
99
145
306
122
4/20/2020 Graph Theory 49
Homework#2: Final Exams
subjects conflict if student takes both,
so need different time slots.
how short an exam period?
Each vertex is a course, two courses have an edge
if there is a conflict.
The graph has a k-colouring if and only
if the exams can be scheduled in k days.
4/20/2020 Graph Theory 50
Homework#3: Frequency Assignment
Assign minimum number of frequencies to radio
stations to avoid interference.
4/20/2020 Graph Theory 51
Homework#4: Register Allocation
• Given a program, we want to execute it as quick as possible.
• Calculations can be done most quickly if the values are stored
in registers.
• But registers are very expensive, and there are only a few in a
computer.
• Therefore we need to use the registers efficiently.
4/20/2020 Graph Theory 52
• Each node is a variable.
• Two variables have a conflict if they cannot be put into the
same register.
a and b cannot use the same register, because they store
different values. c and d cannot use the same register
otherwise the value of c is overwritten.
Each colour corresponds to a register.
4/20/2020 Graph Theory 53

More Related Content

PPTX
Customer journey an example - ikea
Geert Stox
 
PPTX
Metabical Case Study Analysis
andynbg2
 
PPT
Cap07 Desenvolvimento De EstratéGias De Marketing Parte 1 Michel
HR MERCANTIL
 
PPT
Nivea Case Study
Tarun Arya
 
PPTX
Castrol india limited(1)
NoopurNarang1
 
PDF
Dove evolution of a brand
Sameer Mathur
 
PPTX
Ikea advertising strategies
Anu Damodaran
 
PDF
ITC Sales Force Management
Muhammed Abdulla N C
 
Customer journey an example - ikea
Geert Stox
 
Metabical Case Study Analysis
andynbg2
 
Cap07 Desenvolvimento De EstratéGias De Marketing Parte 1 Michel
HR MERCANTIL
 
Nivea Case Study
Tarun Arya
 
Castrol india limited(1)
NoopurNarang1
 
Dove evolution of a brand
Sameer Mathur
 
Ikea advertising strategies
Anu Damodaran
 
ITC Sales Force Management
Muhammed Abdulla N C
 

What's hot (20)

PPTX
Ariel vs Surf excel Brand comparison.
Sagar Srivastava
 
PPTX
Parle g
Vishwa Bhaskar
 
PPTX
London olympics 2012
Ramkiran Nanduri
 
DOCX
Executive summary brand Management: Virgin
Subhi Pradhan
 
PPT
Omnitel Pronto Italia
Navin Bafna
 
PPTX
The Walt Disney: The Entertainment King
Anuj Poddar
 
PPTX
ERS Case Study: HCLT develops a next generation in-flight entertainment syst...
HCL Technologies
 
PPTX
IKEA
Fenella Andrade
 
PPTX
Asian paints canvas daily maar-cutting_iimk
Arnab Guha Mallik
 
PPTX
Nivea
Abhishek Yadav
 
PPTX
TiVo Presentation
mikerpitt
 
PDF
Mountain Man Brewing Company: Case Analysis
Shashank Srivastava
 
PPTX
Dockers mba case study
University of Texas at Dallas
 
PPTX
Pharmasim final presentation
AuT Tanwichit
 
PDF
Case Study On Asian Paints.pdf
SiluSubudhi
 
PPTX
Harley Davidson Case Study - Building Brand Communities
Carmen Neghina
 
PPT
Brand positioning
gyaanmasti
 
PDF
Case analysis of EMC
M.Atchai Viknesh
 
PPTX
Presentation on Rural Marketing -Colgate
Sagar Sawant
 
PDF
The fashion channel
Karthik Yadav
 
Ariel vs Surf excel Brand comparison.
Sagar Srivastava
 
London olympics 2012
Ramkiran Nanduri
 
Executive summary brand Management: Virgin
Subhi Pradhan
 
Omnitel Pronto Italia
Navin Bafna
 
The Walt Disney: The Entertainment King
Anuj Poddar
 
ERS Case Study: HCLT develops a next generation in-flight entertainment syst...
HCL Technologies
 
Asian paints canvas daily maar-cutting_iimk
Arnab Guha Mallik
 
TiVo Presentation
mikerpitt
 
Mountain Man Brewing Company: Case Analysis
Shashank Srivastava
 
Dockers mba case study
University of Texas at Dallas
 
Pharmasim final presentation
AuT Tanwichit
 
Case Study On Asian Paints.pdf
SiluSubudhi
 
Harley Davidson Case Study - Building Brand Communities
Carmen Neghina
 
Brand positioning
gyaanmasti
 
Case analysis of EMC
M.Atchai Viknesh
 
Presentation on Rural Marketing -Colgate
Sagar Sawant
 
The fashion channel
Karthik Yadav
 
Ad

Similar to Farhna shaikh webinar_graphcoloring (20)

PDF
A study-of-vertex-edge-coloring-techniques-with-application
Ijcem Journal
 
PPT
Graph Coloring : Greedy Algorithm & Welsh Powell Algorithm
Priyank Jain
 
PPT
GRAPH COLORING AND ITS APPLICATIONS
Manojit Chakraborty
 
PPT
Graph colouring
Priyank Jain
 
PDF
Graph Coloring and Its Implementation
IJARIIT
 
PPTX
coloring.pptx
BhanuCharan9
 
PPT
coloring.ppt
BhanuCharan9
 
PPT
Graph coloring with back tracking aoa.ppt
ssuseraf60311
 
PPT
coloring_Graph.ppt
AggarwalShailja
 
PPTX
Module 5 - GraphColoring hoeyo colr grafh.pptx
lomic31750
 
PPTX
Module 5 - GraphColo blhyhfhuufring.pptx
lomic31750
 
PPTX
Graph coloring Algorithm
আদনান ফিরোজ
 
PDF
An FPT Algorithm for Maximum Edge Coloring
Neeldhara Misra
 
PPTX
Graph coloring
Rashika Ahuja
 
PPTX
Graph Coloring
Dr. Abdul Ahad Abro
 
PPT
Coloring graphs
Vikas Sharma
 
PPTX
Graph coloring
Barani Tharan
 
PPTX
Graph Coloring Algorithm.pptx
ImaanIbrar
 
PPTX
graph coloring back tracking and applications in realA time.pptx
jhansirani64003
 
PDF
Graph Coloring
Chetanmalviya8
 
A study-of-vertex-edge-coloring-techniques-with-application
Ijcem Journal
 
Graph Coloring : Greedy Algorithm & Welsh Powell Algorithm
Priyank Jain
 
GRAPH COLORING AND ITS APPLICATIONS
Manojit Chakraborty
 
Graph colouring
Priyank Jain
 
Graph Coloring and Its Implementation
IJARIIT
 
coloring.pptx
BhanuCharan9
 
coloring.ppt
BhanuCharan9
 
Graph coloring with back tracking aoa.ppt
ssuseraf60311
 
coloring_Graph.ppt
AggarwalShailja
 
Module 5 - GraphColoring hoeyo colr grafh.pptx
lomic31750
 
Module 5 - GraphColo blhyhfhuufring.pptx
lomic31750
 
Graph coloring Algorithm
আদনান ফিরোজ
 
An FPT Algorithm for Maximum Edge Coloring
Neeldhara Misra
 
Graph coloring
Rashika Ahuja
 
Graph Coloring
Dr. Abdul Ahad Abro
 
Coloring graphs
Vikas Sharma
 
Graph coloring
Barani Tharan
 
Graph Coloring Algorithm.pptx
ImaanIbrar
 
graph coloring back tracking and applications in realA time.pptx
jhansirani64003
 
Graph Coloring
Chetanmalviya8
 
Ad

Recently uploaded (20)

PPTX
EE3303-EM-I 25.7.25 electrical machines.pptx
Nagen87
 
PDF
Queuing formulas to evaluate throughputs and servers
gptshubham
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Hyogeun Oh
 
PPTX
22PCOAM21 Session 2 Understanding Data Source.pptx
Guru Nanak Technical Institutions
 
PDF
Software Testing Tools - names and explanation
shruti533256
 
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
PDF
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PPT
Lecture in network security and mobile computing
AbdullahOmar704132
 
PPTX
easa module 3 funtamental electronics.pptx
tryanothert7
 
PDF
flutter Launcher Icons, Splash Screens & Fonts
Ahmed Mohamed
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PDF
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PPTX
Inventory management chapter in automation and robotics.
atisht0104
 
EE3303-EM-I 25.7.25 electrical machines.pptx
Nagen87
 
Queuing formulas to evaluate throughputs and servers
gptshubham
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
Introduction to Data Science: data science process
ShivarkarSandip
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Hyogeun Oh
 
22PCOAM21 Session 2 Understanding Data Source.pptx
Guru Nanak Technical Institutions
 
Software Testing Tools - names and explanation
shruti533256
 
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Lecture in network security and mobile computing
AbdullahOmar704132
 
easa module 3 funtamental electronics.pptx
tryanothert7
 
flutter Launcher Icons, Splash Screens & Fonts
Ahmed Mohamed
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
Inventory management chapter in automation and robotics.
atisht0104
 

Farhna shaikh webinar_graphcoloring

  • 1. •Graph Coloring 1 Given a graph, colour all the vertices so that two adjacent vertices get different colours. 4/20/2020 Graph Theory
  • 2. 2 A B C G1 4/20/2020 Graph Theory A B C 1 A B C 2 1 3- colorable graph A B C 1 2 3
  • 3. Definition of Colorable Let n be a positive number. A simple graph is n - colorable if the vertices can be colored using n colors so that no two adjacent vertices have the same color. 34/20/2020 Graph Theory
  • 5. 5 2- colorable graph 4/20/2020 Graph Theory A B D C A B D C A B D C
  • 6. Optimal Colouring What graphs have chromatic number one? when there are no edges… What graphs have chromatic number 2? A path? A cycle? A triangle? What graphs have chromatic number larger than 2? Definition: min #colors for G is chromatic number, x(G) 4/20/2020 Graph Theory 6
  • 7. Simple Cycles even(C 2) = odd(C 3) = 4/20/2020 Graph Theory 7
  • 8. n n(K ) = Complete Graphs 4/20/2020 Graph Theory 8
  • 9. even(W 3) =odd(W 4) = 5W Wheels 4/20/2020 Graph Theory 9
  • 10. 10 P Q RS T ? - colorable graph Poll Question#1: What is the chromatic number of above graph? A. 2 B. 3 C. 4 D. 5 4/20/2020 Graph Theory
  • 11. Graph Coloring Problem Consider a fictional continent. 114/20/2020 Graph Theory
  • 12. Map Coloring •Suppose removed all borders but still wanted to see all the countries. •1 color insufficient. 124/20/2020 Graph Theory
  • 13. 134/20/2020 Graph Theory So add another color. Try to fill in every country with one of the two colors.
  • 17. •PROBLEM: Two adjacent countries forced to have same color. Border unseen. 174/20/2020 Graph Theory
  • 18. •So add another color: 184/20/2020 Graph Theory
  • 19. •Insufficient. Need 4 colors because of this country. 194/20/2020 Graph Theory
  • 20. •With 4 colors, could do it. 204/20/2020 Graph Theory
  • 21. From Map Coloring to Graph Coloring The problem of coloring a map, can be reduced to a graph-theoretic problem: 214/20/2020 Graph Theory
  • 22. For each region introduce a vertex: 22 From Map Coloring to Graph Coloring 4/20/2020 Graph Theory
  • 23. For each pair of regions with a positive-length common border introduce an edge: 23 From Map Coloring to Graph Coloring 4/20/2020 Graph Theory
  • 24. Map not 2-colorable, so dual graph not 2-colorable: 24 From Map Coloring to Graph Coloring 4/20/2020 Graph Theory
  • 25. Map not 3-colorable, so graph not 3-colorable: 25 From Map Coloring to Graph Coloring 4/20/2020 Graph Theory
  • 26. Map is 4-colorable, so Graph as well: 26 From Map Coloring to Graph Coloring 4/20/2020 Graph Theory
  • 27. Coloring regions is equivalent to coloring vertices of graph. 27 From Map Coloring to Graph Coloring 4/20/2020 Graph Theory
  • 28. 284/20/2020 Graph Theory Poll Question#2: Every bipartite graph is 2-colorable. ? A. Yes B. No
  • 29. 4/20/2020 Graph Theory 29 Poll Question#3: Every 2-colorable graph is a bipartite graph.? A. Yes B. No A graph is bipartite graph iff it is 2 – colorable.
  • 30. Some facts about Graph Coloring 4/20/2020 Graph Theory 30 • x(G) <= |V| • If some subgraph requires some K colors then x(G) >= |K| • x(G) = maximum (x(C) | C is connected component in G)
  • 31. Graph Coloring Problem Suppose, want to schedule some final exams for CS courses with following course codes: 1007, 3137, 3157, 3203, 3261, 4115, 4118, 4156 Suppose also that there are no common students in the following pairs of courses because of prerequisites: 1007-3157, 3137-3157 1007-3203 1007-3261, 3137-3261, 3203-3261 1007-4115, 3137-4115, 3203-4115, 3261-4115 1007-4118, 3137-4118 1007-4156, 3137-4156, 3157-4156 How many exam slots are necessary to schedule exams? 314/20/2020 Graph Theory
  • 32. •Turn this exam scheduling problem into a graph coloring problem. •Here, vertices are courses, V1->1007, V2->3137, V3->3157, V4->3203, V5- >3261, V6->4115, V7->4118, V8->4156 •And edges are the courses which cannot be scheduled simultaneously because of possible students in common i.e. 1007-3157, 3137-3157 1007-3203 1007-3261, 3137-3261, 3203-3261 1007-4115, 3137-4115, 3203-4115, 3261-4115 1007-4118, 3137-4118 1007-4156, 3137-4156, 3157-4156 4/20/2020 Graph Theory 32
  • 34. One way to do this is to put edges down where students mutually excluded… 4/20/2020 34 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 35. …and then compute the complementary graph: 4/20/2020 35 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 37. Not 1-colorable because of this edge 4/20/2020 37 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 38. Not 2-colorable because of this triangle 4/20/2020 38 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 39. Is 3-colorable. Try to color by Red, Green, Gray. 4/20/2020 39 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 40. V4->3203-Red, V3->3157-Gray, V7->4118-Green: 4/20/2020 40 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 41. So V8->4156 and V5->3261 must be Gray and Red resp. 4/20/2020 41 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 42. So V6->4115 must be Red. 4/20/2020 42 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 43. V2->3137 and V1->1007 are easy to color. 4/20/2020 43 1007 3137 3157 3203 4115 3261 4156 4118 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 44. So need 3 exam slots: 4/20/2020 44 1007 3137 3157 3203 4115 3261 4156 4118 Slot 1 Slot 2 Slot 3 Graph Theory V1 V2 V3 V4 V6 V5 V8 V7
  • 45. Homework#1: Flight Gates flights need gates, but times overlap. how many gates needed? 122 145 67 257 306 99 Flights time 4/20/2020 Graph Theory 45
  • 46. Conflict Graph 99 145 306 Needs gate at same time • Each vertex represents a flight • Each edge represents a conflict 4/20/2020 Graph Theory 46
  • 47. 257 67 9 145 306 122 Graph Colouring There is a k-colouring in this graph iff the flights can be scheduled using k gates. => If there is a schedule, the flights scheduled at the same gate have no conflict, and so we can colour the graph by using one colour for flights in each gate. <= If there is a graph colouring, then the vertices using each colour have no conflict, and so we can schedule the flights having the same colour in one gate.4/20/2020 Graph Theory 47
  • 48. 257, 67 122,145 99 306 4 colors 4 gates assign gates: 257 67 99 145 306 122 Colouring the Vertices 4/20/2020 Graph Theory 48
  • 49. Better Colouring 3 colors 3 gates 257 67 99 145 306 122 4/20/2020 Graph Theory 49
  • 50. Homework#2: Final Exams subjects conflict if student takes both, so need different time slots. how short an exam period? Each vertex is a course, two courses have an edge if there is a conflict. The graph has a k-colouring if and only if the exams can be scheduled in k days. 4/20/2020 Graph Theory 50
  • 51. Homework#3: Frequency Assignment Assign minimum number of frequencies to radio stations to avoid interference. 4/20/2020 Graph Theory 51
  • 52. Homework#4: Register Allocation • Given a program, we want to execute it as quick as possible. • Calculations can be done most quickly if the values are stored in registers. • But registers are very expensive, and there are only a few in a computer. • Therefore we need to use the registers efficiently. 4/20/2020 Graph Theory 52
  • 53. • Each node is a variable. • Two variables have a conflict if they cannot be put into the same register. a and b cannot use the same register, because they store different values. c and d cannot use the same register otherwise the value of c is overwritten. Each colour corresponds to a register. 4/20/2020 Graph Theory 53