You are on page 1of 13

276 CHAPTER 5 | The Mathematics of Graphs

s e c t i o n 5.4 Graph Coloring


Coloring Maps
In the mid-1800s, Francis Guthrie was trying to color a map of the counties of England.
So that it would be easy to distinguish the counties, he wanted counties sharing a common
border to have different colors. After several attempts, he noticed that four colors were
required to color the map, but not more. This observation became known as the four-color
problem. (It was not proved until over 100 years later; see the Math Matters on page 278.)
Here is a map of the contiguous states of the United States colored similarly. Note
that the map has only four colors and that no two states that share a common border have
the same color.

There is a connection between coloring maps and graph theory. This connection has
many practical applications, from scheduling tasks, to designing computers, to playing
Sudoku. Later in this section we will look more closely at some of these applications.
Suppose the map in Figure 5.21 shows the countries, labeled as letters, of a continent.
D We will assume that no country is split into more than one piece and countries that touch
C at just a corner point will not be considered neighbors. We can represent each country by
B a vertex, placed anywhere within the boundary of that country. We will then connect two
A vertices with an edge if the two corresponding countries are neighbors—that is, if they
E
share a common boundary. The result is shown in Figure 5.22.
G
F
D D
C
FIGURE 5.21 C
B
A B
E
A E

G
G
F
F

FIGURE 5.22 FIGURE 5.23

If we erase the boundaries of the countries, we are left with the graph in Figure
5.23. The resulting graph will always be a planar graph, because the edges simply con-
nect neighboring countries. Our map-coloring question then becomes: Can we give each
vertex of the graph a color such that no two vertices connected by an edge share the same
color? How many different colors will be required? If this can be accomplished using four
colors, for instance, we will say that the graph is 4-colorable. The graph in Figure 5.23
is actually 3-colorable; only three colors are necessary. One possible coloring is given in
Figure 5.24. A colored map for Figure 5.21 based on the colors of the vertices of the graph
is in Figure 5.25.
SEC T ION 5.4 | Graph Coloring 277

D
D
C C
B B
A E
A E

G
G F
F
FIGURE 5.24 FIGURE 5.25

We can now formally state the four-color theorem.

▼ Four-Color Theorem
Every planar graph is 4-colorable.

q u e s t i o n The graph shown at the right requires ve colors if we wish


to color it such that no edge joins two vertices of the same
color. Does this contradict the four-color theorem?

▼ example 1 Using a Graph to Color a Map

The ctional map below shows the boundaries of countries on a rectangular continent.
Represent the map as a graph, and nd a coloring of the graph using the fewest possible
number of colors. Then color the map according to the graph coloring.

Solution
First draw a vertex in each country and then connect two vertices with an edge if the
corresponding countries are neighbors. (See the rst gure on the next page.) Now try
to color the vertices of the resulting graph so that no edge connects two vertices of the
same color. We know we will need at least two colors, so one strategy is simply to pick
a starting vertex, give it a color, and then assign colors to the connected vertices one by
one. Try to reuse the same colors, and use a new color only when there is no other op-
tion. For this graph we will need four colors. (The four-color theorem guarantees that
we will not need more than that.) To see why we will need four colors, notice that the
one vertex colored green in the following gure connects to a ring of ve vertices. Three
different colors are required to color the ve-vertex ring, and the green vertex connects
to all these, so it requires a fourth color.

answer No. This graph is K5, and therefore it is not a planar graph, so the four-color theorem does not
apply.
278 CHAPTER 5 | The Mathematics of Graphs

yellow

green red
blue

yellow blue
blue
blue

blue red

Now we color each country the same color as the coresponding vertex.

▼ check your progress 1 Represent the ctional map of countries below


as a graph, and determine whether the graph is 2-colorable, 3-colorable, or 4-colorable
by nding a suitable coloring of the graph. Then color the map according to the graph
coloring.

Solution See page S19. ◀

MATHMATTERS Proving the Four-Color Theorem


The four-color theorem can be stated in a simple, short sentence, but proving it is
anything but simple. The theorem was nally proved in 1976 by Wolfgang Haken
and Kenneth Appel, two mathematicians at the University of Illinois. Mathema-
ticians had long hunted for a short, elegant proof, but it turned out that the proof
had to wait for the advent of computers to help sift through the many possible arrange-
ments that can occur.
SEC T ION 5.4 | Graph Coloring 279

The Chromatic Number of a Graph


We mentioned previously that representing a map as a graph always results in
a planar graph. The four-color theorem guarantees that we need only four col-
ors to color a planar graph; however, if we wish to color a nonplanar graph, we may
need more than four colors. The minimum number of colors needed to color a
graph so that no edge connects vertices of the same color is called the chromat-
ic number of the graph. In general, there is no efcient method of nding the chro-
matic number of a graph, but we do have a theorem that can tell us whether a graph is
2-colorable.

▼ 2-Colorable Graph Theorem


A graph is 2-colorable if and only if it has no circuits that consist of an odd number
of vertices.

▼ example 2 Determine the Chromatic Number of a Graph

Find the chromatic number of the Utilities Graph from Section 5.3.

X Y Z

TA K E N O T E

The 2-coloring of the Utilities Graph


described in Example 2 is shown A B C
below. Note that no edge connects
vertices of the same color.
Solution
X Y Z Note that the graph contains circuits such as A – Y – C – Z – B – X – A with six verti-
ces and A – Y – B – X – A with four vertices. It seems that any circuit we nd, in fact,
involves an even number of vertices. It is difcult to determine whether we have
looked at all possible circuits, but our observations suggest that the graph may be
2-colorable. A little trial and error conrms this if we simply color vertices A, B, and C
one color and the remaining vertices another. Thus the Utilities Graph has a chromatic
A B C number of 2.

▼ check your progress 2 Determine whether the following graph is


2-colorable.

Solution See page S19. ◀


280 CHAPTER 5 | The Mathematics of Graphs

Applications of Graph Coloring


Determining the chromatic number of a graph and nding a corresponding coloring of the
graph can solve a wide assortment of practical problems. One common application is in
scheduling meetings or events. This is best shown by example.

▼ example 3 A Scheduling Application of Graph Coloring

Eight different school clubs want to schedule meetings on the last day of the semester.
Some club members, however, belong to more than one of these clubs, so clubs that share
members cannot meet at the same time. How many different time slots are required so
that all members can attend all meetings? Clubs that have a member in common are
indicated with an “X” in the table below.

Ski club Student Debate Honor Student Community Campus Campus


government club society newspaper outreach Democrats Republicans

Ski club — X X X X

Student X — X X X
government

Debate club X — X X X

Honor society X X X — X X

Student X X — X X
newspaper

Community X X X — X X
outreach

Campus X X X —
Democrats

Campus X X X —
Republicans

Solution
We can represent the given information by a graph. Each club is represented by a vertex,
and an edge connects two vertices if the corresponding clubs have at least one common
member.

SC

CR SG

CD DC

CO HS

SN
SEC T ION 5.4 | Graph Coloring 281

Two clubs that are connected by an edge cannot meet simultaneously. If we let a color
POINT OF INTEREST correspond to a time slot, then we need to nd a coloring of the graph that uses the
fewest possible number of colors. The graph is not 2-colorable, because we can nd
Sudoku puzzles like the one shown circuits of odd length. However, by trial and error, we can nd a 3-coloring. One ex-
here have become extremely popular. ample is shown below. Thus the chromatic number of the graph is 3, so we need three
To complete the puzzle, one must ll
different time slots.
each square of the grid with a digit
from 1 to 9 so that each row, each col- SC
umn, and each 333 subgrid contains
the digits 1 through 9 (and so no digit CR SG
is repeated).

5 3 7
6 1 9 5 CD DC
9 8 6
8 6 3
4 8 3 1
7 2 6 CO HS
6 2 8 SN
4 1 9 5
8 7 9 Each color corresponds to a time slot, so one scheduling is
First time slot: ski club, debate club, student newspaper
Two mathematicians, Agnes Herz-
berg and M. Ram Murty, used graph Second time slot: student government, community outreach
theory to analyze the puzzles. We can Third time slot: honor society, campus Democrats, campus Republicans
represent each of the 81 squares by a
vertex; connect two vertices with an
edge if the squares are in the same row,
▼ check your progress 3 Six friends are taking a lm history course and,
because they have procrastinated, need to view several lms the night before the nal
column, or subgrid. Then associate
exam. They have rented a copy of each lm on DVD, and they have a total of three DVD
each of the numbers 1 through 9 with a
players in different dorm rooms. If each lm is two hours long and they start watching at
different color. A solution to the puzzle
corresponds to a coloring of the graph 8:00 .., how soon can they all be nished watching the required lms? Create a view-
using nine colors where no edge con- ing schedule for the friends.
nects vertices of the same color. Film A needs to be viewed by Brian, Chris, and Damon.
The researchers used graph theory
to prove that at least eight of the nine Film B needs to be viewed by Allison and Fernando.
digits must appear at the start of the Film C needs to be viewed by Damon, Erin, and Fernando.
puzzle in order for it to have a unique
Film D needs to be viewed by Brian and Erin.
solution. It is still not known how
many of the squares must be revealed Film E needs to be viewed by Brian, Chris, and Erin.
initially to have a unique solution, but
Solution See page S19. ◀
they found an example with only 17
given entries. They also showed that
there are about 5.5 billion possible
Sudoku puzzles! ▼ example 4 A Scheduling Application of Graph Coloring

Five classes at an elementary school have arranged a tour at a zoo where the students get
to feed the animals.
Class 1 wants to feed the elephants, giraffes, and hippos.
Class 2 wants to feed the monkeys, rhinos, and elephants.
Class 3 wants to feed the monkeys, deer, and sea lions.
Class 4 wants to feed the parrots, giraffes, and polar bears.
Class 5 wants to feed the sea lions, hippos, and polar bears.
If the zoo allows animals to be fed only once a day by one class of students, can the tour
be accomplished in two days? (Assume that each class will visit the zoo only on one day.)
If not, how many days will be required?
282 CHAPTER 5 | The Mathematics of Graphs

Solution
No animal is listed more than twice in the tour list, so you may be tempted to say that
only two days will be required. However, to get a better picture of the problem, we can
represent the situation with a graph. Use a vertex to represent each class, and connect
two vertices with an edge if the corresponding classes want to feed the same animal.
Then we can try to nd a 2-coloring of the graph, where a different color represents a
different day at the zoo.
1

5 2

4 3

Note that the graph contains a circuit, 1 – 4 – 5 – 1, consisting of three vertices. This cir-
cuit will require three colors, and the remaining vertices will not require additional
colors. So the chromatic number of the graph is 3; one possible coloring is given below.
Using this coloring, three days are required at the zoo. On the rst day classes 2 and 5,
represented by the blue vertices, will visit the zoo; on the second day classes 1 and 3, rep-
resented by the red vertices, will visit the zoo; and on the third day class 4, represented
by the green vertex, will visit the zoo.

5 2

4 3

▼ check your progress 4 Several delis in New York City have arranged
deliveries to various buildings at lunchtime. The buildings’ managements do not want
more than one deli showing up at a particular building in one day, but the delis would
like to deliver as often as possible. If they decide to agree on a delivery schedule, how
many days will be required before each deli can return to the same building?
Deli A delivers to the Empire State Building, the Statue of Liberty, and Rockefeller
Center.
Deli B delivers to the Chrysler Building, the Empire State Building, and the New
York Stock Exchange.
Deli C delivers to the New York Stock Exchange, the American Stock Exchange,
and the United Nations Building.
Deli D delivers to New York City Hall, the Chrysler Building, and Rockefeller
Center.
Deli E delivers to Rockefeller Center, New York City Hall, and the United Nations
Building.

Solution See page S19. ◀


SEC T ION 5.4 | Graph Coloring 283

EXCURSION
Photolibrary

Modeling Traffic Lights with Graphs


Have you ever watched the cycles that trafc lights go through while you were waiting for
a red light to turn green? Some intersections have lights that go through several stages to
allow all the different lanes of trafc to proceed safely.
Ideally, each stage of a trafc-light cycle should allow as many lanes of trafc to
proceed through the intersection as possible. We can design a trafc-light cycle by model-
ing an intersection with a graph. Figure 5.26 shows a three-way intersection where two
two-way roads meet. Each direction of trafc has turn lanes, with left-turn lights where
possible. There are six different directions in which vehicles can travel, as indicated in the
gure, and we have labeled each possibility with a letter.

C
D
A
B

B EF

FIGURE 5.26
A C We can represent the trafc patterns with a graph; each vertex will represent one of
the six possible trafc paths, and we will draw an edge between two vertices if the cor-
responding paths would allow vehicles to collide. The result is the graph shown in Fig-
ure 5.27. Because we do not want to allow vehicles to travel simultaneously along routes
F D on which they could collide, any vertices connected by an edge can allow trafc to move
only during different parts of the light cycle. We can represent each portion of the cycle by
E
a color. Our job then is to color the graph using the fewest colors possible.
There is no 2-coloring of the graph because we have a circuit of length 3: A – D – E –
FIGURE 5.27 A. We can, however, nd a 3-coloring. One possibility is given in Figure 5.28.

A C

F D

E
FIGURE 5.28

A 3-coloring of the graph means that the trafc lights at the intersection will have to
go through a three-stage cycle. One stage will allow the trafc routes corresponding to the
red vertices to proceed, the next stage will let the paths corresponding to the blue vertices
to proceed, and nally, the third stage will let path E, colored green, proceed.
284 CHAPTER 5 | The Mathematics of Graphs

Although safety requires three stages for the lights, we can rene the design to al-
B low more trafc to travel through the intersection. Note that at the third stage, only one
route, path E, is scheduled to be moving. However, there is no harm in allowing path B
to move at the same time, since it is a right turn that doesn’t conict with route E. We
A C
could also allow path F to proceed at the same time. Adding these additional paths cor-
responds to adding colors to the graph in Figure 5.28. We do not want to use more than
three colors, but we can add a second color to some of the vertices while maintaining
the requirement that no edge can connect two vertices of the same color. The result is
F D
shown in Figure 5.29. Notice that the vertices in the triangular circuit A – D – E – A can
be assigned only a single color, but the remaining vertices can accommodate two colors.
E In summary, our design allows trafc paths A, B, and C to proceed during one
stage of the cycle, paths C, D, and F during another, and paths B, E, and F during the
FIGURE 5.29 third stage.
EXCURSION EXERCISES
1. A one-way road ends at a two-way street. The intersection and the different possible
trafc routes are shown in the gure below. The one-way road has a left-turn light.
Represent the trafc routes with a graph and use graph coloring to determine the
minimum number of stages required for a light cycle.

2. A one-way road intersects a two-way road in a four-way intersection. Each direction


has turn lanes and left-turn lights. Represent the various trafc routes with a graph
and use graph coloring to determine the minimum number of stages required for a
light cycle. Then rene your design to allow as much trafc as possible to proceed at
each stage of the cycle.
3. A two-way road intersects another two-way road in a four-way intersection. One
road has left-turn lanes with left-turn lights, but on the other road cars are not al-
lowed to make left turns. Represent the various trafc routes with a graph and use
graph coloring to determine the minimum number of stages required for a light
cycle. Then rene your design to allow as much trafc as possible to proceed at each
stage of the cycle.

EXERCISE SET 5.4


■ Map Coloring In Exercises 1 to 4, a ctional map of the 1.
countries of a continent is given. Represent the map by a
graph and nd a coloring of the graph that uses the fewest
possible number of colors. Then color the map according to
the graph coloring you found.
SEC T ION 5.4 | Graph Coloring 285

2. 7. Countries of South America

Venezuela Guyana
Colombia Suriname
French Guiana

Ecuador

Brazil
3. Peru

Bolivia
Paraguay
Chile Uruguay
Argentina

4.
8. Provinces of South Africa

6 7 8

5 4
2
■ Map Coloring In Exercises 5 to 8, represent the map by a
graph and nd a coloring of the graph that uses the smallest 3
possible number of colors. 1

5. Western portion of the United States.


■In Exercises 9 to 14, show that the graph is 2-colorable by
nding a 2-coloring. If the graph is not 2-colorable, explain
why.
9. 10.

11. 12.

6. Counties of New Hampshire


C oos

Grafton Carroll 13. 14.


Belknap
Sullivan Merrimack
Strafford
Cheshire
Rockingham
Hillsborough
286 CHAPTER 5 | The Mathematics of Graphs

■ In Exercises 15 to 20, determine (by trial and error) the 17. 18.
chromatic number of the graph.
15.

19. 20.

16.

21. Scheduling Six student clubs need to hold meetings on the same day, but some
students belong to more than one club. In order to avoid members missing meetings,
the meetings need to be scheduled during different time slots. An “X” in the table
below indicates that the two corresponding clubs share at least one member. Use
graph coloring to determine the minimum number of time slots necessary to ensure
that all club members can attend all meetings.

Student Honor Biology Gaming Debate Engineering


newspaper society association club team club

Student newspaper — X X

Honor society — X X X

Biology association X X — X

Gaming club X — X X

Debate team X X X —

Engineering club X X —

22. Scheduling Eight political committees must meet on the same day, but some
members are on more than one committee. Thus any committees that have members
in common cannot meet at the same time. An “X” in the following table indicates
that the two corresponding committees share a member. Use graph coloring to
determine the minimum number of meeting times that will be necessary so that all
members can attend the appropriate meetings.
SEC T ION 5.4 | Graph Coloring 287

Appropriations Budget Finance Judiciary Education Health Foreign Housing


affairs

Appropriations — X X X

Budget — X X

Finance X — X X X

Judiciary X X — X X

Education — X X

Health X X X —

Foreign affairs X X X —

Housing X X X —

23. Scheduling Six different groups of children would like to visit the zoo and feed
different animals. (Assume each group will visit the zoo on only one day.)
Group 1 would like to feed the bears, dolphins, and gorillas.
Group 2 would like to feed the bears, elephants, and hippos.
Group 3 would like to feed the dolphins and elephants.
Group 4 would like to feed the dolphins, zebras, and hippos.
Group 5 would like to feed the bears and hippos.
Group 6 would like to feed the gorillas, hippos, and zebras.
Use graph coloring to nd the minimum number of days that are required so that
all groups can feed the animals they would like to feed but no animals will be fed
twice on the same day. Design a schedule to accomplish this goal.
24. Scheduling Five different charity organizations send trucks on various routes to
pick up donations that residents leave on their doorsteps.
Charity A covers Main St., First Ave., and State St.
Charity B covers First Ave., Second Ave., and Third Ave.
Charity C covers State St., City Dr., and Country Lane.
Charity D covers City Dr., Second Ave., and Main St.
Charity E covers Third Ave., Country Lane, and Fourth Ave.
Each charity has its truck travel down all three streets on its route on the same
day, but no two charities wish to visit the same streets on the same day. Use graph
coloring to design a schedule for the charities. Arrange their pickup routes so that
no street is visited twice on the same day by different charities. The schedule should
use the smallest possible number of days.
25. Scheduling Students in a lm class have volunteered to form groups and create
Creatas/PictureQuest

several short lms. The class has three digital video cameras that may be checked
out for one day only, and it is expected that each group will need the entire day to
nish shooting. All members of each group must participate in the lm they volun-
teered for, so a student cannot work on more than one lm on any given day.
288 CHAPTER 5 | The Mathematics of Graphs

Film 1 will be made by Brian, Angela, and Kate.


Film 2 will be made by Jessica, Vince, and Brian.
Film 3 will be made by Corey, Brian, and Vince.
Film 4 will be made by Ricardo, Sarah, and Lupe.
Film 5 will be made by Sarah, Kate, and Jessica.
Film 6 will be made by Angela, Corey, and Lupe.
Use graph coloring to design a schedule for lending the cameras, using the smallest
possible number of days, so that each group can shoot its lm and all members can
participate.
26. Animal Housing A researcher has discovered six new species of insects overseas
and needs to transport them home. Some species will harm each other and so can-
not be transported in the same container.
Species A cannot be housed with species C or F.
Species B cannot be housed with species D or F.
Species C cannot be housed with species A, D, or E.
Species D cannot be housed with species B, C, or F.
Species E cannot be housed with species C or F.
Species F cannot be housed with species A, B, D, or E.
Draw a graph where each vertex represents a species of insect and an edge connects
two vertices if the species cannot be housed together. Then use graph coloring to
determine the minimum number of containers the researcher will need to transport
the insects.

E X T E N S I O N S
Critical Thinking
27. Wi-Fi Stations An ofce building is installing eight Wi-Fi transmitting stations. Any
stations within 200 feet of each other must transmit on different channels. The engi-
neers have a chart of the distance between each pair of stations. Suppose that they draw
a graph where each vertex represents a Wi-Fi station and an edge connects two vertices
if the distance between the stations is 200 feet or less. What would the chromatic num-
ber of the graph tell the engineers?
■ Maps In Exercises 28 to 30, draw a map of a ctional continent with country boundaries
corresponding to the given graph.
28. 29. 30.

31. Map Coloring Draw a map of a ctional continent consisting of four countries, where
the map cannot be colored with three or fewer colors without adjacent countries shar-
ing a color.
32. If the chromatic number of a graph with ve vertices is 1, what must the graph look
like?

You might also like