Graph coloring, a fundamental concept in graph theory, is a problem-solving technique that assigns labels or "colors" to the vertices of a graph such that no two adjacent vertices share the same color. This process is not only academically intriguing but also has real-world applications in areas like scheduling, map coloring, and even in computer science for tasks like register allocation. Let's explore some example problems and their solutions in this engaging guide.

Before delving into the examples, let's briefly recap the basics. A graph G consists of a set of vertices (or nodes) V and a set of edges E connecting these vertices. A proper graph coloring is an assignment of colors to vertices such that no two adjacent vertices share the same color. The minimum number of colors required to color a graph is called its chromatic number.

Graph Coloring Problem Examples
Now, let's explore some classic graph coloring problem examples.

We'll use the following graph notation: vertices are labeled with uppercase letters, and edges are represented by lines connecting these vertices.
Example 1: Four-Color Theorem

The four-color theorem states that any map can be colored using at most four colors such that no two adjacent regions share the same color. This theorem has been proven, but the original proof was complex and non-constructive. Here's a simple example:
Consider a map with four regions A, B, C, and D, where A is adjacent to B and C, B is adjacent to C and D, C is adjacent to A and D, and D is adjacent to B and C. This map can be colored using four colors as follows: A - Red, B - Green, C - Blue, D - Yellow.
Example 2: Chromatic Polynomial

The chromatic polynomial P(G, k) of a graph G counts the number of proper k-colorings of G. It's defined as:
P(G, k) = the number of proper k-colorings of G
Let's find P(G, k) for a simple graph G with vertices A, B, C, and D, where AB, AC, and BD are edges:

P(G, 1) = 0 (No proper 1-coloring exists)
P(G, 2) = 1 (Color A and B one color, C and D another)




















P(G, 3) = 2 (Either A and C one color, B and D another, or A and D, B and C)
P(G, 4) = 3 (All possible combinations of four colors)
Graph Coloring Algorithms
Several algorithms exist to find the chromatic number or color a graph. We'll discuss two popular ones: Greedy Coloring and Backtracking.
Greedy Coloring starts by assigning the smallest available color to each vertex, giving priority to vertices with more neighbors. Backtracking, on the other hand, explores all possible color assignments recursively, backtracking when it encounters an invalid coloring.
Greedy Coloring Example
Consider the following graph with vertices A, B, C, D, and E, and edges AB, AC, BC, CD, and DE:
1. Initialize colors = [1, 2, 3, ...] and color each vertex with the smallest available color.
2. A gets color 1, B gets color 2, C gets color 3, D gets color 1 (since A is adjacent), E gets color 2 (since B is adjacent).
Backtracking Example
Let's find the chromatic number of the graph from the previous example using backtracking:
1. Start with an empty coloring and try assigning color 1 to vertex A.
2. Assign color 1 to B (valid), then C (valid), then D (invalid, as it's adjacent to A). Backtrack.
3. Try assigning color 2 to D. Assign color 2 to E (valid). Now, A can get color 1, B can get color 2, C can get color 3, D can get color 2, and E can get color 1. The chromatic number is 3.
In the realm of graph coloring, there's always more to explore. From complex theorems to practical algorithms, this fascinating topic continues to captivate mathematicians and computer scientists alike. So, grab your palette and start coloring those graphs!