22
Graph Coloring Graph Coloring

Graph Coloring. What is Graph Coloring? Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Embed Size (px)

Citation preview

Page 1: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Graph ColoringGraph Coloring

Page 2: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

What is Graph Coloring?What is Graph Coloring?

Graph Coloring is an assignment of colors Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a (or any distinct marks) to the vertices of a graph. Strictly speaking, a coloring is a graph. Strictly speaking, a coloring is a proper coloring if no two adjacent vertices proper coloring if no two adjacent vertices have the same color.have the same color.

Page 3: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Origin of the problemOrigin of the problem

Page 4: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Origin of the problemOrigin of the problem

Page 5: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Why Graph Coloring?Why Graph Coloring?

Many problems can be formulated as a Many problems can be formulated as a graph coloring problem including Time graph coloring problem including Time Tabling, Scheduling, Register Allocation, Tabling, Scheduling, Register Allocation, Channel AssignmentChannel Assignment

A lot of research has been done in this A lot of research has been done in this area so much is already known about the area so much is already known about the problem space.problem space.

Page 6: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

University schedulingUniversity scheduling

Scheduling of exams so that as little time Scheduling of exams so that as little time as possible is needed for the university to as possible is needed for the university to bbee open open

Page 7: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Channel AssignmentChannel Assignment

Find a channel assignment to R radio Find a channel assignment to R radio stations such that no station has a conflict stations such that no station has a conflict (there is a conflict if they are in vicinity)(there is a conflict if they are in vicinity)

Vertices – radio stations, edges – conflict, Vertices – radio stations, edges – conflict, colors – available channelscolors – available channels

Page 8: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Register allocationRegister allocation

Given a set of available registers, find an Given a set of available registers, find an assignment of variables to registersassignment of variables to registers

Vertices – variables, colors – registers.Vertices – variables, colors – registers.

Page 9: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

TerminologyTerminology

K-ColoringK-Coloring A k-coloring of a graph G is a mapping of A k-coloring of a graph G is a mapping of

V(G) onto the integers 1..k such that adjacent V(G) onto the integers 1..k such that adjacent vertices map into different integers.vertices map into different integers.

A k-coloring partitions V(G) into k disjoint A k-coloring partitions V(G) into k disjoint subsets such that vertices from different subsets such that vertices from different subsets have different colors.subsets have different colors.

Page 10: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

TerminologyTerminology

K-colorableK-colorable A graph G is k-colorable if it has a k-coloring.A graph G is k-colorable if it has a k-coloring.

Chromatic NumberChromatic Number The smallest integer k for which G is k-The smallest integer k for which G is k-

colorable is called the chromatic number of G.colorable is called the chromatic number of G.

Page 11: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

TerminologyTerminology

K-chromatic graphK-chromatic graph A graph whose chromatic number is k is A graph whose chromatic number is k is

called a k-chromatic graph.called a k-chromatic graph.

ColoringColoring A coloring of a graph G assigns colors to the A coloring of a graph G assigns colors to the

vertices of G so that adjacent vertices are vertices of G so that adjacent vertices are given different colorsgiven different colors

Page 12: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

ExampleExample

The chromatic number is four. Therefore this a 4-Chromatic Graph

Page 13: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

ExampleExample

Problem: A state legislature has a number Problem: A state legislature has a number of committees that meet each week for of committees that meet each week for one hour. How can we schedule the one hour. How can we schedule the committee meetings times such that the committee meetings times such that the least amount of time is used but such that least amount of time is used but such that two committees with overlapping two committees with overlapping membership do not meet at the same membership do not meet at the same time.time.

Page 14: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Example (cont)Example (cont)

The chromatic number of this graph is four. Thus four hours suffice to schedule committee meetings without conflict.

An edge represents a conflict between to meetings

An vertex represents a meeting

Page 15: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Edge ColoringEdge Coloring

Given a graph G=(V,E) how can we color Given a graph G=(V,E) how can we color the edges such that edges that share a the edges such that edges that share a vertex do not share a color.vertex do not share a color.

Page 16: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Existing ResultsExisting Results

Vizing's theoremVizing's theorem any graph with a maximum vertex degree of any graph with a maximum vertex degree of δδ

can be edge colored using at most can be edge colored using at most δ + 1δ + 1 colors. colors.

Vertex degree: number of edges entering into Vertex degree: number of edges entering into the edge.the edge.

Page 17: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Line GraphLine Graph

An Edge Coloring Problem can be An Edge Coloring Problem can be formulated as a Vertex Coloring Problem.formulated as a Vertex Coloring Problem.

Let L(G) be an auxiliary graph and G be Let L(G) be an auxiliary graph and G be the graphs which we are trying to color. the graphs which we are trying to color. L(G) contains a vertex for every edge in G. L(G) contains a vertex for every edge in G. There is an edge in L(G) drawn between There is an edge in L(G) drawn between two vertices if their associated edges in G two vertices if their associated edges in G share a vertex.share a vertex.

Page 18: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Example Example AuxiliaryAuxiliary Graph Graph

A

B

C

A

B C

Page 19: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Example Example AuxiliaryAuxiliary Graph Graph

AC

B

DE

A B

C D

E

A B

C D

EAC

B

DE

Page 20: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Approximate Colouring Approximate Colouring AlgorithmAlgorithm

Sort the verices so that Sort the verices so that degree(v(i))>=degree(v(i+1))degree(v(i))>=degree(v(i+1))

Colour v(0)Colour v(0) For i=1 to n colour v(i) so that there is no For i=1 to n colour v(i) so that there is no

clashclash Complexity O(nComplexity O(n22))

Page 21: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Maximal independent set Maximal independent set algorithmalgorithm

Problem: What is the largest subset of Problem: What is the largest subset of vertices of V such that no pair of vertices vertices of V such that no pair of vertices defines an edge of E.defines an edge of E.

Algorithm:Algorithm: Repeat until there is no vertexRepeat until there is no vertex BeginBegin Find the maximal independent set (MIS)Find the maximal independent set (MIS) Reduce the graph by MISReduce the graph by MIS EndEnd

Page 22: Graph Coloring. What is Graph Coloring?  Graph Coloring is an assignment of colors (or any distinct marks) to the vertices of a graph. Strictly speaking,

Find the MISFind the MIS

Repet until there is no vertexRepet until there is no vertex BeginBegin Select the vertex with the maximal degreeSelect the vertex with the maximal degree Include it in MIS and reduce the graph by Include it in MIS and reduce the graph by

all the adjacent nodesall the adjacent nodes EndEnd