The link to the presentation
The problem to find chromatic number of a given graph is NP Complete
.
Actually, there is no efficient algorithm available for coloring a graph with minimum number of colors as the problem is
a known NP Complete problem There are approximate algorithms to solve the problem though.
The following pictures will show the concept of graph coloring
- Chromatic = 4
- Chromatic = 2
The time complexity of graph coloring using greedy algorithm
is O(V^2 + E)
in the worst case, and here
is the proof.
And if we use adjacency matrix
, the time complexity would be O((n+1)!
and here
is the required documentation
There exists some ways for solving this problem
even though it doesn’t guarantee to use minimum colors, but it guarantees an upper bound on the number of colors. The
basic algorithm never uses more than d+1
colors where d is the maximum degree of a vertex in the given graph.
what is adjacency matrix?
The Adjacency matrix is a simple and straightforward way of representing a graph G= (V, E)
on n = |V|
vertices, labeled
1, 2, …, n
is by using an n by n matrix.
for example:
Algorithm
- Find all the symmetric edges in one representation of (i, j) and (j, i).
- Give each vertex one color for initialization.
- For coloring, visit each vertex and check each adjacent vertice connected on that vertex if the color is the same as the current vertex and adjacent vertex. If the colors are the same, then change the color. Like the following picture: