Chapter 10
Chapter 10
Chapter Summary
Graphs and Graph Models
Graph Terminology and Special Types of Graphs
Representing Graphs and Graph Isomorphism
Connectivity
Euler and Hamiltonian Graphs
Shortest-Path Problems (not currently included in
overheads)
Planar Graphs (not currently included in overheads)
Graph Coloring (not currently included in overheads)
Section 10.1
Section Summary
Introduction to Graphs
Graph Taxonomy
Graph Models
Graphs
Definition: A graph G = (V, E) consists of a nonempty set V of vertices (or nodes) and a
set E of edges. Each edge has either one or two vertices associated with it, called its
endpoints. An edge is said to connect its endpoints.
Example: a b
This is a graph
with four
vertices and five
edges.
d c
Remarks:
The graphs we study here are unrelated to graphs of functions studied in Chapter 2.
We have a lot of freedom when we draw a picture of a graph. All that matters is the connections made by the
edges, not the particular geometry depicted. For example, the lengths of edges, whether edges cross, how
vertices are depicted, and so on, do not matter
A graph with an infinite vertex set is called an infinite graph. A graph with a finite vertex set is called a finite
graph. We (following the text) restrict our attention to finite graphs.
Some Terminology
In a simple graph each edge connects two different vertices and no two
edges connect the same pair of vertices.
Multigraphs may have multiple edges connecting the same two
vertices. When m different edges connect the vertices u and v, we say
that {u,v} is an edge of multiplicity m.
An edge that connects a vertex to itself is called a loop.
A pseudograph may include loops, as well as multiple edges connecting
the same pair of vertices.
a b
Example:
This is a directed graph with
three vertices and four edges.
c
A directed multigraph may have multiple directed edges. When there
are m directed edges from the vertex u to the vertex v, we say that (u,v)
is an edge of multiplicity m.
Example:
a b
In this directed multigraph the
multiplicity of (a,b) is 1 and the
multiplicity of (b,c) is 2.
c
Graph Terminology: Summary
To understand the structure of a graph and to build a graph
model, we ask these questions:
• Are the edges of the graph undirected or directed (or both)?
• If the edges are undirected, are multiple edges present that
connect the same pair of vertices? If the edges are directed,
are multiple directed edges present?
• Are loops present?
Applications of Graphs
We will illustrate how graph theory can be used in models
of:
Social networks
Communications networks
Information networks
Software design
Transportation networks
Biological networks
It’s a challenge to find a subject to which graph theory has
not yet been applied. Can you find an area without
applications of graph theory?
Applications to Information Networks
Graphs can be used to model different types of networks
that link different types of information.
In a web graph, web pages are represented by vertices and
links are represented by directed edges.
A web graph models the web at a particular time.
We will explain how the web graph is used by search engines
in Section 11.4.
In a citation network:
Research papers in a particular discipline are represented by
vertices.
When a paper cites a second paper as a reference, there is an
edge from the vertex representing this paper to the vertex
representing the second paper.
Transportation Graphs
Graph models are extensively used in the study of
transportation networks.
Airline networks can be modeled using directed
multigraphs where
airports are represented by vertices
each flight is represented by a directed edge from the vertex
representing the departure airport to the vertex representing
the destination airport
Road networks can be modeled using graphs where
vertices represent intersections and edges represent roads.
undirected edges represent two-way roads and directed edges
represent one-way roads.
Section 10.2
Section Summary
Basic Terminology
Some Special Types of Graphs
Bipartite Graphs
Bipartite Graphs and Matchings (not currently
included in overheads)
Some Applications of Special Types of Graphs (not
currently included in overheads)
New Graphs from Old
Basic Terminology
Definition 1. Two vertices u, v in an undirected graph G are
called adjacent (or neighbors) in G if there is an edge e between
u and v. Such an edge e is called incident with the vertices u and
v and e is said to connect u and v.
Solution:
G: deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d ) = 1,
deg(e) = 3, deg(g) = 0.
N(a) = {b, f }, N(b) = {a, c, e, f }, N(c) = {b, d, e, f }, N(d) = {c},
N(e) = {b, c , f }, N(f) = {a, b, c, e}, N(g) = .
H: deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, deg(d) = 5.
N(a) = {b, d, e}, N(b) = {a, b, c, d, e}, N(c) = {b},
N(d) = {a, b, e}, N(e) = {a, b ,d}.
Degrees of Vertices
Theorem 1 (Handshaking Theorem): If G = (V,E) is an undirected
graph with m edges, then
2𝑚 = deg(𝑣)
𝑣∈𝑉
Proof:
Each edge contributes twice to the degree count of all vertices. Hence,
both the left-hand and right-hand sides of this equation equal twice
the number of edges.
Think about the graph where vertices represent the people at a party and
an edge connects two people who have shaken hands.
Handshaking Theorem
We now give two examples illustrating the usefulness of the
handshaking theorem.
Example:
Section 10.3
Section Summary
Adjacency Lists
Adjacency Matrices
Incidence Matrices
Isomorphism of Graphs
Representing Graphs:
Adjacency Lists
Definition: An adjacency list can be used to represent
a graph with no multiple edges by specifying the
vertices that are adjacent to each vertex of the graph.
Example:
Example:
Representation of Graphs:
Adjacency Matrices
Definition: Suppose that G = (V, E) is a simple graph
where |V| = n. Arbitrarily list the vertices of G as
v1, v2, … , vn. The adjacency matrix AG of G, with
respect to the listing of vertices, is the n × n zero-one
matrix with 1 as its (i, j)th entry when vi and vj are
adjacent, and 0 as its (i, j)th entry when they are not
adjacent.
In other words, if the graphs adjacency matrix is
AG = [aij], then
Adjacency Matrices (continued)
Example: When a graph is sparse, that
is, it has few edges relatively
to the total number of
possible edges, it is much
The ordering of more efficient to represent
vertices is a, b, c, d. the graph using an
adjacency list than an
adjacency matrix. But for a
The ordering of dense graph, which includes
vertices is a, b, c, d. a high percentage of
possible edges, an adjacency
matrix is preferable.
Note: The adjacency matrix of a simple graph is symmetric, i.e., aij = aji
Also, since there are no loops, each diagonal entry aij for i = 1, 2, 3, …, n, is 0.
Adjacency Matrices (continued)
Adjacency matrices can also be used to represent graphs with
loops and multiple edges.
A loop at the vertex vi is represented by a 1 at the (i, j)th position
of the matrix.
When multiple edges connect the same pair of vertices vi and vj,
(or if multiple loops are present at the same vertex), the (i, j)th
entry equals the number of edges connecting the pair of vertices.
Example: We give the adjacency matrix of the pseudograph
shown here using the ordering of vertices a, b, c, d.
Adjacency Matrices (continued)
Adjacency matrices can also be used to represent
directed graphs. The matrix for a directed graph G =
(V, E) has a 1 in its (i, j)th position if there is an edge
from vi to vj, where v1, v2, … vn is a list of the vertices.
In other words, if the graphs adjacency matrix is AG = [aij], then
Multigraph
Model of the
Bridges of
Kӧnigsberg
The 7 Bridges of Kӧnigsberg
Euler Paths and Circuits (continued)
Definition: An Euler circuit in a graph G is a simple circuit
containing every edge of G. An Euler path in G is a simple path
containing every edge of G.
Example: Which of the undirected graphs G1, G2, and G3 has a
Euler circuit? Of those that do not, which has an Euler path?
G1 contains exactly two vertices of odd degree (b and d). Hence it has
an Euler path, e.g., d, a, b, c, d, b.
G2 has exactly two vertices of odd degree (b and d). Hence it has an
Euler path, e.g., b, a, g, f, e, d, c, g, b, c, f, d.
G3 has six vertices of odd degree. Hence, it does not have an Euler path.
Applications of Euler Paths and
Circuits
Euler paths and circuits can be used to solve many practical
problems such as finding a path or circuit that traverses
each
street in a neighborhood,
road in a transportation network,
connection in a utility grid,
link in a communications network.
Other applications are found in the
layout of circuits,
network multicasting,
molecular biology, where Euler paths are used in the
sequencing of DNA.
William Rowan
Hamilton
(1805- 1865)
That is, a simple path x0, x1, …, xn-1, xn in the graph G = (V, E) is called a
Hamilton path if V = {x0, x1, … , xn-1, xn } and xi ≠ xj for 0≤ i < j ≤ n, and
the simple circuit x0, x1, …, xn-1, xn, x0 (with n > 0) is a Hamilton
circuit if x0, x1, … , xn-1, xn is a Hamilton path.
Hamilton Paths and Circuits
(continued)
Example: Which of these simple graphs has a
Hamilton circuit or, if not, a Hamilton path?