Topic 11 Path and Cycle
Topic 11 Path and Cycle
Topic 11 Path and Cycle
11
LEARNING OUTCOMES
By the end of this topic, you should be able to:
1. Explain the concept of path and cycle; and
2. Identify the graphs with EulerÊs path and cycle and graphs with
HamiltonÊs path and cycle.
X INTRODUCTION
Many problems involve determining whether there is a path within a graph that
connects a vertex to another vertex. For example, if we model a computer
network as a graph, we may need to find the best route to deliver a message from
one computer to another computer. In this topic, we are going to discuss about
the concept of path in a graph. Another related concept, that is cycle will also be
discussed in this topic.
11.1 PATH
SELF-CHECK 11.1
Example 11.1a
In the graph below, (1, e1, 2, e2, 3, e3, 4, e4, 2) is a path of length 4 from vertex 1 to vertex 2.
Definition 11.1b: A path that begins and ends at the same vertex is called a
cycle.
Definition 11.1c: A path or cycle is called simple if it does not contain the
same edge more than once.
Example 11.1b
Consider the graph in example 11.1a.
We can simplify the notation for a path by just stating the vertices or
edges. For example, the path (2, e2, 3,e3, 4, e4, 2) can also be stated as path
(2,3,4) or path (e2, e3, e4).
138X TOPIC 11 PATH AND CYCLE
ACTIVITY 11.1
1. Determine whether the given path in the graph is a simple path, a
cycle or a simple cycle
(a) (b, b)
(b) (e, d, c, b)
(c) (b, c, d, a, b, e, d, c, b)
(d) (a, d, c, b, e)
(e) (d)
3. For each of the following graphs, state one of its path, simple path,
cycle and simple cycle.
(a) (b)
(c) (d)
TOPIC 11 PATH AND CYCLE W 139
Example 11.2a
The graph G as shown in figure 11.2 is connected since, given any vertices v
and w in G, there is a path from v to w. For example, there is a path from
vertex 1 to vertex 7, that is (1,2,6,7).
Example 11.2b
The graph G as shown in figure 11.3 is not connected since, for example, there is
no path from vertex v2 to vertex v5.
ACTIVITY 11.2
Determine whether the graphs below are connected or not connected:
(a) (b)
(c)
11.3 COMPONENTS
Example 11.3a
Example 11.3b
ACTIVITY 11.3
Try to think how we can interact with the computer.
SELF-CHECK 11.2
By using Euler path and cycle, how can you solve the problem
if Malaysia would like to add more bridges connection from Johor
Bahru and Singapore?
142X TOPIC 11 PATH AND CYCLE
The concept of Euler Path and Euler Cycle was introduced by Leonhard
Euler in order to solve the famous Konigsberg bridge problem. In the
eighteenth century, there were seven bridges connecting the four regions
that were divided by the branches of Pregel River, as shown in the Figure
11.5 below.
The problem was: Is it possible to start at some location in the town, travel across
all the bridges without crossing any bridge twice, and return to the starting
point?
Euler solved the problem by modeling the four regions as vertices and the seven
bridges as edges of a graph, as shown below. The problem was then rephrased
into: Is there a simple cycle in this graph that contains every edge?
The problem of finding an Euler path and cycle can be solved by using these
three theorems.
Theorem 11.4a: If a graph G has an Euler path not an Euler cycle if and only if it
has exactly two vertices of odd degree.
Theorem 11.4b: If a graph G has an Euler cycle, then G is connected and every
vertex has even degree.
Theorem 11.4c: If G is a connected graph and every vertex has even degree,
then G has an Euler cycle.
Example 11.4a
Let G be the graph as shown in figure 11.7. Use theorem 11.4a and 11.4b to verify
that G has an Euler cycle. Find an Euler cycle for G
(v6, v4, v7, v1, v3, v4, v1, v2, v5, v4, v2, v3, v6)
Example 11.4b
The graph below has an Euler path but not an Euler cycle.
ACTIVITY 11.4
1. Let G be a connected graph with four vertices v1, v2, v3 and v4 of odd
degree. Show that there are paths with no repeated edges from v1 to v2
and from v3 to v4 such that every edge in G is in exactly one of the paths.
where v0 = vn edge in G occurs exactly one time, and all vertices appear.
Show that a directed graph G contains a directed Euler cycle if and only
if the undirected graph obtained by ignoring the directions of the edges
of G is connected and in (v) = out (v) for every vertex v in G.
TOPIC 11 PATH AND CYCLE W 145
Example 11.5a
The cycle (a, b, c, d, e, f, g, a) is a Hamilton cycle for the graph as shown in figure
11.9
Furthermore, unlike the situation for Euler cycle, no easily verified necessary and
sufficient conditions are known for the existence of a Hamilton cycle in a graph.
146X TOPIC 11 PATH AND CYCLE
ACTIVITY 11.5
1. Show that none of the graphs contains a Hamilton cycle
The following website has a 32 pages of PDF file format. You can download and
read it offline. The notes are short but comprehensive.
URL: http://appsrv.cse.cuhk.edu.hk/~csc3190/csc3190_lecture12.pdf