W9 Graphs Theory PDF
W9 Graphs Theory PDF
Graph Theory
Investigate!
In the time of Euler, in the town of Königsberg in Prussia, there
was a river containing two islands. The islands were connected
to the banks of the river by seven bridges (as seen below). The
bridges were very beautiful, and on their days off, townspeople
would spend time walking over the bridges. As time passed, a
question arose: was it possible to plan a walk so that you cross
each bridge once and only once? Euler was able to answer this
question. Are you?
231
232 4. Graph Theory
Pictures like the dot and line drawing are called graphs. Graphs are
made up of a collection of dots called vertices and lines connecting those
dots called edges. When two vertices are connected by an edge, we say
they are adjacent. The nice thing about looking at graphs instead of
pictures of rivers, islands and bridges is that we now have a mathematical
object to study. We have distilled the “important” parts of the bridge
picture for the purposes of the problem. It does not matter how big
the islands are, what the bridges are made out of, if the river contains
alligators, etc. All that matters is which land masses are connected to
which other land masses, and how many times.
We will return to the question of finding paths through graphs later.
But first, here are a few other situations you can represent with graphs:
Example 4.0.1
Al, Bob, Cam, Dan, and Euler are all members of the social net-
working website Facebook. The site allows members to be “friends”
with each other. It turns out that Al and Cam are friends, as are Bob
and Dan. Euler is friends with everyone. Represent this situation
with a graph.
Solution. Each person will be represented by a vertex and each
friendship will be represented by an edge. That is, two vertices will
be adjacent (there will be an edge between them) if and only if the
people represented by those vertices are friends.
A B
E
C D
Example 4.0.2
4.1 Definitions
Investigate!
Which (if any) of the graphs below are the same?
a c e a d e a e d v6 v5 v4
Actually, all the graphs we have seen above are just drawings
of graphs. A graph is really an abstract mathematical object con-
sisting of two sets V and E where E is a set of 2-element subsets
of V. Are the graphs below the same or different?
Graph 1:
V {a, b, c, d, e},
E {{a, b}, {a, c}, {a, d}, {a, e}, {b, c}, {d, e}}.
Graph 2:
V {v 1 , v2 , v 3 , v 4 , v 5 },
E {{v 1 , v 3 }, {v1 , v 5 }, {v 2 , v 4 }, {v 2 , v 5 }, {v 3 , v 5 }, {v 4 , v 5 }}.
would not let us solve any problems about bridges. Instead, here is the
(now) standard definition of a graph.
Graph Definition.
c d
However we could also have drawn the graph differently. For example
either of these:
a d
c b a b c d
We should be careful about what it means for two graphs to be “the
same.” Actually, given our definition, this is easy: Are the vertex sets
equal? Are the edge sets equal? We know what it means for sets to be
equal, and graphs are nothing but a pair of two special sorts of sets.
Example 4.1.1
G1 ({a, b, c}, {{a, b}, {b, c}}); G2 ({a, b, c}, {{a, c}, {c, b}}).
Solution. No. Here the vertex sets of each graph are equal, which
is a good start. Also, both graphs have two edges. In the first graph,
we have edges {a, b} and {b, c}, while in the second graph we have
4.1. Definitions 235
edges {a, c} and {c, b}. Now we do have {b, c} {c, b}, so that is
not the problem. The issue is that {a, b} , {a, c}. Since the edge
sets of the two graphs are not equal (as sets), the graphs are not
equal (as graphs).
Even if two graphs are not equal, they might be basically the same. The
graphs in the previous example could be drawn like this:
G1 G2
a b c a c b
Graphs that are basically the same (but perhaps not equal) are called
isomorphic. We will give a precise definition of this term after a quick
example:
Example 4.1.2
b c v w
Clearly we want to say these graphs are basically the same, so
while they are not equal, they will be isomorphic. We can rename
the vertices of one graph and get the second graph as the result.
Isomorphic Graphs.
An isomorphism between two graphs G1 and G2 is a bijection
f : V1 → V2 between the vertices of the graphs such that {a, b} is
an edge in G1 if and only if { f (a), f (b)} is an edge in G2 .
Two graphs are isomorphic if there is an isomorphism between
them. In this case we write G1 G2 .
Example 4.1.3
d b d b
c c
These are definitely not isomorphic, but notice that the graph on the
right looks like it might be part of the graph on the left, especially if we
draw it like this:
1This is not unlike geometry, where we might have more than one copy of a particular
triangle. There instead of isomorphic we say congruent.
238 4. Graph Theory
We would like to say that the smaller graph is a subgraph of the larger.
We should give a careful definition of this. In fact, there are two
reasonable notions for what a subgraph should mean.
Subgraphs.
Example 4.1.4
d e d d d
a b c a b c a b c a b c
G1 G2 G3 G4
Back to some basic graph theory definitions. Notice that all the graphs
we have drawn above have the property that no pair of vertices is con-
nected more than once, and no vertex is connected to itself. Graphs like
these are sometimes called simple, although we will just call them graphs.
This is because our definition for a graph says that the edges form a set of
2-element subsets of the vertices. Remember that it doesn’t make sense to
say a set contains an element more than once. So no pair of vertices can
be connected by an edge more than once. Also, since each edge must be
4.1. Definitions 239
a b
Lemma 4.1.5 Handshake Lemma. In any graph, the sum of the degrees of
vertices in the graph is always twice the number of edges.
The handshake lemma2 is sometimes called the degree sum formula,
and can be written symbolically as
Õ
d(v) 2e.
v∈V
Here we are using the notation d(v) for the degree of the vertex v.
One use for the lemma is to actually find the number of edges in a
graph. To do this, you must be given the degree sequence for the graph
(or be able to find it from other information). This is a list of every degree
of every vertex in the graph, generally written in non-increasing order.
Example 4.1.6
How many vertices and edges must a graph have if its degree
sequence is
(4, 4, 3, 3, 3, 2, 1)?
4 + 4 + 3 + 3 + 3 + 2 + 1 20,
Example 4.1.7
Named Graphs.
Some graphs are used more than others, and get special names.
K5 K2,3 C6 P5