0% found this document useful (0 votes)
25 views34 pages

GED102-1 Module 3 Topic 2 Lesson 2 Eulerian, Hamiltonian and Weighted Graphs

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

GED102-1 Module 3 Topic 2 Lesson 2 Eulerian, Hamiltonian and Weighted Graphs

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

Mathematics in the Modern World

Module 3 – Topic 2
Graph Theory
Lesson 2: Eulerian, Hamiltonian Graphs
and the Weighted Graphs
Introduction

The Königsberg bridge problem was concerned on traversing the


vertices of a graph by passing through each edge only once. With
Euler’s elegant approach in solving the puzzle, all other related
problems were referred to his credit, giving birth to the concept of
Eulerian graphs.
A similar issue was the Travelling Salesman Problem, studied by Sir
William Rowan Hamilton in mid-19th century. This time, the objective
is to find the shortest possible route to traverse the graph passing
through each vertex once. This gave rise to the concept of Hamiltonian
graphs.
Learning Outcomes
At the end of the lesson, students should be able to:

1. Define and illustrate an Eulerian graph;


2. Define and illustrate a Hamiltonian graph and
3. Use the properties of Eulerian and Hamiltonian
graphs to solve practical problems.
Definitions

Given a graph G, a​walk is a sequence


of adjacent vertices.
For example, the sequence A-B-C-
E-F-A-G in the graph traces a walk
from A to G.
This has​length​6 since there are 6
edges traversed in the said walk.
A walk is said to be ​closed​if the first
and last vertices are the same.
Definitions

If a walk has no repeated vertex, then it is


called a ​path.​The walk A-B-C-E-F-A-G is
not a path since the vertex A appeared twice.
Rather, the walk A-B-C-E-F is a path.
Meanwhile, if a walk does not have repeated
edges, then it is called a ​trail​. Note that A-B-
C-E-F-A-G is a trail.
In general, every path is a trail but not
otherwise.
A closed path is called a ​cycle​, while a closed
trail is called a ​circuit.
Definitions

A circuit (or a trail) is said to be ​Eulerian​if it


traverses all the edges of the graph. On the
other hand, a cycle (or a path) is ​Hamiltonian​if
it traverses all the vertices of the graph.

A graph that contains an Eulerian circuit is


called an ​Eulerian graph. ​Likewise, a graph
that has a Hamiltonian cycle is called a ​
Hamiltonian graph.

I​s the graph in the graph on the left Eulerian?


Is it Hamiltonian? Can you specify the Eulerian
circuit and the Hamiltonian cycle if they exist?
Eulerian Graphs

Graph model of the Konigsberg map


Eulerian Graph Theorem

A connected graph is Eulerian if and only if every


vertex of the graph is of even degree.

Euler’s reasoning was simple, to be able to visit a vertex


(other than the starting vertex), two edges are needed, one
for entry and the other for exit.
Eulerian Path Theorem

A connected graph contains an Euler path if and


only if the graph has 2 vertices of odd degree with
all other vertices of even degree. Furthermore,
every Euler path must start at one of the vertices of
odd degree and must end at the other.
Eulerian Graphs

In the case of the Konigsberg graph, all vertices are of odd degree; A
is of degree 5, B is of degree 3, C is of degree 3 and D is of degree
3. Indeed, it will be impossible to go around the area without crossing
any bridge twice. More so, it is not even possible to walk through the
area from one land area to all the other land areas without crossing a
bridge more than once.
Eulerian Graphs

Is this Eulerian?
Exercise
Which graph is Eulerian? Which graph is not Eulerian but contains an
Eulerian path?
Example

The floor plan of a warehouse


is illustrated on the right. Use
a graph to represent the floor
plan, and answer the following
questions: Is it possible to
walk through the warehouse so
that you pass through every
doorway once but not twice? Is
it possible for you to return to
the starting point?
Example

Is it possible to walk through the warehouse so that you pass through every doorway once
but not twice?
Is it possible for you to return to the starting point?
Hamiltonian Graphs

Recall:
A graph is Hamiltonian if it contains a Hamiltonian cycle.
A Hamiltonian cycle is a closed path that traverses all the
vertices of the graph, with each vertex being traversed only
once.

Unlike Eulerian graphs, there is no straightforward


condition that can determine whether a graph is Hamiltonian
or not. Perhaps the more popular theorem that can serve
this purpose is the one proposed by G. A. Dirac in 1952.
Dirac’s Theorem

Consider a connected graph with at least three vertices and


no multiple edges. Let n be the number of vertices in the
graph. If every vertex has degree of at least n/2, then the
graph must be Hamiltonian.
Example

The order of the graph is 5, half of


which is 2.5 or 3. Since each vertex
is of degree 4 which is greater than
3, then Dirac’s theorem guarantees
that the graph is Hamiltonian.

Indeed, because the cycle A-B-D-E-


C-A is a Hamiltonian cycle in G.
Remark
Dirac’s Theorem only provides a sufficient (but not necessary)
condition for Hamilton city. This means that it remains inconclusive if
the minimum degree among the vertices of the graph is less than n/2.

Hamiltonian?
Remark

The graph is of order 6 and half of this number is 3. The minimum degree of the
graph is only 2 (at vertices A and E).
By this, Dirac’s Theorem is no longer applicable and so we cannot test the
Hamiltonicity on the basis of the said theorem.
By trial and error, we can trace a Hamiltonian cycle: A-B-E-F-D-C-A. Thus,
the graph is Hamiltonian.
Exercise: Which Graph is Hamiltonian?
Application
A large law firm has offices in seven major cities. The firm has overnight document deliveries
scheduled every day between certain offices. In the graph below, an edge between vertices
indicates that there is delivery
service between the
corresponding offices.
Use Dirac’s theorem to
answer the following
question:
Using the law firm’s
existing delivery service,
is it possible to route a
document to all the offices
and return the document
to its originating office
without sending it through the same office twice?
Weighted Graphs : Introduction
In many applications, you can use the edges or the vertices of a graph to
represent real-life metrics. In navigation, for example, the vertices may
mean destinations while the edges may mean the distance or cost of
traveling from one point to another. In communication network, the edges
may indicate loading capacity. Informally, any value that is assigned to
the edges is called weight. In such cases, the question of whether the
graph is Eulerian or Hamiltonian should no longer be constrained to
utilizing the vertices or edges of the graph, but to make the process more
efficient by optimizing the weights in the graph.
Assigning weights to the edges of a graph is the labeling aspect of a
graph. Graph labeling has become one rich area of graph theory in terms
of research opportunities because of the unlimited areas where this
concept can be applied.
Learning Outcomes

At the end of the lesson, students should be able to:

1. define and illustrate a weighted graph;


2. explain and execute algorithms for identifying
Hamiltonian cycles in weighted graphs; and
3. use the algorithms to solve practical problems about
weighted graphs.
Definitions

- A graph is considered weighted if its A 8 B


edges are assigned numeric values
2
called weights.
- A weighted graph is a graph where 6 3
every edge has associated numeric 4
value (called weight)
D 5 C

Weighted K4
Illustration
One problem that can be addressed with A 8 B
weighted graphs is to traverse all the vertices
through the least total weights possible. 2

Examine the total weights for all possible 6 3


Hamiltonian cycles of the weighted K4 shown on 4
the right.

D 5 C

Weighted K4
The Greedy Algorithm

1.Choose a vertex to start at, then travel along the


connected edge that has the smallest weight. (If two or
more edges have the same weight, pick any one.)
2.After arriving at the next vertex, travel along the edge of
smallest weight that connects to a vertex not yet visited.
Continue this process until you have visited all vertices.
3.Return to the starting vertex.
The Greedy Algorithm: Illustration

1.Suppose we start at vertex A. By the A 8 B


algorithm, we proceed to vertex C, as the
weight 4 is the least compared to vertex B 2
(weight 8) or to vertex D (weight 6).
6 3
2.From vertex C we proceed to vertex B 4
(weight 3 vs 5 of D). Then to D (weight 2).
3.Go back to A with the weight 6.
D 5 C
The cycle A-C-B-D-A accumulates a total
weight of
4 + 3 + 2 + 6 = 15
Limitation of the Greedy Algorithm

1.Suppose we start at vertex B. In this B


A 8
case, we pick D next.
2.From vertex D we proceed to vertex C, 2
then to vertex A.
6 3
3.Go back to B with the weight 8. 4

The cycle B-D-C-A-B accumulates a total


weight of D 5 C
2 + 5 + 4 + 8 = 19
(not minimum)
Edge-Picking Algorithm
1. Mark the edge with the least weight (choose arbitrarily if the least
weight is carried by 2 or more edges).
2.Mark the edge with the second least weight. Take note of the
following:
i. Choose arbitrary edge in cases of tied weights.
ii. Do not choose an edge if it completes a cycle.
iii. Do not choose an edge if it becomes the third marked edge
incident to a single vertex.
3. Keep repeating Step 2 until there is no more edge available.
4. Mark the last edge that will complete the Hamiltonian cycle.
Edge-Picking Algorithm: Illustration

A 8 B A 8 B A 8 B A 8 B

2 2 2 2

6 3 6 3 6 3 6 3
4 4 4 4

D 5 C D 5 C D 5 C D 5 C

2 + 3 + 4 + 6 = 15
Example
Egay is tasked to distribute examination papers during the quarterly
examination of the mathematics department. From the office, he has
to bring the test papers and answer sheets to four examination areas
in the campus: North Building, South Building, West Building, and
Southwest Building. The table below summarizes the roaming time
from one area to other areas. Determine the roaming route that gives
the least time for the distribution of the examination materials.
Example
Example

Using the Greedy Algorithm:


Office-North-West-Southwest-
South-Office Sum of weights:
7 + 5 + 4 + 3 + 9 = 28
It can take 28 minutes for Egay to
finish the distribution.
Example
Using the Edge-Picking Algorithm:
Order of edge Edge Weight
(time)
1st Southwest – South 3
2nd Southwest – West 4
3rd West – North 5
4th North – Office 7
5th (closing) Office – South 9
TOTAL TIME 28

Possible routes:
Office-South-Southwest-West-North-Office
Office-North-West-Southwest-South-Office

You might also like