Trials, Paths and Circuits
Mr J.H Sarila
Faculty of Natural and Agricultural Sciences
School of Mathematical and Statistical Sciences
North-West University
(Vanderbijlpark Campus)
Section 10.1: Trials, Paths and Circuits
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Lessons Learnt in Section 1.4 ∼ Language of Graphs
Define and understand Graphs.
Define and understand Directed Graphs.
Define and understand Edges, Vertices and Degree of a Graph.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definition: Graph
A graph G consists of two finite sets: a nonempty set V (G ) of
vertices and a set E (G ) of edges, where each edge is associated
with a set consisting of either one or two vertices called its
endpoints.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definition: In short; Adjacent vertices and Adjacent edges
If two vertices in a graph are connected by an edge, we say
the vertices are adjacent.
Adjacent edges are edges that share a common vertex.
Two edges are Adjacent edges if they share a common
vertex. An edge and a vertex on that edge are called incident.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Welcome to Section 10.1: Trials, Paths and Circuits
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Learning Outcomes of Section 10.1
Define Trials, Paths, Circuits, Walks and Trails .
Connected Graphs.
Euler circuits.
Hamiltonian circuit,.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definitions: Walk, Trail, Path, Circuit
Let G be a graph, and let v and w be vertices in G. A
walk from v to w is a finite alternating sequence of adjacent
vertices and edges of G. Thus a walk has the form
v0 e1 v1 e2 · · · vn−1 en vn ,
where the v’s represent vertices, the e’s represent edges,
v0 = v , vn = w , and for each i = 1, 2, ...n, vi−1 and vi are the
endpoints of ei . The trivial walk from v to v consists of the single
vertex v.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definitions: Walk, Trail, Path, Circuit
A trail from v to w is a walk from v to w that does not contain a
repeated edge.
A path from v to w is a trail that does not contain a repeated
vertex.
A closed walk is a walk that starts and ends at the same vertex.
A circuit is a closed walk that contains at least one edge and does
not contain a repeated edge.
A simple circuit is a circuit that does not have any other repeated
vertex except the first and last.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.1: Notation for Walks
a) In the graph below, the notation e1 e2 e4 e3 refers unambiguously
to the following walk: v1 e1 v2 e2 v3 e4 v3 e3 v2 . On the other hand, the
notation e1 is ambiguous if used by itself to refer to a walk. It
could mean either v1 e1 v2 or v2 e1 v1 .
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.1: Notation for Walks
b) In the graph of part (a), the notation v2 v3 is ambiguous if used
to refer to a walk. It could mean v2 e2 v3 or v2 e3 v3 . On the other
hand, in the graph below, the notation v1 v2 v2 v3 refers
unambiguously to the walk v1 e1 v2 e2 v2 e3 v3 .
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.2: Walks, Trails, Paths, and Circuits
In the graph below, determine which of the following walks are
trails, paths, circuits, or simple circuits.
a) v1 e1 v2 e3 v3 e4 v3 e5 v4
b) e1 e3 e5 e5 e6
c) v2 v3 v4 v5 v3 v6 v2
d) v2 v3 v4 v5 v6 v2
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.2: Walks, Trails, Paths, and Circuits
In the graph below, determine which of the following walks are
trails, paths, circuits, or simple circuits.
e) v1 e1 v2 e1 v1
f) v1
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.2: Solution
a) This walk has a repeated vertex but does not have a repeated
edge, so it is a trail from v1 to v4 but not a path.
b) This is just a walk from v1 to v5 . It is not a trail because it has
a repeated edge.
c) This walk starts and ends at v2 , contains at least one edge, and
does not have a repeated edge, so it is a circuit. Since the vertex
v3 is repeated in the middle, it is not a simple circuit.
d) This walk starts and ends at v2 , contains at least one edge, does
not have a repeated edge, and does not have a repeated vertex.
Thus it is a simple circuit.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.2: Solution Cont...
e) This is just a closed walk starting and ending at v1 . It is not a
circuit because edge e1 is repeated.
f) The first vertex of this walk is the same as its last vertex, but it
does not contain an edge, and so it is not a circuit. It is a closed
walk from v1 to v1 . (It is also a trail from v1 to v1 .)
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definition: Subgraph
A graph H is said to be a subgraph of a graph G if, and only if,
every vertex in H is also a vertex in G, every edge in H is also an
edge in G, and every edge in H has the same endpoints as it has in
G.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.3: Subgraphs
List all subgraphs of the graph G with vertex set {v1 , v2 } and edge
set {e1 , e2 , e3 }, where the endpoints of e1 are v1 and v2 , the
endpoints of e2 are v1 and v2 , and e3 is a loop at v1 .
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definition: Connectedness
Let G be a graph. Two vertices v and w of G are connected if, and
only if, there is a walk from v to w. The graph G is connected if,
and only if, given any two vertices v and w in G, there is a walk
from v to w. Symbolically:
G is connected ⇔ ∀ vertices v and w in G, ∃ a walk from v to w.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.4: Connectedness
Which of the following graphs are connected?
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Lemma 10.1.1
Let G be a graph.
a) If G is connected, then any two distinct vertices of G can be
connected by a path.
b) If vertices v and w are part of a circuit in G and one edge is
removed from the circuit, then there still exists a trail from v to
w in G.
c) If G is connected and G contains a circuit, then an edge of the
circuit can be removed without disconnecting G.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definition: Connected component
A graph H is a connected component of a graph G if, and only if,
1) H is subgraph of G;
2) H is connected; and
3) no connected subgraph of G has H as a subgraph and contains
vertices or edges that are not in H.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.5: Connected component
Find all connected components of the following graph G.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.5: Connected component
Let G be a graph. An Euler circuit for G is a circuit that contains
every vertex and every edge of G. That is, an Euler circuit for G is
a sequence of adjacent vertices and edges in G that has at least
one edge, starts and ends at the same vertex, uses every vertex of
G at least once, and uses every edge of G exactly once.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Theorem 10.1.2
If a graph has an Euler circuit, then every vertex of the graph has
positive even degree.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Contrapositive Version of Theorem 10.1.2
If some vertex of a graph has odd degree, then the graph does not
have an Euler circuit.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.6: Showing That a Graph Does Not Have an Euler
Circuit
Show that the graph below does not have an Euler circuit.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Theorem 10.1.3
If a graph G is connected and the degree of every vertex of G is a
positive even integer, then G has an Euler circuit.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Theorem 10.1.4
A graph G has an Euler circuit if, and only if, G is connected and
every vertex of G has positive even degree.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definition: Euler trail
Let G be a graph, and let v and w be two distinct vertices of G. An
Euler trail from v to w is a sequence of adjacent edges and
vertices that starts at v, ends at w, passes through every vertex of
G at least once, and traverses every edge of G exactly once.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Corollary 10.1.5
Let G be a graph, and let v and w be two distinct vertices of G.
There is an Euler trail from v to w if, and only if, G is connected, v
and w have odd degree, and all other vertices of G have positive
even degree.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.7: Euler trail
The floor plan shown below is for a house that is open for public
viewing. Is it possible to find a trail that starts in room A, ends in
room B, and passes through every interior doorway of the house
exactly once? If so, find such a trail.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Definition: Euler trail
Given a graph G, a Hamiltonian circuit for G is a simple circuit
that includes every vertex of G. That is, a Hamiltonian circuit for
G is a sequence of adjacent vertices and distinct edges in which
every vertex of G appears exactly once, except for the first and the
last, which are the same.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Proposition 10.1.6
If a graph G has a Hamiltonian circuit, then G has a subgraph H
with the following properties:
1) H contains every vertex of G.
2) H is connected.
3) H has the same number of edges as vertices.
4) Every vertex of H has degree 2.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.8 : Showing That a Graph Does Not Have a
Hamiltonian Circuit
Prove that the graph G shown below does not have a Hamiltonian
circuit.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.8 : Solution
If G has a Hamiltonian circuit, then by Proposition 10.1.6, G has a
subgraph H that (1) contains every vertex of G, (2) is connected,
(3) has the same number of edges as vertices, and (4) is such that
every vertex has degree 2.
Suppose such a subgraph H exists. In other words, suppose there is
a connected subgraph H of G such that H has five vertices (a, b, c,
d, e) and five edges and such that every vertex of H has degree 2.
Since the degree of b in G is 4 and every vertex of H has degree 2,
two edges incident on b must be removed from G to create H.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.8 : Solution Cont...
Edge {a, b} cannot be removed because if it were, vertex a would
have degree less than 2 in H. Similar reasoning shows that edges
{e, b}, {b, a}, and {b, d} cannot be removed either.
It follows that the degree of b in H must be 4, which contradicts
the condition that every vertex in H has degree 2 in H. Hence no
such subgraph H exists, and so G does not have a Hamiltonian
circuit.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Exercise 10.1.9 : A Traveling Salesman Problem ∼ HomeWork
Imagine that the drawing below is a map showing four cities and
the distances in kilometers between them. Suppose that a
salesman must travel to each city exactly once, starting and ending
in city A. Which route from city to city will minimize the total
distance that must be traveled?
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Quiz 6
Use mathematical induction to prove that n3 − n + 3 is divisible by
3 for all positive integers n.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Quiz 6: Solutions
Let P(n) be the statement that n3 − n + 3 is divisible by 3 for all
positive integers n.
Step (1): We show that P(1) is true;
Now, 13 − 1 + 3 is divisible by 3.
13 − 1 + 3 = 1 − 1 + 3
=3
=3·1
Hence P(1) is true.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Quiz 6: Solutions Cont...
Step (2): We assume that for all positive integers k, P(k) is true;
that is, k 3 − k + 3 is divisible by 3 or k 3 − k + 3 = 3t for some
positive integer t
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Quiz 6: Solutions Cont...
Step (3): We show that P(k + 1) is true; that is,
(k + 1)3 − (k + 1) + 3 is divisible by 3 or
(k + 1)3 − (k + 1) + 3 = 3m for some positive integer m.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Trials, Paths and Circuits
Quiz 6: Solutions Cont...
Now,
R.H.S = (k + 1)3 − (k + 1) + 3
= k 3 + 3k 2 + 3k + 1 − k − 1 + 3
= k 3 + 3k 2 + 2k + 3
From the Inductive hypothesis:
k 3 − k + 3 = 3t ⇒ k 3 = 3t + k − 3
= k 3 + 3k 2 + 2k + 3
= (3t + k − 3) + 3k 2 + 2k + 3
= 3t + k − 3 + 3k 2 + 2k + 3
= 3t + 3k 2 + 3k
= 3(t + k 2 + k) = 3x, x and t are integers since the sum of
integers is an integer. Hence, P(k+1) is true.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Lessons Learnt in Section 10.1
Define Trials, Paths, Circuits, Walks and Trails .
Connected Graphs.
Euler circuits.
Hamiltonian circuit,.
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS
Sequences
Next Lecture : Section 10.2 ∼ Graphs: Matrix Representations of
Graphs.
Thank you!
Jabulani (Jabu) Sarila - [email protected], Office A-22, G14 MTHS225 - DISCRETE MATHEMATICS