0% found this document useful (0 votes)
11 views

Chapter 10

Chapter 10 covers the fundamentals of graph theory, including definitions, terminology, and various types of graphs such as directed graphs, complete graphs, and bipartite graphs. It discusses applications of graphs in social networks, transportation, and information networks, as well as methods for representing graphs like adjacency lists and matrices. The chapter also introduces concepts of connectivity and special types of graphs, providing a comprehensive overview of the subject.

Uploaded by

johnxwickxgamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Chapter 10

Chapter 10 covers the fundamentals of graph theory, including definitions, terminology, and various types of graphs such as directed graphs, complete graphs, and bipartite graphs. It discusses applications of graphs in social networks, transportation, and information networks, as well as methods for representing graphs like adjacency lists and matrices. The chapter also introduces concepts of connectivity and special types of graphs, providing a comprehensive overview of the subject.

Uploaded by

johnxwickxgamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

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.

Example: a b Remark: There is no standard


This pseudograph terminology for graph theory. So, it is
has both multiple crucial that you understand the
edges and a loop. terminology being used whenever you
read material about graphs.
c
Directed Graphs
Definition: An directed graph (or digraph) G = (V, E)
consists of a nonempty set V of vertices (or nodes) and
a set E of directed edges (or arcs). Each edge is
associated with an ordered pair of vertices. The
directed edge associated with the ordered pair (u,v) is
said to start at u and end at v.
Remark:
 Graphs where the end points of an edge are not ordered
are said to be undirected graphs.
Some Terminology (continued)
 A simple directed graph has no loops and no multiple edges.

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.

Definition 2. The set of all neighbors of a vertex v of G = (V, E),


denoted by N(v), is called the neighborhood of v. If A is a subset
of V, we denote by N(A) the set of all vertices in G that are
adjacent to at least one vertex in A. So,

Definition 3. The degree of a vertex in a undirected graph is the


number of edges incident with it, except that a loop at a vertex
contributes two to the degree of that vertex. The degree of the
vertex v is denoted by deg(v).
Degrees and Neighborhoods of
Vertices
Example: What are the degrees and neighborhoods of the
vertices in the graphs G and H?

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: How many edges are there in a graph with 10 vertices


of degree six?
Solution: Because the sum of the degrees of the vertices is
6  10 = 60, the handshaking theorem tells us that 2m = 60.
So the number of edges m = 30.

Example: If a graph has 5 vertices, can each vertex have degree


3?
Solution: This is not possible by the handshaking thorem,
because the sum of the degrees of the vertices 3  5 = 15 is odd.
Degree of Vertices (continued)
Theorem 2: An undirected graph has an even number of
vertices of odd degree.
Proof: Let V1 be the vertices of even degree and V2 be the
vertices of odd degree in an undirected graph G = (V, E)
with m edges. Then
even

This sum must be even because 2m


must be is even and the sum of the degrees
even since of the vertices of even degrees is
deg(v) is also even. Because this is the sum of
even for the degrees of all vertices of odd
each v ∈ V1 degree in the graph, there must be
an even number of such vertices.
Directed Graphs
Recall the definition of a directed graph.

Definition: An directed graph G = (V, E) consists of V,


a nonempty set of vertices (or nodes), and E, a set of
directed edges or arcs. Each edge is an ordered pair of
vertices. The directed edge (u,v) is said to start at u
and end at v.
Definition: Let (u,v) be an edge in G. Then u is the
initial vertex of this edge and is adjacent to v and v is
the terminal (or end) vertex of this edge and is adjacent
from u. The initial and terminal vertices of a loop are
the same.
Directed Graphs (continued)
Definition: The in-degree of a vertex v, denoted
deg−(v), is the number of edges which terminate at v.
The out-degree of v, denoted deg+(v), is the number of
edges with v as their initial vertex. Note that a loop at a
vertex contributes 1 to both the in-degree and the out-
degree of the vertex.
Example: In the graph G we have
deg−(a) = 2, deg−(b) = 2, deg−(c) = 3, deg−(d) = 2,
deg−(e) = 3, deg−(f) = 0.

deg+(a) = 4, deg+(b) = 1, deg+(c) = 2, deg+(d) = 2,


deg+ (e) = 3, deg+(f) = 0.
Directed Graphs (continued)
Theorem 3: Let G = (V, E) be a graph with directed edges.
Then:

Proof: The first sum counts the number of outgoing edges


over all vertices and the second sum counts the number of
incoming edges over all vertices. It follows that both sums
equal the number of edges in the graph.
Special Types of Simple Graphs:
Complete Graphs
A complete graph on n vertices, denoted by Kn, is the
simple graph that contains exactly one edge between
each pair of distinct vertices.
Special Types of Simple Graphs:
Cycles and Wheels
A cycle Cn for n ≥ 3 consists of n vertices v1, v2 ,⋯ , vn,
and edges {v1, v2}, {v2, v3} ,⋯ , {vn-1, vn}, {vn, v1}.

A wheel Wn is obtained by adding an additional vertex


to a cycle Cn for n ≥ 3 and connecting this new vertex
to each of the n vertices in Cn by new edges.
New Graphs from Old
Definition: A subgraph of a graph G = (V,E) is a graph (W,F), where W ⊂ V
and F ⊂ E. A subgraph H of G is a proper subgraph of G if H ≠ G.

Example: Here we show K5 and


one of its subgraphs.

Definition: Let G = (V, E) be a simple graph. The subgraph induced by a


subset W of the vertex set V is the graph (W,F), where the edge set F
contains an edge in E if and only if both endpoints are in W.

Example: Here we show K5 and the subgraph


induced by W = {a,b,c,e}.
New Graphs from Old (continued)
Definition: The union of two simple graphs
G1 = (V1, E1) and G2 = (V2, E2) is the simple graph with
vertex set V1 ⋃ V2 and edge set E1 ⋃ E2. The union of
G1 and G2 is denoted by G1 ⋃ G2.

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

 The adjacency matrix for a directed graph does not have to be


symmetric, because there may not be an edge from vi to vj, when
there is an edge from vj to vi.
 To represent directed multigraphs, the value of aij is the number
of edges connecting vi to vj.
Section 10.4
Section Summary
 Paths
 Connectedness in Undirected Graphs
 Vertex Connectivity and Edge Connectivity (not
currently included in overheads)
 Connectedness in Directed Graphs
 Paths and Isomorphism (not currently included in
overheads)
 Counting Paths between Vertices
Paths
Informal Definition: A path is a sequence of edges
that begins at a vertex of a graph and travels from
vertex to vertex along edges of the graph. As the path
travels along its edges, it visits the vertices along this
path, that is, the endpoints of these.
Applications: Numerous problems can be modeled
with paths formed by traveling along edges of graphs
such as:
 determining whether a message can be sent between
two computers.
 efficiently planning routes for mail delivery.
Paths
Definition: Let n be a nonnegative integer and G an undirected graph. A path
of length n from u to v in G is a sequence of n edges e1, … , en of G for which
there exists a sequence x0 = u, x1, …, xn-1, xn = v of vertices such that ei has,
for i = 1, …, n, the endpoints xi-1 and xi.
 When the graph is simple, we denote this path by its vertex sequence
x0, x1, … , xn(since listing the vertices uniquely determines the path).
 The path is a circuit if it begins and ends at the same vertex (u = v) and
has length greater than zero.
 The path or circuit is said to pass through the vertices x1, x2, … , xn-1
and traverse the edges e1, … , en.
 A path or circuit is simple if it does not contain the same edge more
than once.

This terminology is readily extended


to directed graphs. (see text)
Paths (continued)
Example: In the simple graph here:
 a, d, c, f, e is a simple path of length 4.
 d, e, c, a is not a path because e is not connected to c.
 b, c, f, e, b is a circuit of length 4.
 a, b, e, d, a, b is a path of length 5, but it is not a simple
path.
Section 10.5
Section Summary
 Euler Paths and Circuits
 Hamilton Paths and Circuits
 Applications of Hamilton Circuits
Euler Paths and Circuits Leonard Euler
(1707-1783)
 The town of Kӧnigsberg, Prussia (now Kalingrad, Russia) was divided
into four sections by the branches of the Pregel river. In the 18th
century seven bridges connected these regions.
 People wondered whether whether it was possible to follow a path that
crosses each bridge exactly once and returns to the starting point.
 The Swiss mathematician Leonard Euler proved that no such path
exists. This result is often considered to be the first theorem ever
proved in graph theory.

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?

Solution: The graph G1 has an Euler circuit (e.g., a, e, c, d, e, b,


a). But, as can easily be verified by inspection, neither G2 nor G3
has an Euler circuit. Note that G3 has an Euler path (e.g., a, c, d,
e, b, d, a, b), but there is no Euler path in G2, which can be
verified by inspection.
Euler Circuits and Paths
Example:

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)

Hamilton Paths and Circuits


 Euler paths and circuits contained every edge only once. Now we look at paths and circuits that
contain every vertex exactly once.
 William Hamilton invented the Icosian puzzle in 1857. It consisted of a wooden dodecahedron (with
12 regular pentagons as faces), illustrated in (a), with a peg at each vertex, labeled with the names of
different cities. String was used to used to plot a circuit visiting 20 cities exactly once
 The graph form of the puzzle is given in (b).

 The solution (a Hamilton circuit) is given here.


Hamilton Paths and Circuits
Definition: A simple path in a graph G that passes through every
vertex exactly once is called a Hamilton path, and a simple circuit in a
graph G that passes through every vertex exactly once is called a
Hamilton circuit.

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?

Solution: G1 does not have a Hamilton circuit, but


does have a Hamilton path a, b, e, d, c.
G2 has a Hamilton circuit: a, b, e, c, d, a.
G3 has a Hamilton circuit: a, b, e, d, c, a.
Necessary Conditions for
Hamilton Circuits Gabriel Andrew Dirac
(1925-1984)
 Unlike for an Euler circuit, no simple necessary and sufficient
conditions are known for the existence of a Hamiton circuit.
 However, there are some useful necessary conditions. We
describe two of these now.
Dirac’s Theorem: If G is a simple graph with n ≥ 3 vertices such
that the degree of every vertex in G is ≥ n/2, then G has a
Hamilton circuit.

Ore’s Theorem: If G is a simple graph with n ≥ 3 vertices such


that deg(u) + deg(v) ≥ n for every pair of nonadjacent vertices,
then G has a Hamilton circuit.
Øysten Ore
(1899-1968)
Applications of Hamilton Paths and
Circuits
 Applications that ask for a path or a circuit that visits each
intersection of a city, each place pipelines intersect in a
utility grid, or each node in a communications network
exactly once, can be solved by finding a Hamilton path in
the appropriate graph.
 The famous traveling salesperson problem (TSP) asks for
the shortest route a traveling salesperson should take to
visit a set of cities. This problem reduces to finding a
Hamilton circuit such that the total sum of the weights of
its edges is as small as possible.
 A family of binary codes, known as Gray codes, which
minimize the effect of transmission errors, correspond to
Hamilton circuits in the n-cube Qn. (See the text for
details.)

You might also like