Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.

Slides:



Advertisements
Similar presentations
CS 336 March 19, 2012 Tandy Warnow.
Advertisements

Great Theoretical Ideas in Computer Science for Some.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Bayesian Networks, Winter Yoav Haimovitch & Ariel Raviv 1.
Introduction to Graphs
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Approximation, Chance and Networks Lecture Notes BISS 2005, Bertinoro March Alessandro Panconesi University La Sapienza of Rome.
Introduction to Graph Theory Lecture 11: Eulerian and Hamiltonian Graphs.
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Planar / Non-Planar Graphs Gabriel Laden CS146 – Spring 2004 Dr. Sin-Min Lee.
GRAPH COLORING AND ALLOTTING GATES FOR FLIGHTS PRESENTED BY AMUKTAMALYADA REDDY JAMBULA.
GOLOMB RULERS AND GRACEFUL GRAPHS
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Introduction to Approximation Algorithms Lecture 12: Mar 1.
Computational Geometry Seminar Lecture 1
Vertex Cover, Dominating set, Clique, Independent set
Graphs and Trees This handout: Trees Minimum Spanning Tree Problem.
Graph Colouring Lecture 20: Nov 25.
CSE 421 Algorithms Richard Anderson Lecture 4. What does it mean for an algorithm to be efficient?
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Coloring Algorithms and Networks. Coloring2 Graph coloring Vertex coloring: –Function f: V  C, such that for all {v,w}  E: f(v)  f(w) Chromatic number.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
Graph Theory Ch.5. Coloring of Graphs 1 Chapter 5 Coloring of Graphs.
The Art Gallery Problem
Graph Coloring.
Coloring 3/16/121. Flight Gates flights need gates, but times overlap. how many gates needed? 3/16/122.
9.8 Graph Coloring. Coloring Goal: Pick as few colors as possible so that two adjacent regions never have the same color. See handout.
C&O 355 Mathematical Programming Fall 2010 Lecture 17 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA A.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Graph Theory Topics to be covered:
Lecture 22 More NPC problems
Edge-disjoint induced subgraphs with given minimum degree Raphael Yuster 2012.
Approximation Algorithms
Data Structures & Algorithms Graphs
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Planar Graphs Graph Coloring
Graph Colouring Lecture 20: Nov 25. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including.
Planar Graphs Lecture 10: Oct 21. This Lecture Today we will talk about planar graphs, and how to color a map using 6 colors. Planar graphs Euler’s formula.
Introduction to Graphs. This Lecture In this part we will study some basic graph theory. Graph is a useful concept to model many problems in computer.
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
Matching Lecture 19: Nov 23.
Introduction to Graph Theory
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 3.
Introduction to Graph Theory
Great Theoretical Ideas in Computer Science for Some.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
1 Distributed Vertex Coloring. 2 Vertex Coloring: each vertex is assigned a color.
C&O 355 Lecture 19 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A A A A A.
COMPSCI 102 Introduction to Discrete Mathematics.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Proof of correctness of Dijkstra’s algorithm: Basically, we need to prove two claims. (1)Let S be the set of vertices for which the shortest path from.
Xuding Zhu National Sun Yat-sen University Circular chromatic index.
Trees.
Timetable Problem solving using Graph Coloring
Graphs. Representations of graphs : undirected graph An undirected graph G have five vertices and seven edges An adjacency-list representation of G The.
Planar Graphs Hubert Chan (Chapter 9.7) [O2 Proof Techniques]
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Bipartite Matching Lecture 8: Oct 7.
Algorithms and Networks
CSE 421: Introduction to Algorithms
The Art Gallery Problem
Instructor: Shengyu Zhang
Richard Anderson Autumn 2016 Lecture 7
Discrete Mathematics for Computer Science
Presentation transcript:

Graph Colouring L09: Oct 10

This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous 4-color problem. Graph Colouring Applications Some Positive Results

Graph Colouring Graph Colouring Problem: Given a graph, colour all the vertices so that two adjacent vertices get different colours. Objective: use minimum number of colours. 3-colourable

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,  (G)

Simple Cycles

Complete Graphs A graph is a complete graph if there is an edge between every pair of vertices. Sometimes we denote a complete graph of n vertices by K n.

Wheels

Trees Pick any vertex as “root.” if (unique) path from root is even length: odd length: root Can prove more formally using induction.

2-Colourable Graphs When exactly is a graph 2-colourable? This is 2-colourable. 2 colourable: tree, even cycle, etc. Not 2 colourable: triangle, odd cycle, etc.

Bipartite Graphs When exactly is a graph 2-colourable? Is a bipartite graph 2-colourable? Is a 2-colourable graph bipartite? Fact. A graph is 2-colourable if and only if it is bipartite.

Bipartite Graphs When exactly is a graph bipartite? Can a bipartite graph has an odd cycle? If a graph does not have an odd cycle, then it is bipartite? NO

Bipartite Graphs When exactly is a graph bipartite? If a graph does not have an odd cycle, then it is bipartite? 1.The idea is like colouring a tree. 2.Pick a vertex v, colour it red. 3.Colour all its neighbour green. 4.Colour all neighbours of green vertices red 5.Repeat until all vertices are coloured. No such edge because no triangle Theorem. A graph is bipartite if and only if it has no odd cycle. No such edge because no 5-cycle

Chromatic Number How do we estimate the chromatic number of a graph? If there is a complete subgraph of size k, then we need at least k colours? YES Is the converse true? If a graph has no complete subgraph of size 4, then we can colour it using 4 colours? NO

Chromatic Number Let ω(G) be the largest complete subgraph that G contains.  (G) >= ω(G) because we need at least ω(G) colors to color that complete subgraph. Then, In general,  (G) could be larger than ω(G) as we have seen an example. Even worse, there are graphs with ω(G)=2 (i.e. no triangles), but  (G) could be arbitrarily large (e.g. at least one billion). So ω(G) is not a good estimate of the chromatic number  (G).

Working for the King, Take 2 Suppose the King is hiring someone to 3-color a graph. If you could find a 3-coloring of the graph, then you can show in to the King. But suppose the graph is not 3-colorable, how can you convince the King? Sometimes, when you are lucky, you can convince the King by showing that there is a complete subgraph of size 4 and so the graph is not 3-colourable. However, it could be the case that there is such complete subgraph of size 4 and still the graph is not 3-colorable. What could you do? In general, no one in the world knows a “concise” way to convince the King that a graph is not 3-colourable, and it fact it is believed that no such “concise proof” exists. This is in contrast to the situation for the perfect matching problem. And this is related to the P vs NP problem (CSC 3160). To conclude, if the King does not have a good temper, then my best advice is not to work for the King on the 3-colouring problem; otherwise you may be killed because the King thought that you are useless.

What’s Next? No one knows how to find an optimal coloring efficiently. In fact, this is an NP-complete problem, and many researchers believe that such an efficient algorithm does not exist (CSC 3160). Also, no one knows a “concise” necessary and sufficient condition for k-colorability. So why are we still studying this problem? This problem is still interesting for two reasons: 1)It captures many seemingly different problems as you will see. 2)In some important special cases, we have interesting results, e.g. - we can 4-color a map (next lecture) - in some cases we can prove that  (G) = ω(G) (this lecture).

This Lecture Graph colouring Applications Some Positive Results

Application 1: Flight Gates flights need gates, but times overlap. how many gates needed? Flights time

Conflict Graph If two flights need a gate at same time, then we draw an edge. Each vertex represents a flight, and each edge represents a conflict.

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. Idea: each color represents a gate.

257, , colors 4 gates assign gates: Colouring the Vertices

Better Colouring 3 colors 3 gates

Application 2: Exam Scheduling subjects conflict if student takes both, so need different time slots. how short an exam period? This is a graph colouring problem. 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.

M 9am M 1pm T 9am T 1pm assign times: 4 time slots (best possible) Graph Colouring

Application 3: Register Allocation Given a program, we want to execute it as quickly 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. This is a graph colouring problem.

Application 3: Register Allocation Each vertex 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.

More about Applications The examples we have seen are just some sample applications of graph coloring. The proofs are not very formal, but hope you can get the main idea. To model a problem as a graph coloring problem, a standard recipe is to think of your resource (e.g. gates, time slots, registers) as colors, each object as a vertex, and each edge as a conflict. Then, using minimum number of colors to color all the nodes is equivalent to using minimum amount of resource for all the objects so that there would be no conflicts.

This Lecture Graph colouring Applications Some Positive Results

Maximum Degree Suppose every vertex is of degree at most d. How many colors we need to color this graph? For an uncolored vertex v, it has at most d neighbors, and thus at most d different colors. So, if we have d+1 colors, then we can always color it, by choosing a color not in its neighbors. v In other words, given an arbitrary ordering of the vertices, we can color them one by one using at most d+1 colors.

Maximum Degree Fact. Given a graph with maximum degree d, one can color it using at most d+1 colors. Note that it is just a sufficient condition, but far from necessary. For example, a tree could have large maximum degree, but we can color it using only two colors. Can we generalize the following argument? “Given an arbitrary ordering of the vertices, we can color them one by one using at most d+1 colors.” Idea: find a good ordering.

Maximum Degree Ordering Claim. Suppose there is an ordering of the vertices v 1, …, v n, such that each vertex has at most d neighbors in front. Then the graph can be colored by d+1 colors. Proof. We color the vertices one by one following the ordering. When we color vertex v i, at most d neighbors of v i are colored. Since we have d+1 colors, we can always color v i using a color that has not appeared in its neighbors. We can repeat this argument until every vertex is colored.

Maximum Degree Ordering Claim. Suppose there is an ordering of the vertices v 1, …, v n, such that each vertex has at most d neighbors in front. Then the graph can be colored by d+1 colors. How to construct such an ordering? Example: for a tree, always put a left at the end, and so there is such an ordering with d=1, and so we can 2-color a tree. Just pick any vertex of degree at most d, put it at the end and repeat. Idea: vertex of small degree can be colored later, after its neighbors.

Good News For some special graphs, we know exactly when they are k-colorable. Interval graphs (conflict graphs of intervals): a b c d a b c d For interval graphs, minimum number of colours need = maximum size of a complete subgraph So the “flight gate” problem and the “register allocation” can be solved.

Interval Graphs Theorem. For interval graph G,  (G) =ω(G). Recall that ω(G) denotes the largest complete subgraph that G contains, and  (G) >=ω(G) because each vertex in the complete subgraph needs a different color. So, in the following, we just need to prove that  (G) <=ω(G), by providing a coloring using at most ω(G) colors. We will do so by showing that there is always a vertex with degree at most ω(G)-1, and thus we can produce a good ordering as in previous slides.

Low Degree Vertex Lemma. In an interval graph G, there is a vertex with degree at most k-1. Proof. Let ω(G) = k. We will show that there is a vertex with degree k-1. Let v be the interval with leftmost right endpoint (earliest finishing time). Any interval that intersects v must intersect v at the right endpoint, as otherwise v is not the interval wit leftmost right endpoint. So, all the intervals that intersect v must intersect with each other, and thus they form a complete subgraph. Since ω(G) = k, this complete subgraph is of size at most k, and thus v has at most k-1 neighbors. Therefore, v is a vertex of degree at most k-1. v

Completing the Proof Lemma. In an interval graph G, there is a vertex with degree at most k-1. Theorem. For interval graph G,  (G) =ω(G). Proof of Theorem. Pick a vertex guaranteed by the Lemma. Remove this vertex (and its incident edges) from the graph. The remaining graph is still an interval graph, and is smaller. By induction, the remaining graph can be colored by k colors. Since v has degree at most k-1, we can complete the k-coloring. v

An Example Now we can solve the “flight gate” problem and the “register allocation” problem. Given the flight information First we order the intervals by their finishing time Color them in reverse order, use a color not in its neighbors Used 5 color, which is optimal; see the dotted line (can answer the King).

Quick Summary Graph coloring is an important problem in graph theory. It is useful in modeling problems in real life. And we can find an optimal coloring in some special cases. Next we talk about another special case of graph coloring, the famous map coloring problem.