- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The Graph Coloring
Graph coloring is the procedure of assignment of colors to each vertex of a graph G such that no adjacent vertices get same color. The objective is to minimize the number of colors while coloring a graph. The smallest number of colors required to color a graph G is called its chromatic number of that graph. Graph coloring problem is a NP Complete problem.
Method to Color a Graph
The steps required to color a graph G with n number of vertices are as follows −
Step 1 − Arrange the vertices of the graph in some order.
Step 2 − Choose the first vertex and color it with the first color.
Step 3 − Choose the next vertex and color it with the lowest numbered color that has not been colored on any vertices adjacent to it. If all the adjacent vertices are colored with this color, assign a new color to it. Repeat this step until all the vertices are colored.
In the above figure, at first vertex a is colored red. As the adjacent vertices of vertex a are again adjacent, vertex b and vertex d are colored with different color, green and blue respectively. Then vertex c is colored as red as no adjacent vertex of c is colored red. Hence, we could color the graph by 3 colors. Hence, the chromatic number of the graph is 3.
Applications of Graph Coloring
Some applications of graph coloring include −
- Graph Coloring
- Coloring Graph
- C++ Program to Perform Edge Coloring to the Line Graph of an Input Graph
- C++ Program to Perform Graph Coloring on Bipartite Graphs
- C++ Program to Perform Edge Coloring of a Graph
- C++ Program to Perform Edge Coloring on Complete Graph
- M-Coloring Problem
- Coloring the Intersection of Circles/Patches in Matplotlib
- C++ Program to Perform Greedy Coloring
- Binary Tree Coloring Game in Python
- C++ program to find winner of cell coloring game
- What is the bar graph?
- Using the Microsoft Graph API
- Graph Fundamentals
- Matching Graph