4MTH312 Lecture Notes-7
4MTH312 Lecture Notes-7
University of Zululand
15 July 2024
Contents
1 Overview of the Module 3
1.1 Learning Unit 1: Basic Concepts . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Learning Unit 2: Connectivity . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Learning Unit 3: The Shortest Path Algorithm . . . . . . . . . . . . . . . 4
1.4 Learning Unit 4: Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Learning Unit 5: Eulerian and Hamiltonian Graphs . . . . . . . . . . . . 4
1.6 Learning Unit 6: Planar Graphs . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Learning Unit 7: Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.8 Assessment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.9 DP Requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.10 Recommended Texts and Resources . . . . . . . . . . . . . . . . . . . . . 5
1
3.3 Expansion Properties and Spectral Gap . . . . . . . . . . . . . . . . . . . 21
3.3.1 Examples of d-Regular Graphs . . . . . . . . . . . . . . . . . . . . 21
3.4 Highly Connected Graphs and Super Connectivity . . . . . . . . . . . . . 24
3.5 Distances in Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6 Cut-vertices and Bridges . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.7 Degree Sequences and Graphical Representations . . . . . . . . . . . . . 30
3.8 Menger’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.9 TUTORIAL TWO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.10 TUTORIAL TWO SOLUTIONS . . . . . . . . . . . . . . . . . . . . . . 35
2
Course Information
Title: Graph Theory
Code: SMTH312
Co-requisites: None
Aim
This module aims to provide students with a deep understanding of graph theory, focusing
on its theoretical concepts and practical applications in various fields such as computer
science, engineering, and social sciences.
Topics Covered:
Topics Covered:
– Connected graphs
– Distances in graphs
– Cut-vertices and bridges
– Havel-hakimi Theorem
3
– Menger theorem
Learning Outcomes
By the end of this unit, students should be able to:
Define and understand key terms such as paths, weights, and shortest paths in the
context of weighted graphs.
Evaluate the efficiency of the algorithm under various conditions and understand
its practical applications and limitations.
Topics Covered:
– Definition of a tree
– Properties of trees
– Constructing minimum spanning trees
Topics Covered:
4
1.6 Learning Unit 6: Planar Graphs
Learning Outcomes: Basics of planar and Hamiltonian graphs, their properties,
the four-color problem, and the closure function.
Topics Covered:
– Planar and Hamiltonian graphs
– Properties of planar and Hamiltonian graphs
– The four-color problem
– The closure function
Assessment Activities: Quizzes and a test.
1.8 Assessment
Continuous Assessment (50%): (40% quizzes, assignments) and (60% periodic
tests).
Final Examination (50%): A comprehensive 3-hour written exam.
1.9 DP Requirement
Continuous Assessment Mark: Minimum of 40%
Attendance: Mandatory 90% attendance in lectures, practicals, and tutorials.
5
2 Learning Unit 1: Basic Concepts
This unit introduces the foundational concepts of graph theory, covering essential defini-
tions, theorems, and operations on graphs.
Definition 2.2 (Order of a Graph). The order of a graph refers to the number of vertices
in the graph. For a graph G = (V, E), the order is given by |V |, the cardinality of the set
V.
6
Definition 2.3 (Size of a Graph). The size of a graph refers to the number of edges in
the graph. For a graph G = (V, E), the size is given by |E|, the cardinality of the set E.
Example 2.5 (Directed Graph). Let V = {a, b, c, d} and E = {(a, b), (b, c), (c, d), (d, a)}.
This graph is directed and forms a cycle, where each vertex points to another in a closed
loop.
d c
a b
Example 2.6 (Weighted Graph). Suppose V = {x, y, z} and E = {(x, y, 5), (y, z, 15), (z, x, 10)}.
Each edge here carries a weight that could represent distance, cost, or some other mea-
surable quantity between vertices.
z
10 15
x y
5
Definition 2.8 (Incident). A vertex and an edge are incident if the vertex is an endpoint
of the edge.
7
Examples to Illustrate Adjacency and Incidence
A B C
Adjacency in an Undirected Graph:
Here, vertices A and B are adjacent, as are B and C.
e
X Y
Incidence in a Directed Graph:
In this directed graph, the edge e is incident with vertex X at the tail and vertex
Y at the head.
2.5 Subgraphs
Definition 2.9 (Subgraph). A subgraph S of a graph G = (V, E) is a graph consisting
of a subset of the vertices of V and a subset of the edges of E that connect vertices in
this subset.
a b c b c
d d
Subgraph S
In this visual representation, the left diagram shows the original graph G, and the
right diagram highlights the subgraph S, clearly indicating which vertices and edges
are included in S.
1 2
8
2
Directed Graph (Digraph): A graph where the edges have a direction associated
with them.
1 2
Bipartite Graph: A graph whose vertices can be divided into two disjoint sets
such that no two graph vertices within the same set are adjacent.
2 4
1 3
Complete Bipartite Graph: A bipartite graph in which every vertex of the first
set is connected to every vertex of the second set.
B 2
A 1
5.2
1 2
Multigraph: A graph which may have multiple edges between the same pair of
vertices.
1 2
1 2
9
2.6 Isomorphism of Graphs
Definition 2.10 (Isomorphism). Two graphs G1 = (V1 , E1 ) and G2 = (V2 , E2 ) are iso-
morphic if there exists a bijection f : V1 → V2 such that any two vertices u and v in
V1 are adjacent in G1 if and only if f (u) and f (v) are adjacent in G2 . This bijection is
called an isomorphism between the graphs.
An isomorphism between these graphs can be defined by the bijection f where f (a) =
1, f (b) = 2, and f (c) = 3.
Isomorphism f
a b c 1 2 3
G1 G2
In this example, you can see that the mapping preserves adjacency: {a, b} corresponds
to {1, 2} and {b, c} to {2, 3}, reflecting the definition of isomorphism accurately.
This example and definition highlight how graph isomorphism is not just about one-
to-one correspondence between vertices but also about preserving the structure of con-
nections (edges) between those vertices.
1 2 3
10
Example 2: Directed Graph
Consider a directed graph G with vertices V = {1, 2, 3} and directed edges E = {(1, 2), (2, 3), (3, 1)}.
1 2
1 2
1 2
f ({1, 2}) = (1, 2), f ({2, 3}) = (2, 3), f ({3, 1}) = (3, 1)
11
Example 2: Directed Graph
Consider a directed graph G with vertices V = {a, b, c} and directed edges E = {(a, b), (b, c), (c, a)}.
a b
f ((a, b)) = (a, b), f ((b, c)) = (b, c), f ((c, a)) = (c, a)
1 2 3
3 4
Union of G1 and G2 :
1 2 3 4
a b
b c
Union of G1 and G2 :
a b c
12
Example 1: Complement of a Simple Graph
Consider a simple graph G with vertices V = {1, 2, 3} and edges E = {{1, 2}, {2, 3}}.
Graph G:
1 2 3
1 2 3
Graph G:
a b
a b
a b c
13
Cartesian Product of G1 and G2 : Vertices Vproduct = V1 ×V2 . An edge exists between
(u, v) and (u′ , v ′ ) if u = u′ and vv ′ ∈ E2 or v = v ′ and uu′ ∈ E1 .
a,c b,c
a,b b,b
Graph G:
4 3
1 2
Graph H:
a b
14
Degree of vertex b: deg(b) = 3 (incoming from a, outgoing to c, outgoing to a)
Lemma 2.15 (Handshaking Lemma). In any graph, P the sum of the degrees of all the
vertices is twice the number of edges. Mathematically, v∈V deg(v) = 2|E|.
Proof. Each edge contributes exactly 2 to the total degree count, once for each of its
endpoints.
Graph G: Vertices V = {1, 2, 3, 4, 5, 6}, and let’s assume the following edge connec-
tions:
E = {{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 1}, {1, 3}, {2, 4}, {3, 5}, {4, 6}}
3 2
4 1
5 6
Twice the number of edges 2|E| = 20, which matches the sum of the degrees,
confirming the Handshaking Lemma.
Corollary 2.16. The number of vertices of odd degree in a graph is even.
P
Proof. From the handshaking lemma, since the sum of degrees v∈V deg(v) is even (as
it equals 2|E|), and since the sum of an odd number of odd numbers is odd, there must
be an even number of vertices with odd degree.
15
Graph G:
3 2
4 1
5 6
Degree Calculation:
Each vertex in this cycle has exactly 2 edges connected to it, meaning every vertex
has an even degree.
Let’s modify this graph by adding another edge between vertices 2 and 5, making
their degrees odd.
3 2
4 1
5 6
Now, vertices 2 and 5 have an odd degree (3 each). The rest remain even. We still
maintain an even number (two) of vertices with odd degrees, thus satisfying the
corollary.
2. Create a simple graph with 4 vertices and 6 edges, then analyze its completeness.
Provide a proof of your conclusion based on the properties of complete graphs.
3. Construct the graph union of G1 with vertices {a, b, c} and edges {{a, b}, {b, c}}
and G2 with vertices {d, e} and edge {{d, e}}. Provide a detailed illustration and
enumerate the vertices and edges of G1 ∪ G2 .
4. Calculate and visualize the complement of a cycle graph with 4 vertices. Discuss
the properties of the resulting graph in terms of connectivity and planarity.
5. Analyze a star graph with vertices {1, 2, 3, 4, 5} and describe the degrees of all
vertices. Explore the implications of these degrees on the graph’s topology and its
center vertex.
16
6. Evaluate the isomorphism between two graphs G1 with vertices {a, b, c} and edges
{{a, b}, {b, c}}, and G2 with vertices {1, 2, 3} and edges {{1, 2}, {2, 3}}. Develop a
detailed argument supporting the presence or absence of an isomorphism.
7. Derive the adjacency matrix for a path graph consisting of three vertices. Discuss
the matrix’s characteristics and what they reveal about the graph’s structure.
8. Identify and draw a subgraph within graph G with vertices {a, b, c, d} and edges
{{a, b}, {b, c}, {c, d}, {d, a}} that includes vertices {b, c, d}. Explain your choice of
subgraph and its relevance to the main graph.
9. Model a real-world problem involving a bipartite graph that represents a job as-
signment system, matching employees to roles based on their skills. Analyze the
model’s effectiveness in optimizing job assignments.
10. Investigate the isomorphic relationship between the graphs G1 and G2 described
above. Suggest a mapping that might demonstrate their isomorphism and discuss
the implications of this relationship.
11. Use the Handshaking Lemma to verify that a graph with 5 vertices connected to
form a cycle upholds this theorem. Provide a detailed explanation of your process.
12. Using Euler’s criterion, evaluate whether a graph with vertices {1, 2, 3, 4} and edges
{{1, 2}, {2, 3}, {3, 4}, {4, 1}, {2, 4}} supports an Eulerian circuit.
13. From the given adjacency matrix, construct a directed graph and analyze it to
determine the presence of cycles. Discuss your findings and the methodology used:
0 1 0
0 0 1
1 0 0
14. Illustrate and analyze a weighted graph with vertices {a, b, c} and the following
weighted edges: {(a, b, 3), (b, c, 5), (c, a, 4)}. Discuss the graph’s potential applica-
tions.
15. Explore the union of graphs G1 and G2 with specified vertices and edges. Draw the
resulting graph and discuss any notable properties or patterns observed.
16. Examine how graph theory can enhance the scheduling system in a university set-
ting, focusing on the optimal linkage of courses, time slots, and classroom alloca-
tions.
17. Classify a graph with vertices {1, 2, 3, 4} and all possible edges except {1, 3} and
{2, 4}. Discuss the graph’s type and the implications of its structure.
18. Discuss the significance of vertex degree in social network analysis, particularly
focusing on centrality and influence within the network.
19. Draw and analyze the complement of a bipartite graph with vertex sets {1, 2} and
{3, 4}, exploring the implications of internal and cross-set connections.
20. From a circular graph with vertices {1, 2, 3, 4, 5, 6}, identify and illustrate a sub-
graph containing vertices {1, 3, 5} and discuss the significance of the selected sub-
graph.
17
3 Learning Unit 2: Connectivity
Learning Outcomes: Students will understand the foundational aspects of graph con-
nectivity, the role of cut-vertices and bridges, and the implications of the Menger theorem
for network reliability and design.
a b c
d e
1 2
4 3
In this graph, every vertex has direct or indirect routes to every other vertex and vice
versa. For example: - From vertex 1 to 3: The path is 1 → 2 → 3 - From vertex 3 to 1:
The path is 3 → 4 → 1
This graph clearly shows that each vertex can reach every other vertex following the
directed paths.
Theorem 3.2 (Path Connectivity). A graph is connected if and only if for every partition
of its vertices into two nonempty subsets, there is an edge with one endpoint in each subset.
18
Sufficiency: Assume that for every partition of V into two nonempty subsets A and
B, there exists at least one edge with one endpoint in A and the other in B. Suppose for
contradiction that the graph is not connected. Then there exist at least two components
in the graph. Let A be the set of vertices in one component, and B the set of vertices
in all other components. By assumption, there should be an edge between A and B,
but this contradicts the definition of components being disconnected. Therefore, no such
partition exists, and the graph must be connected.
Thus, a graph is connected if and only if it is impossible to partition its vertices into
two nonempty subsets without an edge crossing between them.
a b c
d e
In this graph, removing the vertex b and d results in the graph being disconnected as
no path remains between a and e. Therefore, κ(G) = 2.
Definition 3.4 (Minimum Degree δ). In a graph G = (V, E), the minimum degree δ(G)
is the smallest degree of any vertex in the graph. Formally, if V is the set of vertices in
G, then:
δ(G) = min deg(v)
v∈V
where deg(v) denotes the degree of the vertex v, i.e., the number of edges incident to v.
19
a b
d c
In this graph, the degrees of the vertices are as follows: - deg(a) = 4, - deg(b) = 2, -
deg(c) = 2, - deg(d) = 1.
Thus, the minimum degree δ(G) = 1, corresponding to vertex d.
Example 2: Regular Graph A 3-regular graph, where each vertex has exactly three
connections. In this case, the minimum degree is also three, illustrating a scenario where
every vertex shares the same degree.
1 2
4 3
Definition 3.5 (Edge Connectivity λ). The edge connectivity λ(G) of a graph G is defined
as the minimum number of edges that need to be removed to make the graph disconnected
or trivial. It is denoted as λ(G) and is an indicator of the ’robustness’ of the graph against
edge failures. For any graph G, λ(G) cannot exceed the minimum degree of G, denoted
δ(G), i.e., λ(G) ≤ δ(G).
a b c
d e
In this graph, removing any two of the edges connecting a − b and d − a disconnects
vertex a from the rest of the graph. Thus, λ(G) = 2.
Theorem 3.6 (Whitney’s Theorem). For any connected graph, the vertex connectivity κ
and edge connectivity λ satisfy κ ≤ λ ≤ δ, where δ is the minimum degree of the graph.
Proof. (Sketch) Vertex connectivity κ is less than or equal to edge connectivity λ because
removing κ vertices removes at least κ edges, but not all sets of κ edges are incident to
κ vertices. Edge connectivity λ is less than or equal to the minimum degree δ because
removing all edges incident to a vertex of minimum degree disconnects that vertex from
the graph.
20
3.3 Expansion Properties and Spectral Gap
Definition 3.7 (d-Regular Graph). A graph G = (V, E) is said to be d-regular if every
vertex v ∈ V has the same degree d, i.e., the number of edges incident to each vertex is
exactly d. This means that for all vertices v, the degree deg(v) = d.
a b
d c
a c
Definition 3.8 (Laplacian Matrix). The Laplacian matrix L of a graph G with n vertices
is defined as L = D −A, where A is the adjacency matrix of the graph and D is the degree
matrix. The degree matrix D is a diagonal matrix where each diagonal element Dii is the
degree of the i-th vertex, and A is the adjacency matrix where each element Aij is 1 if
there is an edge between the i-th and j-th vertices, and 0 otherwise.
Formally, the elements of the Laplacian matrix L are given by:
di
if i = j
Lij = −1 if i ̸= j and there is an edge between vertex i and vertex j
0 otherwise
The Laplacian matrix has several important properties that make it useful:
21
Random Walks: The Laplacian matrix is used to describe the behavior of random
walks on the graph, particularly in determining the mixing rate.
Example 3.9. Consider a simple graph with four vertices connected as follows:
Graph Representation:
1 2
4 3
Adjacency Matrix (A): The adjacency matrix A for this graph is:
0 1 0 1
1 0 1 0
A= 0 1
0 0
1 0 0 0
Degree Matrix (D): The degree matrix D, which is diagonal, where each diagonal
entry indicates the number of connections for each vertex:
2 0 0 0
0 2 0 0
D= 0 0 1 0
0 0 0 1
Laplacian Matrix (L): Using the definition L = D − A, the Laplacian matrix is:
2 −1 0 −1
−1 2 −1 0
L= 0 −1 1
0
−1 0 0 1
Explanation:
Diagonal Entries: Each diagonal entry Lii reflects the degree of vertex i, showing
the total number of edges incident to that vertex.
22
Definition 3.10 (Spectral Gap). The spectral gap of a graph is defined as the difference
between the largest eigenvalue and the second largest eigenvalue of its adjacency matrix,
or equivalently, the smallest non-zero eigenvalue of its Laplacian matrix. Formally, if
λ1 ≥ λ2 ≥ . . . ≥ λn are the eigenvalues of the adjacency matrix of a graph, then the
spectral gap is λ1 − λ2 . For the Laplacian matrix, where the eigenvalues are µ0 ≤ µ1 ≤
. . . ≤ µn−1 with µ0 = 0, the spectral gap is µ1 .
The spectral gap provides valuable information about the graph’s structure and dy-
namics:
Mixing Time: In random walks and Markov chains associated with graphs, the
spectral gap influences the mixing time—the time it takes for the process to become
close to its steady state. A larger spectral gap typically results in a faster mixing
time.
where ∂S denotes the edge boundary of S, consisting of edges with exactly one endpoint
in S.
Here, h measures the smallest ratio of the number of edges leaving S to the
number of vertices in S, minimized over all subsets S whose sizes are at most
half the total number of vertices in the graph. This ratio is a crucial indicator
of the graph’s connectivity and robustness.
Definition 3.12 (Rayleigh Quotient). For a real symmetric matrix A and a non-zero
vector x, the Rayleigh Quotient R(A, x) is defined as the ratio of the quadratic form
xT Ax to the squared norm xT x, expressed mathematically as:
xT Ax
R(A, x) =
xT x
This quotient helps in estimating the maximum and minimum eigenvalues of the matrix
A.
Theorem 3.13 (Cheeger’s Inequality for d-regular graphs). For a d-regular graph, the
expansion h of the graph is bounded by its spectral gap λ:
h2
2h ≥ λ ≥
2d
23
Part 1: 2h ≥ λ
Lemma 3.14. The second smallest eigenvalue λ2 of the Laplacian matrix L, which is
equivalent to λ for the adjacency matrix in a d-regular graph, is related to the graph
structure by:
2
P
{u,v}∈E (f (u) − f (v))
λ2 = min P 2
v∈V f (v)
f ⊥1
f ̸=0
|∂S|
λ2 ≤
|S|
h2
Part 2: λ ≥ 2d
Lemma 3.15. The conductance of the graph provides a lower bound for the spectral gap:
h2
λ≥
2d
This conclusion is drawn from the relationship between the mixing time of random walks
on the graph and its conductance, where a higher conductance implies a larger spectral
gap and thus faster mixing.
Theorem 3.17 (Super Connectivity and Minimum Degree). A super-κ graph with min-
imum degree δ satisfies κ ≥ δ.
Proof. (Sketch] In a super-κ graph, removing any set of vertices fewer than κ must not
disconnect the graph. If a vertex of minimum degree δ can be removed without disconnect-
ing the graph, then the graph’s connectivity is at least δ, asserting a strong relationship
between minimum degree and connectivity.
Theorem 3.19 (Triangle Inequality in Graphs). For any three vertices u, v, and w in a
graph, the distance between u and w is at most the sum of the distances between u and v
and between v and w.
24
Proof. Let d(x, y) denote the distance between vertices x and y in the graph, defined as
the length of the shortest path connecting them. We will prove the triangle inequality,
which states that for any vertices u, v, and w:
3 4
a b c
2
5
d e
1
Theorem 3.20 (Relationship Between Radius and Diameter). In any graph, the radius
r and the diameter d are related by the inequality:
r ≤ d ≤ 2r
Proof. The proof consists of two parts based on the definitions of radius and diameter:
1. Radius less than or equal to Diameter: Since radius is the minimum eccen-
tricity and diameter is the maximum eccentricity among all vertices in a graph, it
is trivial that r ≤ d.
2. Diameter less than or equal to twice the Radius: Consider two vertices u
and v where the distance d(u, v) equals the diameter d. Let w be a vertex such
that ϵ(w) = r (i.e., w is a central vertex with minimum eccentricity). Then by the
triangle inequality:
d(u, v) ≤ d(u, w) + d(w, v)
Since d(u, w) ≤ r and d(w, v) ≤ r (by the definition of radius as the minimum
eccentricity), we have:
d ≤ r + r = 2r
Corollary 3.21. The center of a graph, which is the set of all vertices with eccentricity
equal to the radius, is non-empty and forms a subgraph.
25
Proof. Since every graph has a vertex with minimum eccentricity, there exists at least
one vertex v such that ϵ(v) = r. Thus, the center, defined as the set of all such vertices, is
non-empty. Additionally, if two vertices u and v are in the center, then the path between
them must also consist of central vertices, otherwise, there would exist a vertex on the
path with higher eccentricity, contradicting the definition of the center. Thus, the center
forms a subgraph.
Corollary 3.22. If a graph has diameter d and radius r such that d = 2r, then the graph
contains a path of length d as its longest shortest path.
Proof. This follows directly from the earlier proof where we established that the maximum
distance between any two vertices u and v achieving the diameter d can be at most 2r.
If d = 2r, then the path that includes the central vertex w and extends to both u and v
achieving maximum distance will have length 2r, thus coinciding with the longest shortest
path in the graph.
Definition 3.24. A bridge is an edge whose removal increases the number of connected
components of the graph.
a b c
In this graph, vertex b is a cut-vertex because its removal disconnects the graph,
separating vertices a, c, and d from each other.
e d
a b c
In this graph, vertex b is a cut-vertex because its removal disconnects the graph,
leaving a, c, and d in separate components.
26
Example 3: Identifying a Bridge Consider the following graph:
a b c
In this graph, the edge (b, c) is a bridge because its removal increases the number of
connected components by disconnecting vertex c from the rest of the graph.
d e f
a b c
In this graph, the edge (b, e) is a bridge because its removal increases the number of
connected components, disconnecting e from the rest of the graph.
Definition 3.25. A cut-vertex is a vertex whose removal increases the number of con-
nected components of the graph.
Definition 3.26. A bridge is an edge whose removal increases the number of connected
components of the graph.
a b c
In this graph, vertex b is a cut-vertex because its removal disconnects the graph,
separating vertices a, c, and d from each other.
e d
a b c
In this graph, vertex b is a cut-vertex because its removal disconnects the graph,
leaving a, c, and d in separate components.
27
Example 3: Identifying a Bridge Consider the following graph:
a b c
In this graph, the edge (b, c) is a bridge because its removal increases the number of
connected components by disconnecting vertex c from the rest of the graph.
d e f
a b c
In this graph, the edge (b, e) is a bridge because its removal increases the number of
connected components, disconnecting e from the rest of the graph.
d e
a b c
In this graph, vertex b is a cut-vertex because its removal disconnects the graph into
two components: one containing a and d, and the other containing c and e.
d e f
a b c
In this graph, the edge (a, d) is a bridge because its removal increases the number of
connected components by disconnecting vertex d from the rest of the graph.
28
Example 7: Identifying a Cut-Vertex Consider the following graph:
d e
a b c f
In this graph, vertex c is a cut-vertex because its removal disconnects the graph into
two components: one containing a, b, and d, and the other containing e and f .
d e
a b c f
In this graph, the edge (c, f ) is a bridge because its removal increases the number of
connected components by disconnecting vertex f from the rest of the graph.
d e g
a b c f
In this graph, vertex c is a cut-vertex because its removal disconnects the graph into
two components: one containing a, b, and d, and the other containing e, f, and g.
Theorem 3.27. In any connected graph with at least two vertices, the removal of a
vertex v results in more connected components than the original graph if and only if v is
a cut-vertex.
Theorem 3.28. In any connected graph, the removal of an edge e results in more con-
nected components than the original graph if and only if e is a bridge.
29
Proof. (⇒) Suppose e is a bridge in a connected graph G. By definition, removing e from
G increases the number of connected components. This means that the graph G − e has
more connected components than G.
(⇐) Suppose that removing an edge e from a connected graph G results in a graph
G − e with more connected components than G. This implies that e was an edge whose
removal increased the number of connected components, which is precisely the definition
of a bridge.
Havel-Hakimi Theorem
Theorem 3.31 (Havel-Hakimi Algorithm). The Havel-Hakimi Algorithm provides a
method to determine whether a given degree sequence is graphical. The theorem states
that a non-increasing sequence of non-negative integers s = (d1 , d2 , . . . , dn ) is graphical if
and only if the sequence obtained by deleting the first term d1 and subtracting 1 from the
next d1 terms of the remaining sequence is graphical.
Havel-Hakimi Algorithm
The Havel-Hakimi algorithm is used to determine if a given degree sequence can represent
a simple graph. Here are the steps of the algorithm:
2. Remove the first element d1 of the sequence and subtract 1 from the next d1 elements
of the list.
3. If the sequence contains any negative numbers after this operation, the sequence is
not graphical.
30
4. Repeat the process with the new sequence obtained after the subtraction.
5. If the process ends with a sequence of all zeros, then the original sequence is graph-
ical.
2. Remove the first element (4) and subtract 1 from the next 4 elements:
[3, 3, 2, 1] → [2, 2, 1, 0]
4. Remove the first element (2) and subtract 1 from the next 2 elements:
[2, 1, 0] → [0, 0]
2. Remove the first element (4) and subtract 1 from the next 4 elements:
[3, 3, 1, 1] → [2, 2, 0, 0]
4. Remove the first element (2) and subtract 1 from the next 2 elements:
[2, 0, 0] → [0, 0]
31
Example 3: Sequence [3, 3, 2, 2, 2]
Original sequence: [3, 3, 2, 2, 2]
1. Sort (already sorted): [3, 3, 2, 2, 2]
2. Remove the first element (3) and subtract 1 from the next 3 elements:
[3, 2, 2, 2] → [2, 1, 1, 2]
[2, 1, 1] → [0, 0, 1]
[0, 0]
[3, 2, 1, 0] → [2, 1, 0, 0]
[1, 0, 0] → [0, 0, 0]
32
3.8 Menger’s Theorem
Theorem 3.32 (Menger’s Theorem). [Read this after Network Section] For any pair of
non-adjacent vertices u and v in a graph, the minimum number of vertices whose removal
disconnects u from v equals the maximum number of vertex-disjoint paths from u to v.
Proof. Consider a flow network where each vertex in the graph, except u and v, is replaced
by two vertices: one for incoming edges and one for outgoing edges, connected by an edge
of capacity one. This transformation ensures that cutting a vertex in the original graph
corresponds to cutting this capacity one edge in the flow network.
Define a flow where each edge in this network has a capacity of one. By the max-flow
min-cut theorem, the maximum value of an s-t flow (from u to v in this context) is equal to
the minimum capacity of an s-t cut in the network. Here, each flow path corresponds to a
vertex-disjoint path in the original graph, and the capacity of a minimum cut corresponds
to the minimum number of vertices needed to disconnect u from v.
Thus, the maximum number of vertex-disjoint paths between u and v (maximum flow
value) is equal to the minimum number of vertices whose removal disconnects u from v
(minimum cut capacity).
u a b v
Analysis of vertex-disjoint paths and minimum vertex cut provides: - Only one vertex-
disjoint path, u → v. - To disconnect u from v, removing either vertex (impractical as
these are endpoints) or blocking this direct path would be necessary.
2. Explain the difference between a connected graph and a strongly connected graph
with a diagram.
3. Draw a simple connected graph and compute the number of paths between two
vertices of your choice.
4. How does adding an edge affect the connectivity of a graph? Illustrate with a graph
example, and calculate its number of connected components before and after the
addition.
33
Cut-vertices and Bridges
5. Define a cut-vertex and a bridge. Use a specific graph to show their roles compu-
tationally.
6. Provide a graph that contains both a cut-vertex and a bridge. Perform a compu-
tational analysis to show the effect of removing each.
7. Remove a cut-vertex from the provided graph and describe computationally the
new graph structure.
8. Discuss the computational impact of removing a bridge from a graph on the graph’s
connectivity.
Graph Properties
10. Calculate the degree of each vertex in a given graph and explain its significance in
connectivity.
11. Provide the adjacency matrix and the degree matrix for the graph used in the
previous question.
12. Compute the Laplacian matrix for the same graph and discuss its implications in
connectivity.
13. Calculate the edge connectivity of a given graph and relate it to the graph’s mini-
mum degree.
14. Using the concept of vertex-disjoint paths, design an algorithm to ensure robust
communication in a network topology presented in a diagram.
16. Prove that in any graph, adding edges never decreases the number of connected
components.
17. Prove that every connected graph with at least two vertices has an edge.
18. Prove that a graph with n vertices and n − 1 edges is connected if and only if it
does not contain cycles.
19. Prove that every connected graph has a vertex whose removal does not disconnect
the graph.
34
Havel-Hakimi Algorithm Applications
20. Determine if the degree sequence [4, 3, 2, 2, 1] is graphical using the Havel-Hakimi
algorithm.
21. Apply the Havel-Hakimi algorithm to the sequence [4, 3, 3, 3, 2, 2, 1] and identify
if it’s graphical.
22. Analyze the graphical nature of the sequence [5, 4, 3, 2, 2] using the Havel-Hakimi
algorithm.
23. Verify if the degree sequence [1, 1, 1, 1, 4] can represent a simple graph through
the Havel-Hakimi algorithm.
24. Use the Havel-Hakimi algorithm to examine whether the sequence [3, 3, 3, 3, 3]
forms a simple graph.
d e
c
a b
d e d e
c c
a b a b
3. Draw a simple connected graph and compute the number of paths be-
tween two vertices of your choice.
35
d e
c
a b
a b a b
Before adding the edge {b, c}, there are 2 connected components. After adding the
edge {b, c}, there is only 1 connected component, making the graph connected.
a b c
In this graph, b is a cut-vertex and {b, c} is a bridge. Removing b or the edge {b, c}
will increase the number of connected components.
6. Provide a graph that contains both a cut-vertex and a bridge. Perform
a computational analysis to show the effect of removing each.
e d
a b c
36
In this graph, b is a cut-vertex and {b, c} is a bridge. Removing b splits the graph
into two disconnected components: {a, e} and {c, d}. Removing the bridge {b, c}
splits the graph into two components: {a, b, d, e} and {c}.
e d
a c
The new graph structure has two disconnected components: {a, e} and {c, d}.
d c
a b
Graph Properties
10. Calculate the degree of each vertex in a given graph and explain its
significance in connectivity.
d c
a b
37
11. Provide the adjacency matrix and the degree matrix for the graph used
in the previous question. Adjacency matrix:
0 1 0 0 1
1 0 1 0 0
0 1 0 1 0
0 0 1 0 1
1 0 0 1 0
Degree matrix:
2 0 0 0 0
0 2 0 0 0
0 0 2 0 0
0 0 0 2 0
0 0 0 0 2
12. Compute the Laplacian matrix for the same graph and discuss its impli-
cations in connectivity. Laplacian matrix L = D − A:
2 −1 0 0 −1
−1 2 −1 0 0
0 −1 2 −1 0
0 0 −1 2 −1
−1 0 0 −1 2
The Laplacian matrix indicates the degree of each vertex and the adjacency between
them. Its eigenvalues can provide insights into the graph’s connectivity and the
presence of connected components.
13. Calculate the edge connectivity of a given graph and relate it to the
graph’s minimum degree. Edge connectivity is the minimum number of edges
that must be removed to disconnect the graph. For the given graph, edge connec-
tivity is 2, which is equal to the minimum degree of the vertices.
16. Prove that in any graph, adding edges never decreases the number of
connected components.
38
Proof: Adding an edge can only connect previously disconnected vertices or add
a redundant connection between already connected vertices. Thus, the number of
connected components cannot decrease.
17. Prove that every connected graph with at least two vertices has an edge.
Proof: By the definition of a connected graph, there must be a path between any
two vertices. A path implies the presence of at least one edge.
18. Prove that a graph with n vertices and n − 1 edges is connected if and
only if it does not contain cycles.
Proof: If a graph has n vertices and n − 1 edges and contains no cycles, it must
be a tree, which is connected. Conversely, a connected graph with n vertices and
n − 1 edges is a tree and contains no cycles.
19. Prove that every connected graph has a vertex whose removal does not
disconnect the graph.
Proof: In a connected graph, consider a vertex with the highest degree. Removing
this vertex may reduce connectivity but will not completely disconnect the graph
if other paths exist between remaining vertices.
39
Remove the first element (4) and subtract 1 from the next four elements:
[1, 1, 1, 1] → [0, 0, 0, 0].
Since the sequence reduces to all zeros, it appears graphical, but it implies an
impossible graph topology in simple graphs.
40
Example 4.2. Consider a simple graph G = (V, E) where V = {a, b, c} and E =
{(a, b), (b, c), (c, a)}. This graph forms a triangle with vertices connected in a cycle.
a b
x y z w
5 3
1 2
Definition 4.5 (Walk). A walk in a graph G = (V, E) is a finite sequence of vertices and
edges, v0 , e1 , v1 , e2 , . . . , ek , vk , such that each edge ei = (vi−1 , vi ) for 1 ≤ i ≤ k. Vertices
and edges may repeat in a walk.
Example 4.6. In the graph G with V = {a, b, c, d} and E = {(a, b), (b, c), (c, d), (d, a)},
a walk could be a, (a, b), b, (b, c), c, (c, d), d.
c d
Walk: a, b, c, d
a b
Example 4.7. Consider the graph H with vertices {1, 2, 3, 4, 5} and edges
{(1, 2), (2, 3), (3, 4), (4, 1), (2, 4)}. A walk in H can be 1, (1, 2), 2, (2, 4), 4, (4, 3), 3.
4 5
Walk: 1, 2, 4, 3
1 2 3
41
Example 4.8. In the graph K with V = {P, Q, R, S} and E = {(P, Q), (Q, R), (R, S), (S, P )},
a walk can be P, (P, Q), Q, (Q, R), R, (R, S), S, (S, P ), P .
Walk: P, Q, R, S, P
R
P Q
Definition 4.9 (Trail). A trail is a walk in which all edges are distinct, meaning no edge
is traversed more than once. Vertices may repeat in a trail.
Example 4.10. In graph G with vertices {a, b, c, d} and edges {(a, b), (b, c), (c, d), (d, a), (b, d)},
a trail is a, (a, b), b, (b, d), d, (d, c).
c d
Trail: a, b, d, c
a b
Example 4.11. Consider the graph L with vertices {1, 2, 3, 4} and edges
{(1, 2), (2, 3), (3, 4), (4, 1), (2, 4)}. A trail can be 1, (1, 2), 2, (2, 4), 4, (4, 3).
4
Trail: 1, 2, 4, 3
1 2 3
E D
Trail: A, B, C, D
A B C
Definition 4.13 (Path). A path is a walk in which all vertices and edges are distinct,
meaning no vertex or edge is repeated. A path is a simple form of a walk.
42
Path: x, y, z, w
x y z w
Example 4.15. Consider the graph P with vertices {A, B, C, D} and edges
{(A, B), (B, C), (C, D)}. A path can be A, (A, B), B, (B, C), C, (C, D), D.
Path: A, B, C, D
A B C D
Path: 1, 2, 3, 4, 5
1 2 3 4 5
Definition 4.17 (Circuit). A circuit is a trail in which the first and last vertices are the
same. All edges in a circuit are distinct, but vertices (except the first and last) may be
repeated.
Example 4.18. In graph R with vertices {a, b, c, d} and edges
{(a, b), (b, c), (c, d), (d, a)}, a circuit is a, (a, b), b, (b, c), c, (c, d), d, (d, a), a.
c d
Circuit: a, b, c, d, a
a b
Example 4.19. Consider the graph S with vertices {x, y, z, u, v} and edges
{(x, y), (y, z), (z, x), (z, u), (u, v)}. A circuit could be x, (x, y), y, (y, z), z, (z, x), x.
z u
Circuit: x, y, z, x, v, u, z
x y
3 4
Circuit: 1, 2, 3, 4, 1
1 2 5
43
Eulerian and Hamiltonian Graphs
Definition 4.21 (Eulerian Path and Circuit). An Eulerian path is a trail that visits
every edge in the graph exactly once. An Eulerian circuit is an Eulerian path that starts
and ends at the same vertex.
Example 4.22. Consider a graph Q with vertices {A, B, C, D} and edges
{(A, B), (B, C), (C, D), (D, A), (A, C), (B, D)}. This graph has an Eulerian circuit.
C D
Eulerian Circuit
A B
Eulerian Circuit
T R
P Q
Eulerian Circuit
V Z
X Y U
Eulerian Circuit G
E C
A B F
44
Theorem 4.26 (Euler’s Theorem). A connected graph G has an Eulerian circuit if and
only if every vertex has an even degree.
Proof. (⇒) Assume G has an Eulerian circuit. Starting and ending at the same vertex
implies each time a vertex is entered, it must be exited, giving all vertices even degrees.
(⇐) If every vertex has an even degree, starting at any vertex and following a trail
until returning to the starting vertex, repeat for any remaining unvisited edges forms an
Eulerian circuit.
Example 4.27. The Königsberg Bridge Problem is a classic example where Euler deter-
mined that no Eulerian trail exists since more than two vertices have an odd degree.
C
No Eulerian Trail
D
A B
Remark 4.28. Eulerian circuits are useful in applications such as DNA sequencing,
where covering every segment exactly once is necessary.
Example 4.30. In a graph with vertices {a, b, c, d} and edges {(a, b), (b, c), (c, d)}, a
Hamiltonian path is a, (a, b), b, (b, c), c, (c, d), d.
Hamiltonian Path
a b c d
Hamiltonian Path
1 2 3 4 5
Hamiltonian Path
A B C D E F
45
Definition 4.33 (Hamiltonian Cycle). A Hamiltonian cycle is a cycle that visits every
vertex of the graph exactly once and returns to the starting vertex. A graph that contains
a Hamiltonian cycle is called Hamiltonian.
Example 4.34. In graph G with vertices {1, 2, 3, 4} and edges
{(1, 2), (2, 3), (3, 4), (4, 1)}, the Hamiltonian cycle is
1, (1, 2), 2, (2, 3), 3, (3, 4), 4, (4, 1), 1.
3 4
Hamiltonian Cycle
1 2
Example 4.35. Consider a graph with vertices {1, 2, 3, 4, 5} and edges forming a cycle:
{(1, 2), (2, 3), (3, 4), (4, 5), (5, 1)}. This graph has a Hamiltonian cycle.
Hamiltonian Cycle
5 3
1 2
Example 4.36. Consider a hexagonal graph with vertices {A, B, C, D, E, F } and edges
forming a cycle:
{(A, B), (B, C), (C, D), (D, E), (E, F ), (F, A)}. This graph also contains a Hamilto-
nian cycle.
E D
Hamiltonian Cycle
F C
A B
Example 4.37. Consider a triangle with vertices {P, Q, R} and additional vertex S,
forming edges:
{(P, Q), (Q, R), (R, P ), (P, S), (Q, S), (R, S)}. This graph has a Hamiltonian cycle.
R Cycle
Hamiltonian
P Q
46
Theorem 4.38 (Dirac’s Theorem). If a graph G with n ≥ 3 vertices has the property
that every vertex has a degree of at least n/2, then G contains a Hamiltonian cycle.
Proof. For any vertex v in G, if deg(v) ≥ n/2, any path can extend by linking available
vertices, ensuring G covers all vertices at least once, closing the path to form a cycle.
Theorem 4.39 (Ore’s Theorem). If a graph G with n ≥ 3 vertices satisfies d(u) + d(v) ≥
n for every pair of non-adjacent vertices u and v, then G has a Hamiltonian cycle.
Proof. Starting from any vertex v, repeatedly extend the path to the largest degree vertex
in the neighborhood until all vertices are included, closing the cycle.
Remark 4.40. Hamiltonian cycles are used in solving the Traveling Salesman Problem,
optimizing routes to visit a series of locations exactly once.
subject to the constraint that each city is visited exactly once, i.e., π(i) ̸= π(j) for
i ̸= j, and π(n + 1) = π(1) to return to the starting city.
Example 1: Four Cities Consider a delivery company that needs to plan a route for
its truck to deliver goods to four different cities, labeled A, B, C, and D. The distance
between each pair of cities is given in the following matrix:
47
A B C D
A 0 10 15 20
B 10 0 35 25
C 15 35 0 30
D 20 25 30 0
The objective is to find the shortest route that starts and ends at city A, visiting all
other cities exactly once.
30
D C
25
20 15 35
A B
10
Solution: To solve this TSP problem, we can enumerate all possible routes and
calculate their total distances, selecting the shortest one. The possible routes are:
- **Route 1**: A → B → C → D → A - Distance = 10 + 35 + 30 + 20 = 95
- **Route 2**: A → B → D → C → A - Distance = 10 + 25 + 30 + 15 = 80
- **Route 3**: A → C → B → D → A - Distance = 15 + 35 + 25 + 20 = 95
- **Route 4**: A → C → D → B → A - Distance = 15 + 30 + 25 + 10 = 80
- **Route 5**: A → D → B → C → A - Distance = 20 + 25 + 35 + 15 = 95
- **Route 6**: A → D → C → B → A - Distance = 20 + 30 + 35 + 10 = 95
The optimal route is Route 2: A → B → D → C → A with a total distance of 80.
Hamiltonian Cycle:
Path: A → B → D → C → A
Explanation:
This is a Hamiltonian cycle because it covers all vertices exactly once and returns
to the starting point.
Example 2: Five Cities A company must optimize the travel route for delivering
packages to five cities: P, Q, R, S, T . The distance between the cities is provided in the
following matrix:
P Q R S T
P 0 21 32 47 50
Q 21 0 45 60 29
R 32 45 0 55 43
S 47 60 55 0 28
T 50 29 43 28 0
48
The goal is to determine the shortest path that visits each city exactly once and
returns to the starting point.
T
28 43
S 55 R
50 29
47 32 45
60
P Q
21
Solution: For five cities, it’s practical to use heuristic methods like the Nearest
Neighbor or Minimum Spanning Tree approximation due to the exponential growth of
permutations. Here, we’ll use the Nearest Neighbor approach starting from city P:
Hamiltonian Cycle:
Path: P → Q → T → S → R → P
Explanation:
This is a Hamiltonian cycle as it includes all vertices exactly once and returns to
the starting point.
49
Genetic Algorithms: A population-based metaheuristic that evolves solutions
over generations to find near-optimal paths. This approach mimics the process of
natural selection, using operations such as mutation, crossover, and selection to
explore the solution space.
Branch and Bound: An exact algorithm that systematically explores all possible
routes while pruning suboptimal solutions. This method reduces the search space
by eliminating paths that exceed a known upper bound, focusing computational
resources on promising routes.
Dynamic Programming: The Held-Karp algorithm, a dynamic programming
approach, solves the TSP in O(n2 2n ) time. This method uses a recursive strategy to
build up solutions for larger problems based on previously computed subproblems,
ensuring optimality at the expense of higher computational complexity for large
instances.
Algorithm Steps
1. Initialize the distance to the source vertex to zero and all other vertices to infinity.
2. Set all vertices as unprocessed; this typically involves a priority queue where the
vertex with the lowest tentative distance is dequeued first.
50
3. Repeat until the priority queue is empty:
In computer networks, it helps in routing by finding the shortest path for data
packets.
In GPS navigation systems, it finds the shortest driving routes between destinations.
1→2 :6
1→3 :7
2→3 :5
2→4 :4
3→4 :3
3→5 :4
4→5 :6
5→1 :7
51
4
2 4
6 5 3
7
1 3
6
4
7
5
1. Initialization:
2. Visit Node 1:
5. Visit Node 4:
6. Visit Node 5:
52
Table of Distances
Node 1: 0
Node 2: 6
Node 3: 7
Node 4: 10
Node 5: 11
53
Example 2: Complex Network
Graph Edges
P →Q :1
P →R :4
Q→R :2
Q→S :5
R→S :3
Steps to Find Shortest Path from Node P
1. Initialization:
Set the distance to node P to 0: d(P ) = 0.
Set the distance to all other nodes to infinity: d(Q) = d(R) = d(S) = ∞.
Mark all nodes as unvisited.
2. Visit Node P:
Update distances to its adjacent nodes:
– d(Q) = min(∞, 0 + 1) = 1
– d(R) = min(∞, 0 + 4) = 4
Mark node P as visited.
3. Visit Node Q (nearest unvisited node with minimum distance):
Update distances to its adjacent nodes:
– d(R) = min(4, 1 + 2) = 3
– d(S) = min(∞, 1 + 5) = 6
Mark node Q as visited.
4. Visit Node R (next nearest unvisited node):
Update distances to its adjacent nodes:
– d(S) = min(6, 3 + 3) = 6 (no change)
Mark node R as visited.
5. Visit Node S:
Mark node S as visited.
Table of Distances
54
Node P: 0
Node Q: 1
Node R: 3
Node S: 6
55
Example 3: Another Complex Network
Graph Edges
X → Y : 10
X → Z : 15
Y →Z :5
Z → Y : 20
Steps to Find Shortest Path from Node X
1. Initialization:
2. Visit Node X:
4. Visit Node Z:
Table of Distances
Node Y: 10
Node Z: 15
56
Example 4: Advanced Network
Graph Edges
M →N :6
M →O :8
N →O :9
N →P :5
O→P :7
Steps to Find Shortest Path from Node M
1. Initialization:
Set the distance to node M to 0: d(M ) = 0.
Set the distance to all other nodes to infinity: d(N ) = d(O) = d(P ) = ∞.
Mark all nodes as unvisited.
2. Visit Node M:
Update distances to its adjacent nodes:
– d(N ) = min(∞, 0 + 6) = 6
– d(O) = min(∞, 0 + 8) = 8
Mark node M as visited.
3. Visit Node N (nearest unvisited node with minimum distance):
Update distances to its adjacent nodes:
– d(O) = min(8, 6 + 9) = 8 (no change)
– d(P ) = min(∞, 6 + 5) = 11
Mark node N as visited.
4. Visit Node O (next nearest unvisited node):
Update distances to its adjacent nodes:
– d(P ) = min(11, 8 + 7) = 11 (no change)
Mark node O as visited.
5. Visit Node P:
Mark node P as visited.
Table of Distances
57
Node M: 0
Node N: 6
Node O: 8
Node P: 11
E C
A B
5 3
1 2
3. Path Analysis: Determine if a Hamiltonian path exists in the graph with vertices
{X, Y, Z, W, V } and edges {(X, Y ), (Y, Z), (Z, W ), (W, X), (Y, W ), (V, X)}.
V Z
X Y
58
P
Q O
M N
4
3
2
5 3
4
9 10
1 2
7
D
4
5
E C
8
7 3
A B
2
Z
8
10 15
10
X Y
5
59
8. Practical Application: Explain how Dijkstra’s Algorithm can be used to find
the shortest route in a city’s transportation network. Provide a simplified example with
at least five intersections.
9. Comparison with Bellman-Ford: Describe a scenario where the Bellman-
Ford algorithm would be preferred over Dijkstra’s Algorithm. Explain why Dijkstra’s
Algorithm is unsuitable for graphs with negative weights.
10.Connectivity Proof and Shortest Path Impact: Prove whether the graph
with vertices {1, 2, 3, 4, 5, 6} and edges {(1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (1, 6)} is connected.
Discuss its impact on finding the shortest path.
1 2 3 4 5 6
11. Eulerian Circuit Identification: Determine if the graph with vertices {P, Q, R, S, T }
and edges {(P, Q), (Q, R), (R, S), (S, T ), (T, P ), (P, R), (Q, S)} has an Eulerian circuit.
T R
P Q
12. Hamiltonian Cycle Detection: Find a Hamiltonian cycle in the graph with
vertices {A, B, C, D, E, F } and edges forming a complete cycle:
{(A, B), (B, C), (C, D), (D, E), (E, F ), (F, A), (B, D), (C, E)}.
E C
A B
13. Shortest Path in a Network: Apply Dijkstra’s Algorithm to find the shortest
path in a network with nodes {U, V, W, X, Y } and weighted edges
{(U, V, 6), (V, W, 9), (W, X, 3), (X, Y, 4), (U, W, 10), (V, X, 7)} starting from node U.
X 3
4
Y W
7
10 9
U V
6
60
14. Real-World Application: Discuss the real-world application of shortest path
algorithms in delivery services. How do they optimize delivery routes? Provide a practical
example involving five delivery points.
15. Graph Theory Concepts: Define and differentiate between walks, trails, paths,
and circuits. Provide examples of each from a graph with vertices {M, N, O, P, Q} and
edges {(M, N ), (N, O), (O, P ), (P, Q), (Q, M ), (N, P ), (O, Q)}.
Q O
M N
5 3
1 2
18. Network Traffic Optimization: Describe how Dijkstra’s Algorithm can help
optimize network traffic. Use a simple network of intersections and roads as an example.
19. Limitations of Algorithms: Discuss the limitations of using Dijkstra’s Al-
gorithm in dynamic networks where weights may change over time. How can these
limitations be addressed?
20. Graph Representation: Explain how graphs can be represented in computer
memory. Discuss adjacency lists and matrices, and their advantages in implementing
shortest path algorithms.
61
D
E C
A B
Solution:
Walk: A walk is a sequence of vertices and edges where vertices and edges can
repeat. For example, A → B → C → B → A is a walk.
5 3
1 2
Solution:
A trail that includes all the edges is 1 → 2 → 3 → 1 → 6 → 5 → 4 → 3. Since this
trail includes all the edges without repetition and starts and ends at different vertices, it
is not an Eulerian trail.
3. Path Analysis: Determine if a Hamiltonian path exists in the graph with vertices
{X, Y, Z, W, V } and edges {(X, Y ), (Y, Z), (Z, W ), (W, X), (Y, W ), (V, X)}.
V Z
X Y
62
Solution:
A Hamiltonian path is a path that visits every vertex exactly once. In this graph,
a Hamiltonian path exists: V → X → Y → Z → W . Therefore, this graph has a
Hamiltonian path.
4. Circuit Exploration: In the graph K = (V, E) where V = {M, N, O, P, Q}
and E = {(M, N ), (N, O), (O, P ), (P, M ), (M, O), (N, Q), (Q, O)}, find a circuit and de-
termine if it’s an Eulerian circuit.
Q O
M N
Solution:
A circuit in this graph is M → N → O → P → M . However, this circuit does not
include all edges of the graph, so it is not an Eulerian circuit.
5. Graph Drawing and Analysis: Draw the graph with vertex set V = {v1 , v2 , v3 , v4 , v5 , v6 , v7 }
and edge set E = {v1 v2 , v1 v3 , v1 v6 , v2 v2 , v2 v4 , v3 v1 , v4 v5 , v4 v6 }. Identify all isolated ver-
tices, loops, and parallel edges, if any.
v2 v5
v1 v4 v7
v3 v6
Solution:
Isolated Vertex: v7
Loop: At vertex v2
63
4
3
2
5 3
4
9 10
1 2
7
Solution:
From vertex 1:
64
10. Connectivity Proof and Shortest Path Impact: Prove whether the graph
with vertices {1, 2, 3, 4, 5, 6} and edges {(1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (1, 6)} is connected.
Discuss its impact on finding the shortest path.
Solution:
The graph is connected because there is a path between every pair of vertices. For
example, to get from vertex 1 to any other vertex, a continuous sequence of edges can be
followed. This connectivity ensures that Dijkstra’s Algorithm can compute the shortest
path between any two vertices without any disconnection issues.
11. Eulerian Circuit Identification: Determine if the graph with vertices {P, Q, R, S, T }
and edges {(P, Q), (Q, R), (R, S), (S, T ), (T, P ), (P, R), (Q, S)} has an Eulerian circuit.
T R
P Q
Solution:
The graph has an Eulerian circuit because all vertices have an even degree: - P, Q, R, S, T
all have degree 2 or 4. An Eulerian circuit is possible since the graph is connected, and
all vertices have even degrees.
12. Hamiltonian Cycle Detection: Find a Hamiltonian cycle in the graph with
vertices {A, B, C, D, E, F } and edges forming a complete cycle:
{(A, B), (B, C), (C, D), (D, E), (E, F ), (F, A), (B, D), (C, E)}.
E C
A B
Solution:
A Hamiltonian cycle that visits every vertex exactly once is: A → B → C → D →
E → F → A. This cycle covers all vertices without repetition.
13. Shortest Path in a Network: Apply Dijkstra’s Algorithm to find the shortest
path in a network with nodes {U, V, W, X, Y } and weighted edges
{(U, V, 6), (V, W, 9), (W, X, 3), (X, Y, 4), (U, W, 10), (V, X, 7)} starting from node U.
X 3
4
Y W
7
10 9
U V
6
65
Solution:
1. Start at node U : - Distance to U = 0 (starting point) - Distance to V = 6 -
Distance to W = 10 (via U → W ) - Distance to X = 13 (via U → V → X) - Distance
to Y is undetermined initially.
2. Next, explore from V : - Update shortest paths: - U → V → W = 6 + 9 = 15 (no
change needed, U → W = 10 is shorter) - U → V → X = 6 + 7 = 13
3. Continue with X: - Shortest path to Y : U → V → X → Y = 13 + 4 = 17.
Final shortest paths from U : - U → U = 0 - U → V = 6 - U → W = 10 - U → X = 13
- U → Y = 17
14. Real-World Application: Discuss the real-world application of shortest path
algorithms in delivery services. How do they optimize delivery routes? Provide a practical
example involving five delivery points.
Solution:
Shortest path algorithms like Dijkstra’s help delivery services optimize routes by find-
ing the quickest path between multiple delivery points, minimizing travel time, fuel con-
sumption, and operational costs. For example, a delivery service with points A, B, C,
D, E can use Dijkstra’s to determine the most efficient route from a warehouse (A) to
deliver packages to B, C, D, and E in a way that minimizes the total distance traveled.
15. Graph Theory Concepts: Define and differentiate between walks, trails, paths,
and circuits. Provide examples of each from a graph with vertices {M, N, O, P, Q} and
edges {(M, N ), (N, O), (O, P ), (P, Q), (Q, M ), (N, P ), (O, Q)}.
Q O
M N
Solution:
- **Walk**: Any sequence of vertices and edges (repeats allowed). Example: M →
N → O → Q. - **Trail**: A walk without repeating edges. Example: M → N → O →
P → Q. - **Path**: A trail without repeating vertices. Example: M → N → O → P . -
**Circuit**: A trail that starts and ends at the same vertex. Example: M → N → P →
Q → M.
16. Algorithm Efficiency: Analyze the time complexity of Dijkstra’s Algorithm.
Compare it to other shortest path algorithms in terms of efficiency and suitability for
large networks.
Solution:
Dijkstra’s Algorithm has a time complexity of O(V 2 ) with an adjacency matrix and
O(E + V log V ) with a priority queue using an adjacency list. It is efficient for graphs
with non-negative weights but less suitable for graphs with negative weights or very large
sparse networks. The Bellman-Ford algorithm, with a complexity of O(V E), is better for
graphs with negative weights.
17. Hamiltonian Path Exploration: Identify a Hamiltonian path in the graph with
vertices {1, 2, 3, 4, 5, 6} and edges {(1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 1), (1, 4), (2, 5), (3, 6)}.
66
4
5 3
1 2
Solution:
A Hamiltonian path in this graph is: 1 → 2 → 3 → 6 → 5 → 4.
18. Network Traffic Optimization: Describe how Dijkstra’s Algorithm can help
optimize network traffic. Use a simple network of intersections and roads as an example.
Solution:
Dijkstra’s Algorithm can identify the shortest paths through a network of roads and
intersections, allowing for optimized routing to reduce traffic congestion. For instance,
in a city with intersections A, B, C, and D connected by roads with different lengths,
Dijkstra’s will determine the least congested or fastest route from A to D by minimizing
total travel time.
19. Limitations of Algorithms: Discuss the limitations of using Dijkstra’s Al-
gorithm in dynamic networks where weights may change over time. How can these
limitations be addressed?
Solution:
Dijkstra’s Algorithm is less effective in dynamic networks where edge weights (rep-
resenting traffic or congestion) change over time. It assumes static weights and cannot
efficiently update shortest paths in real-time. To address these limitations, adaptive algo-
rithms like the A* algorithm or dynamic routing protocols can be used, which can adjust
paths based on real-time data.
20. Graph Representation: Explain how graphs can be represented in computer
memory. Discuss adjacency lists and matrices, and their advantages in implementing
shortest path algorithms.
Solution:
Graphs are typically represented using: - **Adjacency Matrix**: A 2D array where
matrix entry (i, j) indicates the presence or weight of an edge between vertices i and j.
Efficient for dense graphs but consumes more space. - **Adjacency List**: An array of
lists where each list contains the neighbors of a vertex. More space-efficient for sparse
graphs and faster for algorithms like Dijkstra’s that need to traverse edges.
67
2. G is connected, and removing any edge disconnects G.
Proof. We prove each condition implies the next, and that the last implies the first,
completing a circular argument.
1 =⇒ 2: Assume G is connected and acyclic. Consider any edge e = (u, v) in
G. Since G contains no cycles, e does not participate in any cycle, thus it is a bridge.
Removing e disconnects u and v, and since G was connected, this removal disconnects
the graph.
2 =⇒ 3: Assume G is connected, and removing any edge disconnects G. Each edge
must therefore be a bridge. Initiate a spanning tree algorithm (like BFS or DFS) from
any vertex; each visited edge is necessary to maintain connectivity, leading to a structure
with n−1 edges for n vertices. Adding any more edges would create a cycle, contradicting
the premise that removing any edge disconnects G. Thus, G must have exactly n − 1
edges.
3 =⇒ 4: Assume G has n vertices and n − 1 edges. To show G is connected and has
exactly one path between any pair of vertices, start from any vertex v and connect to all
others. If some vertices cannot be reached, adding edges to connect them would exceed
n − 1 edges, contradicting our premise. Hence, G must be connected.
Moreover, more than one path between any two vertices would imply a cycle (by
traversing one path forward and the other backward), which is impossible under our edge
constraint. This ensures the uniqueness of each path.
4 =⇒ 1: Assume any two vertices in G are connected by exactly one path. This
implies G is connected. If G contained a cycle, there would exist at least two distinct
paths between some vertices (around the cycle in different directions), contradicting the
given condition. Hence, G must also be acyclic.
This circular proof shows that the conditions are equivalent, each characterizing a
graph G as a tree.
a b
1 3 5
68
5.5 Minimum Spanning Trees
Kruskal’s Algorithm involves sorting the edges and adding the smallest edge that
doesn’t form a cycle.
Prim’s Algorithm starts from a vertex and grows the MST by adding the cheapest
adjacent edge not already in the MST.
2. Initialize a forest F (a set of trees), where each vertex in the graph is a separate
tree.
If the edge e connects two different trees, then add it to the MST T , and merge
the two trees into a single tree.
Otherwise, discard e.
5. Repeat step 4 until T has n − 1 edges or until all edges have been checked.
69
C
2
3
1 6
A B
4
5
D E
7
1. Sort the edges by weights: AB(1), AC(2), BC(3), AD(4), BD(5), CE(6), DE(7).
5. The MST T now includes the edges AB, AC, AD, CE with a total minimum cost
of 1 + 2 + 4 + 6 = 13.
1. Sort the edges by weights: BC(1), DE(2), AB(3), CD(4), EF (5), F A(6), AC(7), BD(8).
70
Add AB to T , merge A with B − C.
Add CD to T , merge C − D with B − E.
Add EF to T , merge E − F with A − B − C − D.
5. The MST T now includes BC, DE, AB, CD, EF with a total minimum cost of
1 + 2 + 3 + 4 + 5 = 15.
1. Sort the edges by weights: AB(1), BC(2), AC(3), AD(4), BD(5), CD(6).
5. The MST T now includes AB, BC, AD with a total minimum cost of 1 + 2 + 4 = 7.
Add AB to T .
Add BC to T .
Add CD to T .
5. The MST T now includes AB, BC, CD with a total minimum cost of 10 + 15 + 20 =
45.
71
5.6.6 Example 5: Weighted Cycle Graph
Consider a cycle graph K with vertices A, B, C, D, E and edges AB(2), BC(3), CD(4), DE(5), EA(1).
5. The MST T now includes EA, AB, BC, CD with a total minimum cost of 1 + 2 +
3 + 4 = 10.
2. At each step, select the edge with the minimum weight that connects a vertex in
the tree to a vertex outside the tree.
72
C
2
3
1 6
A B
4
5
D E
7
1. Initialize:
Start with vertex A.
Possible edges to add are AB(1), AC(2), AD(4).
2. First Addition:
Choose AB(1) because it has the lowest weight.
MST now includes A − B.
Update possible edges to add: AC(2), AD(4), BC(3), BD(5).
3. Second Addition:
Choose AC(2) next (smallest connecting edge not forming a cycle).
MST now includes A − B − C.
Update possible edges: AD(4), BC(3), BD(5), CE(6).
4. Third Addition:
Choose BC(3) (next smallest edge, doesn’t create a cycle).
MST now includes A − B − C.
Remaining edges to consider: AD(4), BD(5), CE(6).
5. Fourth Addition:
Add CE(6) to connect C to E.
MST now includes A − B − C − E.
Last vertex D remains, possible edges: AD(4), BD(5), DE(7).
6. Final Addition:
Add AD(4) as it’s the cheapest way to include D.
MST now spans all vertices: A, B, C, D, E with edges AB, AC, BC, CE, AD.
Final MST: The MST formed is AB, AC, BC, CE, AD with a total cost of 1 + 2 +
3 + 6 + 4 = 16.
73
Example 2: Graph G1
Vertices: F, G, H, I, J
Edges with weights: F G(2), F H(6), GI(3), GH(10), HI(1), HJ(5), IJ(4)
1
H I
10
6 3
F 5 G
2 4
Steps:
Example 3: Graph G2
Vertices: A, B, C, D, E
Edges with weights: AB(7), AC(8), BC(5), BD(6), CD(3), DE(2)
3
D C
2
8 5 E
6
A B
7
Steps:
6. Resulting MST: Edges AB, BC, CD, DE with total weight 17.
74
Example 4: Graph G3
Vertices: K, L, M, N, O
Edges with weights: KL(4), KM (1), LN (2), M N (6), N O(5), M O(3)
6
M N
2
1
K L 5
43
Steps:
1. Start from vertex K.
2. Add KM (1) to the MST.
3. Add M O(3) to connect O.
4. Connect M to L via KL(4).
5. Connect L to N via LN (2).
6. Resulting MST: Edges KM, M O, KL, LN with total weight 10.
Example 5: Graph G4
Vertices: P, Q, R, S, T
Edges with weights: P Q(2), P R(6), QR(3), QS(7), RS(8), RT (1), ST (4)
8
S R
6 3
7
1
P 4 Q
2
Steps:
1. Start from vertex R.
2. Add RT (1) to the MST.
3. Connect R to Q via QR(3).
4. Connect Q to P via P Q(2).
5. Finally, connect R to S via RS(8).
6. Resulting MST: Edges RT, QR, P Q, RS with total weight 14.
75
Example 6: Graph G5
Vertices: U, V, W, X, Y
Edges with weights: U V (2), U W (3), V X(5), W X(6), W Y (4), XY (1)
W 6 X
5
3
4 1
U V
2
Steps:
1. Start from vertex U .
2. Add U V (2) to the MST.
3. Connect U to W via U W (3).
4. Connect W to Y via W Y (4).
5. Finally, connect X to Y via XY (1).
6. Resulting MST: Edges U V, U W, W Y, XY with total weight 10.
Example 7: Graph G6
Vertices: A, B, C, D, E, F
Edges with weights: AB(1), BC(2), CD(3), DE(4), EA(5), AF (6), F B(7), F C(8), F D(9), F E(10)
3
D C
9
8
F 2
7
6
4
A B
1
10
5
E
Steps:
1. Start from vertex A.
2. Add AB(1) to the MST.
3. Connect B to C via BC(2).
4. Connect C to D via CD(3).
5. Connect D to E via DE(4).
6. Resulting MST: Edges AB, BC, CD, DE with total weight 10.
76
5.8 TUTORIAL FOUR
1. Define a tree in the context of graph theory.
3. Show that adding any edge to a tree creates exactly one cycle.
4. Given a tree with n vertices, if you remove any edge, how many components will
the graph have?
6. Prove that every tree with at least two vertices has at least two leaves.
10. Using Kruskal’s algorithm, find the MST for a graph with the following edges and
weights: AB(1), AC(2), BC(3), AD(3), CD(4).
11. Apply Prim’s algorithm to find the MST for the graph in the previous question,
starting from vertex A.
12. Explain why Kruskal’s algorithm might not yield a unique MST.
13. How does the removal of a leaf affect the status of a tree?
17. Explain the role of a minimum cut in Kruskal’s and Prim’s algorithms.
18. Given a line tree (a tree in the form of a straight line) with vertices v1 , v2 , . . . , vn ,
write down all the edges.
19. Suppose you have a tree with vertices a, b, c, d, e such that removing vertex c divides
the tree into three disconnected trees. What can be said about vertex c?
20. Describe the process and draw the minimum spanning tree for a graph with ver-
tices A, B, C, D, E and edges AB(7), BC(8), CA(5), AD(6), DE(9), EC(10), BD(7)
using Kruskal’s Algorithm.
77
6 Planar Graphs and Graph Colouring
Definition 6.1. A planar graph is a graph that can be drawn on a plane without any of
its edges crossing, except at their endpoints (vertices). Such a drawing is called a plane
drawing. For convenience, a specific plane drawing of a planar graph is referred to as a
plane graph.
Example 6.2. Consider the complete graph K4 .
78
This formula is fundamental in the field of graph theory and provides insight into the
structural properties of planar graphs.
Example 6.4. Consider the plane graphs illustrated below with their respective numbers
of faces, including an unbounded face called the infinite face.
f4 f3
f5 f4
f1 f7
f2 f6 f1 f2
f8 f3
Observations:
Fig. 1: This graph has eight faces including the unbounded face f4 , demonstrating
the relationship V − E + F = 2.
Fig. 2: This graph has four faces, including an unbounded face, aligning with
Euler’s formula.
Theorem 6.5 (Euler’s Polyhedron Formula). For any convex polyhedron with n vertices,
m edges, and f faces, the following relationship holds:
n − m + f = 2.
n = 8 vertices,
m = 12 edges,
79
f = 6 faces,
and applying Euler’s formula gives:
n − m + f = 8 − 12 + 6 = 2.
This verifies Euler’s formula for a cube.
Corollary 6.7. Let G be a polyhedral graph. Then, with the notation n for vertices, m
for edges, and f for faces, the relationship
n−m+f =2
holds true.
Corollary 6.8. Let G be a plane graph with n vertices, m edges, f faces, and k compo-
nents. Then
n − m + f = k + 1.
Proof. Apply Euler’s formula to each component of G separately, ensuring the infinite
face is counted only once.
80
Example
Consider the graph shown in Figure below, which requires four different colors to properly
color its vertices, making it 4-chromatic.
γ
δ
α α
Coloring analysis:
The graph in Figure demonstrates that no fewer than four colors are required since
it includes structures that prevent a 3-coloring.
Each color represents a distinct group such that no two connected vertices share
the same color.
Every tree and any cycle graph with an even number of vertices is 2-colorable.
Theorem 6.14 (Vertex-degree Coloring). Let G be a simple graph with largest vertex-
degree D. Then G is (D + 1)-colorable.
Proof. We prove this Theorem by induction on the number of vertices, n, in the graph
G.
Base Case: If n = 1, then D = 0 since there are no adjacent vertices. The graph is
trivially (D + 1) = 1-colorable.
Inductive Step: Assume as an induction hypothesis that every simple graph with
n − 1 vertices and largest vertex-degree at most D is (D + 1)-colorable.
Consider a simple graph G with n vertices. Remove any vertex v with its incident
edges from G. The resulting graph, say G′ , has n − 1 vertices and a largest vertex-degree
at most D. By the induction hypothesis, G′ is (D + 1)-colorable.
To extend a (D + 1)-coloring of G′ to a (D + 1)-coloring of G, color v with a color
not used by its (at most D) adjacent vertices in G. This is always possible since there
are D + 1 colors available and at most D adjacent vertices to v, ensuring that there is at
least one color that can be assigned to v to achieve a proper coloring.
Thus, by mathematical induction, the theorem holds for all n.
Consider a simple graph where removing a vertex v significantly simplifies the graph
structure. Below is an example of this operation:
81
v
The vertex v is removed along with its incident edges. This results in a simpler
graph with fewer vertices and potentially fewer constraints on coloring. According to our
induction hypothesis, if the simpler graph can be colored with D + 1 colors, so can the
original graph by assigning a new, unique color to v that differs from those of its adjacent
vertices.
Theorem 6.15 (Brooks, 1941). Let G be a simple connected graph which is not a complete
graph nor an odd cycle. If the largest vertex-degree of G is D (where D ≥ 3), then G is
D-colourable.
Brooks’ theorem provides an important refinement to the general upper limit on the
chromatic number provided by previous Theorem. While the previous theorem suggests
that a graph G with maximum degree D is always (D + 1)-colourable, Brooks’ theorem
narrows this bound to D under specific conditions. This is particularly useful for certain
classes of graphs where the structure allows for a more efficient coloring.
Complete Graphs and Odd Cycles Exclusion: These are excluded in Brooks’
theorem because a complete graph Kn requires n colors (i.e., D + 1 where D = n − 1),
and an odd cycle requires 3 colors regardless of the number of vertices if more than 3.
Theorem 6.16 (Six-Colour Theorem). Every simple planar graph is 6-colourable.
Theorem 6.17 (Five-Colour Theorem). Every simple planar graph is 5-colourable.
Theorem 6.18 (Appel and Haken, 1976). Every simple planar graph is 4-colourable.
2. Explain with an example how a graph can be planar but not a plane graph.
3. Prove that a planar graph with n ≥ 3 vertices and no cycles has n − 1 edges.
4. Using Euler’s formula, find the number of faces for a planar graph with 6 vertices
and 10 edges.
5. Draw a planar graph with exactly 5 faces and explain why it fulfills Euler’s formula.
6. Show that adding any edge to a planar graph can affect its planarity.
8. Discuss the limitations of plane graphs when it comes to complex network repre-
sentations.
82
11. Apply the Five-Colour Theorem to color a simple planar graph with 7 vertices and
10 edges.
12. Construct a planar graph that requires exactly 6 colors and justify your coloring.
13. Illustrate a scenario where a planar graph can be colored with only two colors.
14. Solve for the chromatic number of a tree graph with 10 vertices.
16. Draw a planar graph with n vertices, 3n − 6 edges, and prove it is maximal (no
more edges can be added without losing planarity).
17. Explain how the Four-Colour Theorem simplifies the process of map coloring.
18. Use Prim’s algorithm to find the MST for a planar graph and compare the result
with Kruskal’s algorithm.
19. Given a planar graph, devise a method to determine the minimum number of colors
needed (without using the Four-Colour Theorem).
20. Critically analyze the impact of graph density on the colorability and planarity of
a graph.
83