0% found this document useful (0 votes)
318 views20 pages

PRAM Algorithm (Graph Coloring)

The document describes parallel graph coloring algorithms. It discusses how a graph coloring problem can be solved sequentially by iteratively assigning colors to vertices while ensuring no adjacent vertices have the same color. It then presents a parallel algorithm that creates a processor for every possible coloring and checks if each coloring is valid. The parallel algorithm runs in O(n^2) time where n is the number of vertices.

Uploaded by

Nilayan Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
318 views20 pages

PRAM Algorithm (Graph Coloring)

The document describes parallel graph coloring algorithms. It discusses how a graph coloring problem can be solved sequentially by iteratively assigning colors to vertices while ensuring no adjacent vertices have the same color. It then presents a parallel algorithm that creates a processor for every possible coloring and checks if each coloring is valid. The parallel algorithm runs in O(n^2) time where n is the number of vertices.

Uploaded by

Nilayan Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Parallel Graph Coloring

1
Slides adapted by S Gokul Kannan
Courtesy: Illinious State University
Presentation Overview
Problem Description
Basic Algorithm
Parallel Strategy
Performance
2
Problem Description
A "graph" is a collection of vertices or 'nodes' and a
collection of edges that connect pairs of vertices.
A k-coloring of a graph G is a mapping: c : V {0,1,,k - 1}
such that

c(i) c(j) if <i, j> E
3
Sequential Algorithm
4
The idea is to color the vertices of a graph such that
no two adjacent vertices share the same color
Sequential Algorithm -Step 1
5
Sequential Algorithm -Step 2
6
Sequential Algorithm -Step 3
7
Sequential Algorithm -Step 4
8
Sequential Algorithm -Step 5
9
Sequential Algorithm -Step 6
10
Back to step 3
11
Parallel Algorithm
12
Parallel Algorithm on CREW PRAM
Assume the graph has n vertices
Represented using an n x n adjacency matrix

Consider c colors are used (c<=n).

Create a processor for every possible coloring of the
graph.

Each processor checks if the coloring it represents is
valid.


Color a 3-vertex graph with 2 colors
Parallel Code
Parallel Code
Parallel Code
Performance Analysis
Number of comparisons done by each processor = n
2
The number of elements in the candidate array = c
n
Sum of the elements in the candidate array = O(log c
n
)
Overall Runtime complexity = O(n
2
+ logc
n
)
= O(n
2
+ nlogc)
= O(n
2
) (if c<<n)
References
R1: Section 2.3
THE END

You might also like