1 / 13

Graph Coloring Solution in a Deterministic Machine

Graph Coloring Solution in a Deterministic Machine. Hamid Bahravan. The deterministic solution to coloring problem uses these steps to assign colors to vertices:.

cicada
Download Presentation

Graph Coloring Solution in a Deterministic Machine

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Graph Coloring Solution in a Deterministic Machine HamidBahravan • The deterministic solution to coloring problem uses these steps to assign colors to vertices: 1- Given a Graph G=(V, E) and Set of Colors C = { C 1,C2,C3,C4...Cn}. Sort the vertices in non-decreasing order of their Node degree. 2- Make a List of Available Colors to each Vertex. Initially all colors are available to all vertices. 3- From the list of sorted vertices, choose the first unassigned vertex and assign it the first available Color and remove that color from list of available colors to all its neighbors. 4- Repeat Step 3 till no vertex remains unassigned.

  2. Graph Coloring Solution in a Deterministic Machine Example: Consider the Graph with its adjacency matrix given below.  Available Colors C = { Red, Green, Blue, Yellow } 1 2 4 Adjacency Matrix of the Graph 5 3

  3. Graph Coloring Solution in a Deterministic Machine Step 1: Sorting Vertices based on their Node Degree. The vertices after sorting in non-decreasing order of their node degree are : { V3,V2,V5,V1,V4 } Step 2: So we start with V3 and assign the first color Red to it, then all V2,V5,V1 and V4 can not use Red. We construct a table to reflect this. • * Indicates – vertex is assigned that color. • Indicates – vertex can’t use that color. •  Empty Cell Indicates that color is available.

  4. Graph Coloring Solution in a Deterministic Machine 1 2 4 5 3

  5. Graph Coloring Solution in a Deterministic Machine Step 3: Doing the same process with other vertices. Now, it is the turn of V2 and from the above table it is clear that V2 can not use Red so it takes the first available color Green, making the table look like below. Since V1,V3 and V 5 are adjacent to V2 they can not use Green so we mark them with - sign.

  6. Graph Coloring Solution in a Deterministic Machine 1 2 4 5 3

  7. Graph Coloring Solution in a Deterministic Machine Now, when it comes to V5 it has -marks in Red and Green, so it has to take Blue. After assigning Blue to V5 the table would be as shown below. Since V3 is connected to V1,V2,V4 and V5 all are marked with- for Blue correspondingly.

  8. Graph Coloring Solution in a Deterministic Machine 1 2 4 5 3

  9. Graph Coloring Solution in a Deterministic Machine In the next step, the Vertex V1 has got two available colors (Blue, Yellow) and one not yet assigned neighbor (vertex V4) which can not take Blue. Its other adjacent vertices V2 and V3 have already been assigned some colors and need not be cared. So the vertex V1 from its available colors Blue and Yellow, gets the color Blue. Tip: We are always looking for the less number of colors. So Blue wins Yellow here!

  10. Graph Coloring Solution in a Deterministic Machine 1 2 4 5 3

  11. Graph Coloring Solution in a Deterministic Machine For the last vertex V4, it can take neither Red nor Blue, but it can take Green or Yellow. Since it has no not-yet assigned neighbors it takes the first available color, that is Green. And its adjacent V 3 and V5 have already been marked with -for Green. Tip: We are always looking for the less number of colors. So Green wins Yellow here!

  12. Graph Coloring Solution in a Deterministic Machine 1 2 4 5 3

  13. Graph Coloring Solution in a Deterministic Machine Time Complexity Analysis: 1- Sorting the vertices based on their node degree takes time in O( nlog(n)). 2- Assigning a Color to a vertex takes time in O( n*k ), where k is the number of colors. 3-  there are ' n ' vertices to be colored, choosing all the ' n ' vertices takes time in O( n2 ). Because each node has to check (n-1) remaining nodes whether they are its neighbor. So for n nodes, we have n(n-1)= O( n 2 ) So the final time complexity will be: T( n ) = O( n log(n)) + O( n*k ) + O( n 2 ) = O( n 2 )

More Related