40
Parallel Graph Coloring 1

Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

Parallel Graph Coloring

1

Page 2: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

●Graph coloring problem is to assign colors to certain elements of a graph subject to certain constraints. ●Vertex coloring is the most common graph coloring problem. The problem is, given m colors, find a way of coloring the vertices of a graph such that no two adjacent vertices are colored using same color.

What is Graph Coloring?

2

Page 3: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

Origin of the problem

3

Page 4: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

Origin of the problem

4

Page 5: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

a valid coloring with colors

Example:

5

Page 6: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

Chromatic number : The smallest number of colors that can be used to give a valid coloring in graph

NP Complete!!!

6

Page 7: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

7

Sequential -coloring

For any graph there is a -coloring

Therefore,

Page 8: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

8

1. Pick an uncolored node 2. Let be an available color (from ‘s palette)

(such a color always exists) 3. Color node with color 4. Mark as unavailable in the color palette of every neighbor of

Sequential Coloring Algorithm

Repeat:

Until all nodes are colored

Mark all entries in the palettes of all the nodes as available

Page 9: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

9

Example coloring

Page 10: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

10

Coloring and MIS

Independent Set

In a valid coloring, the nodes of same color form an independent set

Page 11: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

11

However, the independent set may not be maximal:

New Independent set (Maximal)

Page 12: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

12

Vertex Coloring is reduced to MIS

Consider an uncolored graph

Repeat:

Coloring algorithm for using MIS:

Find a MIS in the uncolored nodes; Assign color to each node in MIS;

Until every node is colored;

Page 13: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

13

Example:

initially, all nodes are uncolored

Page 14: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

14

Iteration 1: Find an MIS of the uncolored nodes and give to the nodes color

Page 15: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

15

Iteration 2: Find an MIS of the uncolored nodes and give to the nodes color

Page 16: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

16

Iteration 3: Find an MIS of the uncolored nodes and give to the nodes color

Page 17: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

17

( is the number of nodes)

A Simple Randomized -Coloring Algorithm

•Randomized Algorithm

Running time:

with high probability

•Parallel Algorithm

Page 18: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

18

Each node has a palette with colors

Initially all colors in palette are available

Palette of node

Page 19: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

19

The algorithm works in phases

At the beginning of a phase, there are two kinds of nodes:

colored uncolored

Page 20: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

20

Algorithm for node Repeat (iteration = phase)

Pick a color uniformly at random from available palette colors;

Send color to neighbors; If (some neighbor chose same color )

Then Reject color ; Else Accept color ;

Inform neighbors about color ; (so that they mark color as unavailable)

Until color is accepted;

Page 21: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

21

Example execution

Page 22: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

22

Phase 1: (iteration 1 of synchronous exectution)

Nodes pick random colors

Page 23: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

23

Successful Colors

Page 24: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

24

Phase 2: (iteration 2)

Nodes pick random colors

Page 25: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

25

Successful Colors

Page 26: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

26

Phase 3: (iteration 3)

Nodes pick random colors

Page 27: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

27

End of execution

Page 28: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

28

A Randomized -Coloring Algorithm

•Randomized Algorithm

•Parallel Algorithm

Running time: with high probability

(similar with the -coloring algorithm, but now the color palette size is )

Page 29: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

29

Each node has a palette with colors

Initially all colors in palette are available

Palette of node

(Recall: is the node’s degree)

Page 30: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

30

: uncolored neighbors of

Example:

At the beginning of a phase:

: uncolored degree of

Page 31: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

31

Algorithm for node Repeat

Pick a color uniformly at random from available palette colors;

Send color to neighbors; If (some neighbor with chose same color )

Then Reject color ; Else Accept color ;

Inform neighbors about color ; (so that they mark color as unavailable)

Until color is accepted;

(iteration = phase)

Page 32: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

32

Example execution

Page 33: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

33

Phase 1: (iteration 1)

Nodes pick random colors

Page 34: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

34

For this phase, uncolored degree = degree

Conflicts

The nodes of higher uncolored degree win

Page 35: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

35

Successful colors

Page 36: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

36

Phase 2: (iteration 2)

Nodes pick random colors

Page 37: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

37

Conflicts

The nodes of higher uncolored degree win

Page 38: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

38

Successful colors

Page 39: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

39

Phase 3: (iteration 3)

Nodes pick random colors

Page 40: Parallel Graph Coloring - City University of New Yorkgu/teaching/courses/csc76010/slides/Graphic... · Graph coloring problem is to assign colors to certain elements of a graph subject

40

Successful colors

End of execution