Graph coloring is part of graph theory ,which has great practical importance. The default graph coloring, vertex coloring means coloring of vertices of a graph in such a way that , no adjacent vertices share same colour.
The problem of coloring of a graph has several application such as scheduling, register application in compilers, frequency assignment in mobile radios , etc.
How graph coloring is possible.
The problem of coloring of a graph has several application such as scheduling, register application in compilers, frequency assignment in mobile radios , etc.
How graph coloring is possible.
- Let G=(V,E) be the graph to be colored , where V and E are vertices set and edges set respectively
- Compute the degree of each vertices in
V
- Make a list
uncolored
which holdsV
in descending order of their degrees - Initialize
currentColor
to zero - WHILE length of
uncolored
greater than zero - Initialize
first
to the first element ofuncolored
- Remove
first
fromuncolored
- Initialize
color(first)
tocurrentColor
- Initialize
coloredWithCurrent
to{first}
- FOR each vertex
v
inuncolored
- IF adjacent list of
v
andcoloredWithCurrent(currentColor)
has no common elements - Set
color(v)
tocurrentColor
- Add
v
tocoloredWithCurrent(currentColor)
- Remove
v
fromuncolored
- ENDIF
- ENDFOR
- Increment
currentColor
- ENDWHILE
I have implemented a web application based on above theory , in that we can create vertices and edges after that just click the button "color it". Click here to see my graph coloring application deployed on heroku. I used HTML 5, JavaScript and python-django for developing this. The source code link .
No comments:
Post a Comment