Lesson 9 The Mathematics of Graphs
Lesson 9 The Mathematics of Graphs
Lesson 9 The Mathematics of Graphs
Graphs
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
The Mathematics of Graphs
time.
Königsberg Problem
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Introduction to Graphs
A graph is a set of points called vertices and line segments
or curves called edges that connect vertices.
The following table lists fi ve students at a college. An “X” indicates that the
two students participate in the same study group this semester.
a) Draw a graph that represents this information where each vertex represents a
student and an edge connects two vertices if the corresponding students study
together.
b)Use your graph to answer the following questions: Which student is involved in
the most study groups with the others? Which student has only one study group in
common with the others?
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Graph of the previous example
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Connected Graphs
Connected graphs are graphs in which any vertex can be reached from any other
vertex by tracing along edges.
This is a connected graph in which every possible edge is drawn between vertices
(without any multiple edges). Such a graph is called a complete graph.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
This is a connected graph that has a pair of multiple edges.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
This graph has five vertices but no edges and is referred to as a null graph. It
is also an example of a disconnected graph.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
This graph is not connected. It consists of two different sections. It also
contains a loop.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Question
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Equivalent Graphs
Graphs are said to be equivalent graphs if the edges form the same
connections of vertices.
The following are equivalent graphs.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
The Graph of Königsberg bridges
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
A path in a graph can be thought of as a movement from one vertex to
another by passing through the edges.
For example, in the Konigsberg graph, one path would be A–B–A–C.
If a path ends at the same vertex at which it started, it is considered a closed
path, or circuit.
The path A–D–F–G–E–B–A is a
circuit because it begins and
ends at the same vertex.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Euler Circuit
A circuit that uses every edge, but never uses the same edge twice, is called
an Euler circuit. The path may cross through vertices more than once.
The path B–D–F–G–H– E–C–B–A–D–G–E–B is an Euler circuit.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
The Konigsberg problem which is finding a path that crosses each bridge
exactly once and returns to the starting point is equivalent to finding an Euler
circuit for its corresponding graph.
Euler essentially proved that the Konigsberg graph could not have an Euler
circuit.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Eulerian Graph Theorem
The number of edges that meet at a vertex is called the degree of a vertex.
A connected graph is Eulerian if and only if every vertex of the graph is of
even degree.
The Eulerian Graph Theorem guarantees that when all vertices of a graph
have an even degree, an Euler circuit exists, but it does not tell us how to
find one.
Because the graphs we will examine here are relatively small, we will rely on
trial and error to find Euler circuits.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
There is a systematic method, called Fleury’s algorithm, that can be used to
find Euler circuits in graphs with large numbers of vertices.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Determine whether the graph shown below is Eulerian. If it is, find an Euler
circuit. If it is not, explain how you know. The number beside each vertex
indicates the degree of the vertex.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Euler Path Theorem
A path (not necessarily a circuit) that uses every edge once and only once is
an Euler path.
A connected graph contains an Euler path if and only if the graph has two
vertices of odd degree with all other vertices of even degree. Furthermore,
every Euler path must start at one of the vertices of odd degree and end at
the other.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Dijkstra’s Algorithm
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
A photographer would like to travel across all of the roads shown on the following map. The
photographer will rent a car that need not be returned to the same city, so the trip can begin in
any city. Is it possible for the photographer to design a trip that traverses all of the roads exactly
once?
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Hamiltonian Circuit
A Hamiltonian circuit is a path that uses each vertex of a graph exactly once.
A graph that contains a Hamiltonian circuit is called Hamiltonian.
The path A–B–C–D–E–F–G–A
visits each vertex once and returns
to the starting vertex without visiting
any vertex twice. This path is
a Hamiltonian circuit.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Dirac’s Theorem
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
The graph below shows the available flights of a popular airline. (An edge between two vertices
in the graph means that the airline has direct flights between the two corresponding cities.)
Apply Dirac’s theorem to verify that the following graph is Hamiltonian. Then find a Hamiltonian
circuit. What does the Hamiltonian circuit represent in terms of flights?
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Exercises
use Dirac’s theorem to verify that the graph is Hamiltonian. Then find a
Hamiltonian circuit.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Weighted Graphs
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
The table below lists the distances in miles between six popular cities that a particular airline
flies to. Suppose a traveler would like to start in Chicago, visit the other five cities this airline
flies to, and return to Chicago. Find three different routes that the traveler could follow, and
find the total distance flown for each route.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Solution
A route that visits each city just once corresponds to a Hamiltonian circuit.
Chicago–New York–Dallas–
Philadelphia–Atlanta– Washington,
D.C.–Chicago
713 +1374 + 1299 + 670
+ 544 +597 = 5197
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Chicago–Philadelphia– Dallas–Washington, D.C.–Atlanta–New York–Chicago. The
total weight of the circuit is
665 + 1299 +1185 + 544 +748 + 713 = 5154
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Algorithms in Complete Graphs
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Use the greedy algorithm to find a Hamiltonian circuit in the weighted graph
shown in the Figure. Start at vertex A.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Solution
Begin at A. The weights of the edges from A are 13, 5, 4, 15, and 8, The
smallest is 4. Connect A to D.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Solution
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Solution
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Exercises
Use the greedy algorithm to find a Hamiltonian circuit starting at vertex A in the weighted
graph.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
The Edge-Picking Algorithm
1. Mark the edge of smallest weight in the graph. (If two or more edges have
the same weight, pick any one.)
2. Mark the edge of next smallest weight in the graph, as long as it does not
complete a circuit and does not add a third marked edge to a single vertex.
3. Continue this process until you can no longer mark any edges. Then mark
the final edge that completes the Hamiltonian circuit.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Solution
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Solution
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Solution
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Exercise
Susan needs to mail a package at the post office, pick up several items at the grocery store,
return a rented video, and make a deposit at her bank. The estimated driving time, in minutes,
between each of these locations is given in the table below.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Use both of the algorithms from this section to design routes for Susan to
follow that will help minimize her total driving time. Assume she must start
from home and return home when her errands are done.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Planarity
A planar graph is a graph that can be drawn so that no edges intersect each
other (except at vertices).
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
The drawing is not planar because two edges cross. The graph is planar
because we can make an equivalent planar drawing of it as shown at the left.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
The graph is planar.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Graph Coloring
There is a connection between coloring maps and graph theory.
Other practical applications are found from scheduling tasks, to designing computers, to playing
Sudoku.
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.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Coloring Maps
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
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 is actually 3-colorable; only three colors are necessary.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Four-Color Theorem
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Exercises
A fictional map of the countries of a continent is given. Represent the map by a graph and find a
coloring of the graph that uses the fewest possible number of colors. Then color the map
according to the graph coloring you found.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
The Chromatic Number of a Graph
The four-color theorem guarantees that we need only four colors to color a
planar graph.
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 chromatic number of the
graph.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
2-Colorable Graph Theorem
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Example
Find the chromatic number of the Utilities Graph.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg
Note that no edge connects vertices of the same color.
Note that the graph contains circuits such as A–Y–C–Z–B–X–A with six vertices and A–Y–B–X–A with
four vertices.
A little trial and error confirms this if we simply color vertices A, B, and C one color and the
remaining vertices another. Thus the Utilities Graph has a chromatic number of 2.
Mathematical Excursions, Third Edition Richard N. Aufmann, Joanne S. Lockwood, Richard D. Nation, Daniel K. Clegg