Mastering Graph Coloring: Solved Example Problems

Donna Jul 28, 2026

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.

Graphing Worksheets | Four Quadrant Graphing Characters Worksheets
Graphing Worksheets | Four Quadrant Graphing Characters Worksheets

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.

an image of a green mushroom with two eyes on it's side, and the graph paper below
an image of a green mushroom with two eyes on it's side, and the graph paper below

Graph Coloring Problem Examples

Now, let's explore some classic graph coloring problem examples.

Chicken Coordinate Graphing Picture Quadrant 1 & All 4 Quadrants
Chicken Coordinate Graphing Picture Quadrant 1 & All 4 Quadrants

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

a worksheet for kids to learn how to make their own numbers and colors
a worksheet for kids to learn how to make their own numbers and colors

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 favorite color graph with pencils and crayons on it for kids to draw
the favorite color graph with pencils and crayons on it for kids to draw

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:

an image of mario in the style of graphing with squares and grids to make it look like he is pointing at something
an image of mario in the style of graphing with squares and grids to make it look like he is pointing at something

P(G, 1) = 0 (No proper 1-coloring exists)

P(G, 2) = 1 (Color A and B one color, C and D another)

a drawing of a bird with an arrow on it's head is shown in graph paper
a drawing of a bird with an arrow on it's head is shown in graph paper
Free Spring Coordinate Graphing Worksheets for Upper Elementary
Free Spring Coordinate Graphing Worksheets for Upper Elementary
a graph that shows the average temperature for different cities in the world, and is shown below
a graph that shows the average temperature for different cities in the world, and is shown below
Graphing Worksheets | Graphing Worksheets for Practice
Graphing Worksheets | Graphing Worksheets for Practice
a graphing worksheet with the line graph and numbers in each column on it
a graphing worksheet with the line graph and numbers in each column on it
Graph Theory | Brilliant Math & Science Wiki
Graph Theory | Brilliant Math & Science Wiki
Preschool bar graph worksheet
Preschool bar graph worksheet
an image of a cartoon character with a green leaf on it's head, in the form of a graph paper
an image of a cartoon character with a green leaf on it's head, in the form of a graph paper
The 27 Worst Charts Of All Time
The 27 Worst Charts Of All Time
Free Mystery Graphs for 4th Grade Math Practice | Graphing Coordinates
Free Mystery Graphs for 4th Grade Math Practice | Graphing Coordinates
Spring Coordinate Graph Mystery Pictures for Kids - Worksheets
Spring Coordinate Graph Mystery Pictures for Kids - Worksheets
Displacement-Time Graph | Physics Motion Graph Study Notes
Displacement-Time Graph | Physics Motion Graph Study Notes
Summer Math Data and Graphing Worksheets | Bar Picture Graphs, Tally Charts K-1
Summer Math Data and Graphing Worksheets | Bar Picture Graphs, Tally Charts K-1
Bar Graph For Kindergarten | Templates at allbusinesstemplates.com
Bar Graph For Kindergarten | Templates at allbusinesstemplates.com
Graph Worksheets | Learning to Work with Charts and Graphs
Graph Worksheets | Learning to Work with Charts and Graphs
Bar Graph Worksheet with Colors Theme | All Kids Network
Bar Graph Worksheet with Colors Theme | All Kids Network
a basket filled with lots of different colored items on top of a graphing paper
a basket filled with lots of different colored items on top of a graphing paper
Google Image Result for https://ecdn.teacherspayteachers.com/thumbitem/Cartoon-Character-Coordinate-Plane-Graphing-Picture-Snoopy-8359668-1674222320/original-8359668-2.jpg
Google Image Result for https://ecdn.teacherspayteachers.com/thumbitem/Cartoon-Character-Coordinate-Plane-Graphing-Picture-Snoopy-8359668-1674222320/original-8359668-2.jpg
Pumpkin Math Coordinate Graphing Mystery Picture Fall Activities
Pumpkin Math Coordinate Graphing Mystery Picture Fall Activities
a graph paper that has been made to look like it is in the form of a square
a graph paper that has been made to look like it is in the form of a square

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!