## How to find Chromatic Number | Graph coloring AlgorithmTo understand this example, we have to know about the previous article, i.e., In the section of Chromatic Numbers, we have learned the following things: - Graph coloring can be described as a process of assigning colors to the vertices of a graph.
- In graph coloring, the same color should not be used to fill the two adjacent vertices.
- Chromatic number can be described as a minimum number of colors required to properly color any graph.
## Graph Coloring Algorithm- If we want to color a graph with the help of a minimum number of colors, for this, there is no efficient algorithm.
- Graph coloring is also known as the NP-complete algorithm.
However, we can find the chromatic number of the graph with the help of following greedy algorithm. ## Greedy AlgorithmThere are various steps to solve the greedy algorithm, which are described as follows:
- We will color the currently picked vertex with the help of lowest number color if and only if the same color is not used to color any of its adjacent vertices.
- If its adjacent vertices are using it, then we will select the next least numbered color.
- If we have already used all the previous colors, then a new color will be used to fill or assign to the currently picked vertex.
The greedy algorithm contains a lot of drawbacks, which are described as follows: - In the greedy algorithm, the minimum number of colors is not always used.
- Sometimes, the number of colors is based on the order in which the vertices are processed.
## Examples of finding Chromatic number of a GraphThere are a lot of examples to find out the chromatic number in a graph. Some of them are described as follows:
When we apply the greedy algorithm, we will have the following:
From the above table, - In the above graph, we are required minimum 2 numbers of colors to color the graph.
- Therefore, we can say that the Chromatic number of above graph = 2
So with the help of 2 colors, the above graph can be properly colored like this:
When we apply the greedy algorithm, we will have the following:
From the above table, - In the above graph, we are required minimum 3 numbers of colors to color the graph.
- Therefore, we can say that the Chromatic number of above graph = 3
So with the help of 3 colors, the above graph can be properly colored like this:
When we apply the greedy algorithm, we will have the following:
From the above table, - In the above graph, we are required minimum 4 numbers of colors to color the graph.
- Therefore, we can say that the Chromatic number of above graph = 4
So with the help of 4 colors, the above graph can be properly colored like this:
When we apply the greedy algorithm, we will have the following:
From the above table, - In the above graph, we are required minimum 3 numbers of colors to color the graph.
- Therefore, we can say that the Chromatic number of above graph = 3
So with the help of 3 colors, the above graph can be properly colored like this:
When we apply the greedy algorithm, we will have the following: - In the above graph, we are required minimum 3 numbers of colors to color the graph.
- Therefore, we can say that the Chromatic number of above graph = 3
So with the help of 3 colors, the above graph can be properly colored like this: |

For Videos Join Our Youtube Channel: Join Now

- Send your Feedback to [email protected]