Professional Documents
Culture Documents
CIRCUITS
Greedy
Hamiltonian Circuit Algorithm
Hamiltonian
Path
Edge-
Dirac's Theorem Picking
algorithm
Hamiltonian Weighted Graphs
• Hamiltonian Path - a path that visit each
vertex of the graph exactly once
• Hamiltonian Circuit - a path that uses its
vertex of a graph exactly at once and
returns to the starting vertex
• Hamiltonian - A graph that contains a
Hamiltonian circuit
In Euler circuits, closed paths used every edge exactly
once, possibly visiting a vertex more than once. On the
contrary, in Hamiltonian circuits, paths visit each vertex
exactly once, possibly not passing through some of the
edges. But unlike the Euler circuit, where the Eulerian
Graph Theorem is used to determine whether it contains
an Euler circuit or not, there is no straightforward
criterion to determine whether or not a Hamiltonian
circuit exists in a graph.
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 a degree of at least n/2,
then the graph must be Hamiltonian
Example:
There are ten vertices in the graph, so n=10 and n/2=5. Now,
vertex Manila has nine edges, TokyoTokyo five, Seoul five, Taipei Tokyo
called weight.
there is a need to know which of these Hamiltonian routes is the
cheapest. Hence, it isKuala butLumpur
important that one focuses in the
distances between two cities. This distances can be represented
using weighted graphs. Singapore
Draw a graph thatFind two different
Cagayan de
Example 7. An application
Palawan
Manila
represents this routes that visit each of
Ozamis
Davao
Cebu
Oro
of Hamiltonian Circuits
information where
The table on the right
each the places and return to
vertex represents
lists down the distances a city its
Manila
starting
- 355
point
485 589
without
358 477
and
(miles)an between
edge connects
the Cebuvisiting
355 - any137 city
240 354twice.
140
two
citiesvertices
having ifdirect
the twoCompare
Cagayan
de Oro485 137 - the
118 414 total
64
cities
routes have a direct
as well as theflight number
Davao 589 240 118 of - 495 miles
133
corresponding
with distances Palawa
their corresponding travelled by each of
358 354 414 495 - 363
between them. n
weights. these routes.
Ozamis 477 148 64 133 363 -
Solution:
A. The graph along with the weight of the edges is shown B. One Hamiltonian circuit is
below
Manila Cebu Ozamis - Cagayan de Oro- Cebu -
355 Palawan - Manila - Davao then
148 back to Ozamis. The total distance
travelled is 64 + 137 + 354 + 358 +
477 354
589+ 133 = 1635 miles. Another
455 node route is Ozamis - Davao -
589 358
Cagayan de Oro - Palawan- Cebu
Ozamis 363 Palawan
- Manila then back to Ozamis. This
64
240 circuit has a total distance of 133 +
133 414 118 + 414 + 354 + 355 + 477 =
137 1851 miles. Obviously, the first
495 node route is shorter than the
118 second.
Dava Cagayan de Oro
o
In
Theexample 7, we computed two Hamiltonian routes. But these results do
Greedy Algorithm
not guarantee that one of them is the shortest distance travelled. From
the 1.solution
Choose in a vertex
example to start
7, at,is and then travel
Ozamiz all along
- Cagayan de the
Oroconnected
- Cebu -
edge that
Palawan has the- smallest
- Manila Davao -weight.
Ozamis(Ifthetwoshortest
or moreroute?
edges have
Theretheis no
same weight,
guarantee. pickisany
If this the one.)
case, how can the shortest route be determined
after visiting all the cities exactly once and going back to the origin city?
One2.method
After arriving at the
is to list downnextallvertext, travel along
Hamiltonian an edge
circuits, of the
compute the total
smallest and
weight, weight that connects
choose to a vertex
the smallest not yetUnfortunately,
total weight. visited. Continue
this is
this process
tedious until you
specially when have
thevisited
numberall vertices.
of possible circuits is too large.
However, there are two algorithns, the greedy algorithm and the edge-
3. Return
picking to the starting
algorithm, that canvertex.
help in finding a good solution. Note that
these both algorithms apply only to complete graphs.
Solution using the Greedy Algorithm:
To find the least route that Aaron can take, one can
find a Hamiltonian circuit using the greedy
Example
algorithm. By 8:trial and error, one Hamiltonian Aaron
Aaron, Belle, house Carol, TAKE 13 NOTE:
Carol
circuit is from Aaron's - Belle's house -
Carol's
Donna.houseEric,- and
Donna's house
Fe are - Eric's
best of house - Fe's The7 Greedy
house and back to Aaron's. The total weight of the
friends. The following figure 12
Algorithm 8
circuit is 1 + 2+ 3 + 9 + 6 + 12 = 33. But there are
shows the distances attempts to give
other Hamiltonian circuits from(inAaron's house. 4
Planar Non-planar