Skip to main content

Section 3.3 Coloring Graphs

In many logistical applications of graph theory, the problem can be translated into a question about coloring graphs. Examples of such applications include
 1 
source: wikipedia, graph coloring
scheduling (events or tasks), resource allocation (such as assigning computer registers), and physical arrangements (such as assigning seating). In this section, we introduce graph coloring, look at applications to scheduling, and consider the minimum number of colors needed for standard graphs.

Subsection 3.3.A Coloring Maps

Another application of graph coloring is coloring regions of a map. We begin with an activity.

Activity 3.3.A Map coloring.

There are two rules for coloring a map.
  • Rule 1:.
    Each region gets a single color.
  • Rule 2:.
    Any two regions that share a common border (more than a point) must be different colors.
  1. Following these rules, color the map in FigureΒ 3.3.2 using the colors blue, green, red, and purple.
    Figure 3.3.2. A map to color.
    You can use letters for the colors, such as B = blue, G = green, R = red, P = purple. You can color it by hand Four Color Challenge color the map there, and capture a screenshot of your solution.
  2. Draw a rectangle and divide it into six regions to create a new map that can be colored using only two colors. And show how to color it using B = blue and G = green.
  3. Draw a rectangle and divide it into six regions to create a new map that can be colored using three colors but not two colors. Show how to color it using three colors: B = blue, G = green, and R = red and explain why it is impossible to color it using only two colors.
  4. In the map you colored in (a), find a portion of the map with four regions where all four colors were needed. Copy that portion of the map and show that four colors work using B = blue, G = green, R = red, P = purple. Next, explain why it is impossible to color that portion of the map using only three colors. Hint: if it is possible to color that portion of the map using only three colors, then you need to pick a different portion.
We can model a map with a graph and rephrase our question about coloring a map into a question about coloring a graph.

Example 3.3.3 Map coloring.

Β 
  1. Draw a graph with a vertex for each region of the map of midwest states shown in FigureΒ 3.1.22 (in SectionΒ 3.1 Exercise 5). Draw an edge between two vertices if the corresponding regions share an edge (more than a point).
    Solution.
    We draw the graph of map in FigureΒ 3.1.22.
    Figure 3.3.4. A graph of midwest states.
  2. Rephrase the map coloring question as a question about the graph.
    Solution.
    What is the smallest number of colors that we need in order to color the vertices of the graph in such a way that adjacent vertices are different colors?

Subsection 3.3.B Coloring Graphs

Let’s formalize the idea of coloring the vertices of a graph.

Definition 3.3.5 Chromatic number.

Β 
  1. A (vertex) coloring of a graph is an assignment of a color to each vertex in such a way that adjacent vertices have different colors.
  2. A \(k\)-coloring of a graph is a vertex coloring using \(k\) colors. For example, the graph in FigureΒ 3.3.15 has a 3-coloring.
  3. A graph is \(k\)-colorable if there exists a coloring using \(k\) or fewer colors.
  4. The chromatic number of a graph is the smallest number of colors needed to color the graph. For example, the complete bipartite graph, \(K_{6,3}\text{,}\) shown in FigureΒ 3.2.10 has chromatic number two because it can be colored using two colors (black and white) and one color would not work because there are adjacent vertices.
Let’s look at a few examples.

Example 3.3.6 Chromatic number of complete graph and cycle.

Determine the chromatic number \(k\) of each graph by finding a \(k\)-coloring and then explaining why all \(k\) colors are necessary.
  1. The complete graph \(K_5\text{.}\)
    Solution.
    First, we can color each vertex its own color using five colors. Since any pair of vertices in \(K_5\) are adjacent, they must be different colors and so we cannot use fewer than five colors. Thus, the chromatic number of \(K_5\) is five.
  2. The cycle \(C_5\text{.}\)
    Solution.
    If we try to color the vertices of \(C_5\) using only two colors (gray and black), as shown in FigureΒ 3.3.7, we run into a problem. The fifth vertex cannot be gray (because it is adjacent to a vertex colored gray) and it cannot be black (because it is adjacent to a vertex colored black). It must be a third color, say white.
    Figure 3.3.7. Coloring the cycle \(C_5\text{.}\)
    Notice that FigureΒ 3.3.7 actually shows that three colors (gray, black, and white) work. Thus, the chromatic number of \(C_5\) is three.
Let’s try determining the chromatic number of graphs.

Activity 3.3.B Chromatic number of graphs.

To show the chromatic number of a graph is \(k\text{,}\) you should draw the graph, show how to color the vertices using \(k\) colors, and then explain why fewer than \(k\) colors cannot work.
  1. Explain why the chromatic number of the cycle graph \(C_4\) is two but the chromatic number of the cycle graph \(C_5\) is three.
  2. Find the chromatic number of the wheel graph \(W_5\text{.}\) Hint: use (a).
  3. What’s the chromatic number of \(K_4\text{?}\) Explain.
  4. The graph \(E\) drawn in FigureΒ 3.3.9. Find the chromatic number of \(E\text{.}\) Hint: use the result of (c).
    Figure 3.3.9. The graph \(E\text{.}\)
Let’s look at ActivityΒ 3.3.B (b) and (d).

Example 3.3.10 Chromatic number of complicated graphs.

Β 
  1. Find the chromatic number of the wheel graph \(W_5\text{.}\)
    Solution.
    First, notice that the five outer vertices form a copy of \(C_5\text{.}\) Since \(C_5\) has chromatic number three, the outer vertices require at least three different colors. The hub vertex is adjacent to all five outer vertices, and so it must be yet another color. Therefore, we need at least four colors to color the wheel \(W_5\text{.}\)
    Second, FigureΒ 3.3.11 shows a 4-coloring of the wheel \(W_5\text{.}\) Thus, the chromatic number of the wheel \(W_5\) is four.
    Figure 3.3.11. A 4-coloring of the wheel \(W_5\text{.}\)
  2. Find the chromatic number of the graph \(E\) drawn in FigureΒ 3.3.9.
    Solution.
    First, notice that the center four vertices form a copy of \(K_4\text{.}\) Since \(K_4\) has chromatic number four, we know that those four vertices must be four different colors. Therefore, we need at least four colors to color the entire graph \(E\text{.}\)
    Second, FigureΒ 3.3.12 shows a 4-coloring of the graph. Thus, the chromatic number of \(E\) is four.
    Figure 3.3.12. A 4-coloring of the graph \(E\text{.}\)
Coloring can be used to solve scheduling problems.

Example 3.3.13 Scheduling alumni events.

There are three time slots for alumni events this Saturday: late morning, early afternoon, or late afternoon.
  • Alumni Office events: Meet & Greet (M), Campus Tours (C), and Alumni Panel (A).
  • Theater Department events: Poetry Slam (P), Screenplay Reading (R), and Viewing Student Films (V).
  • Career Services events: Speed Networking (N), Interviews (I), and Leadership Development Workshop (L).
Each organization can run only one of its events at a time. In addition, events A and V both want to use the theater and events M, P, and N all want to use the main conference hall, so those events need to be at different times.
  1. Draw a graph representing the situation where each event is a vertex and an edge connects two events if they cannot be scheduled in the same time block.
    Solution.
    Figure 3.3.14. Graph for scheduling alumni events.
  2. Is there a way to assign events times?
    Solution.
    Yes, one solution is M, R, and L in late morning; C, V, and N in early afternoon; and A, P, and I in late afternoon.
  3. Color each vertex with a time that event could be scheduled using the key: black = late morning, gray = early afternoon, and white = late afternoon.
    Solution.
    Figure 3.3.15. Graph for scheduling alumni events where colors represent event time.
  4. Restate the question from (b) in terms of the graph and colors.
    Solution.
    Can we color the vertices of the graph using three colors so that adjacent vertices are different colors?

Subsection 3.3.C Graph Conjectures

We have looked at several specific graphs and calculated quantities such as the number of vertices and edges, the degree sequence, and the chromatic number. What about families of graphs? Let’s look at an example.

Example 3.3.16 Graph conjectures for the complete graphs.

Consider the complete graphs \(K_s\) for \(s \ge 1\text{.}\) Conjecture the number of vertices and edges, the degree sequence, and the chromatic number of \(K_s\text{.}\) Some of your answers should involve \(s\text{.}\)
Solution.
By definition, \(K_s\) has \(s\) vertices. Recall that \(K_s\) models the number of handshakes in a group of \(s\) people. By TheoremΒ 1.1.4, the number of edges is \(1+2+3+\ldots+(s-1) = \frac{s(s-1)}{2}\text{.}\) Alternatively, there is an edge for each pair of vertices. Thus, the number of edges is equal to the number of ways to select two out of \(s\) vertices, which is \(\binom{s}{2}\text{.}\)
Each vertex in \(K_s\) is adjacent to each of the other \(s-1\) vertices. Therefore, the degree sequence is
\begin{equation*} \underbrace{s-1,s-1,s-1, \ldots, s-1}_{s \text{ times } } \end{equation*}
We can color the vertices of \(K_s\) with \(s\) colors by assigning each vertex its own color. Because each vertex is adjacent to every other vertex, no two vertices can be the same color. Thus, all \(s\) colors are necessary. The chromatic number of \(K_s\) is \(s\text{.}\)
We summarize the number of edges of the complete graph \(K_s\) for later reference.
Try making conjectures about families of graphs.

Activity 3.3.C Graph conjectures.

Β 
  1. Consider the star graphs \(K_{1,t}\) for \(t \ge 2\text{.}\) Conjecture the number of vertices and edges, the degree sequence, and the chromatic number of \(K_{1,t}\text{.}\) Some of your answers should involve \(t\text{.}\)
  2. Consider the paths \(P_s\) for \(s \ge 2\text{.}\) Conjecture the number of vertices and edges, the degree sequence, and the chromatic number of \(P_s\text{.}\) Some of your answers should involve \(s\text{.}\)
  3. Consider the cycles \(C_s\) for \(s \ge 3\text{.}\) Conjecture the number of vertices and edges, the degree sequence, and the chromatic number of \(C_s\text{.}\) Some of your answers should involve \(s\text{.}\)

Subsection 3.3.D Exercises

Subsubsection Exercises for 3.3.A Coloring Maps

1. Practice.

Go to Map Colouring to color more complicated maps. Save screenshots of three puzzles that you attempted. Were you able to solve all three? If not, where did you get stuck?
Check.
Note: You do not need to submit the screenshots.

2. Practice.

Copy the map of the northeast states drawn in FigureΒ 3.3.21 and show how to 4-color the map. Note: Both parts of New York (NY) should be one color β€” one part (Upstate New York) is labeled NY, the other part (NYC/Long Island) sits below Connecticut (CT)/Rhode Island (RI) and is long and skinny.
Map of northeastern states
Figure 3.3.21. Map of the northeastern states.

3. Understand.

Β 
  1. Copy the map of midwest states drawn in FigureΒ 3.1.22 (in SectionΒ 3.1 Exercise 5) and show how to color the map using three colors. Note: We discussed this map in ExampleΒ 3.3.3.
  2. Find a portion of the map where all three colors were needed. Copy that portion of the map and explain why it is impossible to color that portion of the map using only two colors.
Check.
  1. Hint: Start with ND: red, SD: blue, MN: red. Then, continue with states whose color must follow. For example, Iowa (IA) must be green. Continue.
  2. Hint: Explain why the region formed by ND, SD, and MN needs three colors.

5. Explore.

Β  Read the Quanta magazine article β€œOnly Computers Can Solve This Map-Coloring Problem” and answer the following questions based on that article.
  1. According to this article, the Four-Color Problem was introduced in a letter, which is a common way mathematics was communicated historically. Who wrote the letter and to whom did they send it?
  2. What does the Four-Color Theorem say?
  3. When did the first proofs appear and who initially claimed to have proved it?
  4. How can the Four-Color Problem be restated in terms of graph theory?
  5. When did the final proof appear and who is credited with the final proof?
  6. Why did the presentation of the final proof receive only β€œpolite applause,” according to mathematician Don Albers?
  7. The original, but flawed, proof has six β€œspecial configurations.” How many special configurations were considered in the final proof?
  8. What is allegedly in Paul ErdΓΆs’s β€œThe Book”?

Subsubsection Exercises for 3.3.B Coloring Graphs

6. Practice.

Draw each graph and color the vertices with the fewest possible colors. No justification is necessary, but be sure that fewer colors would not work.
  1. The star \(K_{1,6}\text{.}\)
  2. The path \(P_6\text{.}\)
  3. The cycle \(C_6\text{.}\)
  4. The wheel \(W_6\text{.}\)
  5. The ladder \(L_{2\times3}\text{.}\)
Check.
  1. Hint: Draw the usual star with black and white vertices.
  2. Hint: Two colors work.
  3. Hint: Two colors work.
  4. See FigureΒ 3.3.26.
    Figure 3.3.26. A 3-coloring of the wheel \(W_6\text{.}\)
  5. Hint: Two colors work.

9. Understand.

Consider the graph \(H\) drawn in FigureΒ 3.3.30.
Figure 3.3.30. The graph \(H\) from Exercise 9.
  1. Copy \(H\) and show a 4-coloring of \(H\text{.}\)
  2. Find a subgraph (portion) of \(H\) that needs at least 4 colors.
  3. What can we conclude from 9.(a) and 9.(b)?
Check.
  1. Hint: Verify that you have colored all the vertices and that any pair of adjacent vertices is different colors.
  2. Hint: Look for complete subgraphs.
  3. Hint: (a) tells us the chromatic number is at most four and (b) tells us the chromatic number is at least four.

10. Understand.

There are seven people and seven committees. Each person is on several committees, as described by TableΒ 3.3.32. There are four standard meeting times: 8-9:30 AM, 10-11:30 AM, 2-3:30 PM, and 4-5:30 PM. We would like to schedule meeting times for the committees in such a way that we avoid having two meetings at the same time if any person is a member of both committees. Is there a way to do it?
Table 3.3.32. Committee (cmte) members for Exercise 10
Person on Cmte? Cmte 1 Cmte 2 Cmte 3 Cmte 4 Cmte 5 Cmte 6 Cmte 7
Alejandro \(\checkmark\) \(\checkmark\)
Bjorn \(\checkmark\) \(\checkmark\) \(\checkmark\)
Cassie \(\checkmark\) \(\checkmark\)
Denise \(\checkmark\) \(\checkmark\) \(\checkmark\)
Ebrahim \(\checkmark\) \(\checkmark\)
Fiona \(\checkmark\) \(\checkmark\)
Gloria \(\checkmark\) \(\checkmark\) \(\checkmark\)
  1. Draw a graph to represent the situation where each committee is a vertex. What should the edges represent?
  2. Is there a way to assign meeting times? If so, color each vertex with a time it could meet using the key: red is 8-9:30 AM, blue is 10-11:30 AM, green is 2-3:30 PM, and orange is 4-5:30 PM.
  3. Restate the question from 10.(b) in terms of the graph and colors.
Check.
  1. Hint: An edge should indicate that the two committees have at least one member in common, which means that that pair of committees cannot be scheduled at the same time. The graph has seven vertices and 12 edges.
  2. Hint: yes
  3. Hint: Can we 4-color the graph?

11. Understand.

What can we say about the chromatic number \(k\) of a graph \(G\) if …? Your answer should be a conjecture in the form of an equation or inequality involving \(k\text{.}\)
  1. \(G\) contains a copy of \(K_5\text{.}\)
  2. \(G\) can be 5-colored.
Check.
  1. Hint: \(K_5\) needs 5 colors, so \(G\) needs 5 colors or maybe more colors.
  2. Hint: Maybe \(G\) can be colored using fewer than 5 colors if we try again.

13. Explore.

Here is an algorithm to 4-color the vertices of graph \(G\) when the maximum degree of any vertex in \(G\) is three.
  1. Assign each color a number: red (1), blue (2), green (3), and orange (4). Label the vertices \(v_1\text{,}\) \(v_2\text{,}\) …, \(v_n\text{.}\) Color the vertex \(v_1\) red (1).
  2. Go to the next vertex and color it the smallest number color that is available, keeping in mind that the vertex cannot be colored the same as any adjacent vertex. Repeat this step until \(v_n\) is colored.
  3. Apply this process to color the graph shown in FigureΒ 3.3.36.
    Figure 3.3.36. Use an algorithm to color the vertices of this graph
  4. Now consider a general graph \(G\) where the maximum degree of any vertex is three. Explain why there will always be a color available in Step 2 of the algorithm. Hint: Each vertex has degree three.
  5. What have we proved about the chromatic number of \(G\text{?}\) Hint: Your answer should be an inequality.
Check.
  1. Hint: Color \(v_1\) red, \(v_2\) blue, \(v_3\) red, …
  2. Hint: When we get to a new vertex to color, how many colors are already used by its neighbors? Explain why there is always at least one of the four colors available to color the new vertex?
  3. Hint: We have found a 4-coloring of the graph. What does that tell us about the chromatic number?

14. Explore.

Β 
  1. Give an example of a graph with chromatic number two that is not a complete bipartite graph, a cycle, a path, a ladder, or a grid.
  2. Give an example of a graph with chromatic number five that is not a complete graph.
  3. Give an example of a graph with at least two vertices but chromatic number one.
Check.
There are many correct answers to each part. The hints describe how to build one such example.
  1. Hint: There are many correct answers. Try starting with the star \(K_{1,3}\) which is a complete bipartite graph, but then add more vertices and connect them with an edge to the leaves in \(K_{1,3}\text{.}\)
  2. Hint: Start with \(K_5\) and add more to it, making sure you can still 5-color the graph.
  3. Hint: The graph does not have to be connected. (And it cannot be connected.)

Subsubsection Exercises for 3.3.C Graph Conjectures

15. Practice.

Consider the complete bipartite graphs \(K_{s,t}\) for \(s,t \ge 1\text{.}\) Conjecture the number of vertices and edges, the degree sequence, and the chromatic number of \(K_{s,t}\text{.}\) Some of your answers should involve \(s\) or \(t\text{.}\)
Check.
Hint: There are \(s+t\) vertices, Β  edges, the degree sequence is
\begin{equation*} \underbrace{t,t,\ldots, t}_{s \text{ times } }\underbrace{s,s,\ldots, s}_{t \text{ times } } \end{equation*}
(perhaps in the other order), and the chromatic number is two.

16. Understand.

Consider the wheels \(W_s\) for \(s \ge 3\text{.}\) Conjecture the number of vertices and edges, the degree sequence, and the chromatic number of \(W_s\text{.}\) Some of your answers should involve \(s\text{.}\)
Check.
Hint: There are \(s+1\) vertices, there is exactly one vertex with degree \(s\text{,}\) and the chromatic number is three or four depending on whether \(s\) is even or odd (be sure to say which is which).

17. Understand.

Consider the ladders \(L_{2 \times t}\) for \(t \ge 2\text{.}\) Conjecture the number of vertices and edges, the degree sequence, and the chromatic number of \(L_{2 \times t}\text{.}\) Some of your answers should involve \(t\text{.}\)
Check.
Hint: There are four vertices of degree two, and the rest have degree three. One way to count edges is to add the number of horizontal edges in the first row, the number of horizontal edges in the second row, and the number of vertical rungs.
Figure 3.3.41. The grid graph \(L_{3 \times 4}\text{.}\)

18. Recap.

Do you know …
  1. How many edges \(K_s\) has?
  2. How to count the number of vertices, the number of edges, the degree sequence, and the chromatic number for a family of graphs (in terms of parameters such as \(s\) or \(t\))?

19. Explore.

For \(s,t \ge 1\text{,}\) the grid graph (or lattice graph) is denoted \(L_{s\times t}\text{.}\) Its vertices are the point,s \((x,y)\text{,}\) in the \(xy\)-plane where \(x = 1, 2, \ldots, s\) and \(y = 1, 2, \ldots, t\text{.}\) There is an edge connecting two points with the same \(x\)-coordinate when their \(y\)-coordinates differ by 1. Also, there is an edge connecting two points with the same \(y\)-coordinate when their \(x\)-coordinates differ by 1. The ladder graphs are the special case where \(s=2\text{.}\)
  1. List the vertices of \(L_{3 \times 4}\) and draw those points in the \(xy\)-plane.
  2. List the edges of \(L_{3 \times 4}\) and add those edges to your points from 19.(a).
  3. How many vertices does the graph \(L_{s \times t}\) have? Your answer should involve \(s\) and \(t\text{.}\)
  4. How many edges does the graph \(L_{s \times t}\) have? Your answer should involve \(s\) and \(t\text{.}\)
Check.
  1. Hint: There are 12 vertices.
  2. Hint: The graph is drawn in FigureΒ 3.3.41
  3. Hint: Multiply
  4. Hint: Count the number of vertical edges. Then count the number of horizontal edges. Then add your answers.

20. Explore.

FigureΒ 3.3.45 shows drawings of perfect binary trees \(B_1\text{,}\) \(B_2\text{,}\) and \(B_3\text{.}\)
Figure 3.3.45. The perfect binary trees \(B_1\text{,}\) \(B_2\text{,}\) and \(B_3\text{.}\)
The tree \(B_1\) has a root vertex at the top. The root vertex is adjacent to two child vertices drawn below. The tree \(B_2\) starts with the tree \(B_1\) and then, for each end vertex, draws two new adjacent child vertices below. These new vertices are grandchildren of the root. The tree \(B_3\) starts with \(B_2\) and then, for each end vertex, draws two new adjacent child vertices below. These new vertices are great-grandchildren of the root. This pattern continues to give a family of perfect binary trees, denoted \(B_s\) for \(s\ge 1\text{.}\)
  1. In the perfect binary tree \(B_3\text{,}\) count the number of children, the number of grandchildren, and the number of great-grandchildren of the root. Use these numbers to find the number of vertices in \(B_3\text{.}\) Hint: don’t forget the root.
  2. Draw the perfect binary tree \(B_4\text{.}\)
  3. Conjecture the number of leaves
     2 
    In a natural tree the root is at the bottom and the leaves are at the top. Graph trees are upside down.
    (end vertices) in \(B_s\text{.}\)
  4. How many vertices does \(B_s\) have? Hint: add up the generations as in 20.(a).
  5. How many edges does \(B_s\) have? Explain.
  6. What are the degrees of the vertices in \(B_s\) and how many vertices of each degree are there? Hint: The root and the leaves have degrees that are from the middle vertices.

21. Explore.

Β 
  1. Draw the cycle \(C_5\text{.}\) Then, using a different colored pen, add the edges of the complement \(\overline{C_5}\) to your graph. What is the resulting graph?
  2. Draw the path \(P_5\text{.}\) Then, using a different colored pen, add the edges of the complement \(\overline{P_5}\) to your graph. What is the resulting graph? It might look a little different than usual.
  3. If we draw a graph \(G\) that has five vertices and then, using a different colored pen, we add the edges of the complement \(\overline{G}\) to the graph, what is the resulting graph? Explain.
  4. If \(G\) is any graph with five vertices and \(m\) edges, how many edges does the complement \(\overline{G}\) have?
  5. Generalize: if \(G\) is any graph with \(s\) vertices and \(m\) edges, how many edges does the complement \(\overline{G}\) have? Hint: TheoremΒ 3.3.17 is useful.