Hamiltonian Circuits
Hamiltonian Circuits
Hamilton Circuit
Topics in Contemporary Mathematics
MA 103
Summer II, 2013
Example 1
Example 1
Example 1
Example 1
Example 1
Example 1
10
11
12
13
Complete Graph
A graph with N vertices in which every pair of
distinct vertices is joined by an edge is called
a complete graph on N vertices and is denoted by
the symbol KN .
14
15
NUMBER OF EDGES IN KN
16
Example 2
Hamilton Circuits in K4
17
Example 2
Hamilton Circuits in K4
18
Example 2
Hamilton Circuits in K4
19
Example 2
Hamilton Circuits in K4
20
Example 2
Hamilton Circuits in K4
21
Example 2
Hamilton Circuits in K5
22
Example 2
Hamilton Circuits in K5
23
Example 2
Hamilton
Circuits in K5
24
Example 2
Hamilton Circuits in K5
25
26
NUMBER OF HAMILTON
CIRCUITS IN KN
! KN has N(N 1)/2 edges. !
!Of all graphs with N vertices and no
multiple edges or loops, KN has the
most edges. !
27
28
Delivering Packages
Package
delivery
companies
such
as
UPS
and
FedEx
deal
with
TSPs
on
a
daily
basis.
Each
truck
is
a
traveler
that
must
deliver
packages
to
a
specic
list
of
delivery
des.na.ons
(the
sites).
The
travel
.me
between
any
two
delivery
sites
(the
cost)
is
known
or
can
be
es.mated.
Each
day
the
truck
must
deliver
to
all
the
sites
on
its
list,
so
a
tour
is
an
implied
part
of
the
requirements.
Since
one
can
assume
that
the
driver
would
rather
be
home
than
out
delivering
packages,
an
op.mal
tour
is
a
highly
desirable
goal.
Modeling a TSP
Every
TSP
can
be
modeled
by
a
weighted
graph,
that
is,
a
graph
such
that
there
is
a
number
associated
with
each
edge
(called
the
weight
of
the
edge).
The
beauty
of
this
approach
is
that
the
model
always
has
the
same
structure:
The
verMces
of
the
graph
are
the
sites
of
the
TSP,
and
there
is
an
edge
between
X
and
Y
if
there
is
a
direct
link
for
the
traveler
to
travel
from
site
X
to
site
Y.
Moreover,
the
weight
of
the
edge
XY
is
the
cost
of
travel
between
X
and
Y.
Modeling a TSP
In
this
seXng
a
tour
is
a
Hamilton
circuit
of
the
graph,
and
an
op.mal
tour
is
the
Hamilton
circuit
of
least
total
weight.
In
all
the
applica.ons
and
examples
we
will
be
considering,
we
will
make
the
assumpMon
that
there
is
an
edge
connecMng
every
pair
of
sites,
which
implies
that
the
underlying
graph
model
is
always
a
complete
weighted
graph.
The
following
is
a
summary
of
the
preceding
observa.ons.
Example 3
STRATEGY 1
(EXHAUSTIVE SEARCH)
Make a list of all possible Hamilton
circuits. For each circuit in the list,
calculate the weight of the circuit. From
all the circuits, choose a circuit with
least total weight. This is your optimal
tour.
Example 4
Example 4
Example 4
Example 4
STRATEGY 2
(GO CHEAP)
Start from the home city. From there go
to the city that is the cheapest to get to.
From each new city go to the next new
city that is cheapest to get to. When
there are no more new cities to go to, go
back home.
Example 5
Example 5
Using a Computer
Even
with
the
worlds
best
technology
on
our
side,
we
very
quickly
reach
the
point
beyond
which
using
the
brute-force
algorithm
is
completely
unrealisMc.
Superhero
is
the
fastest
supercomputer
on
the
planet.
Using a Computer
The
brute-force
algorithm
is
a
classic
example
of
what
is
formally
known
as
an
inecient
algorithm
an
algorithm
for
which
the
number
of
steps
needed
to
carry
it
out
grows
disproporMonately
with
the
size
of
the
problem.
The
trouble
with
inecient
algorithms
is
that
they
are
of
limited
prac.cal
usethey
can
realis.cally
be
carried
out
only
when
the
problem
is
small.
RELATIVE ERROR
OF A TOUR (e)
cost of tour
(
=
Example 6
Example 6
Example 6
Cheapest-Link Algorithm
The
idea
behind
the
cheapest-link
algorithm
is
to
piece
together
a
tour
by
picking
the
separate
links
(i.e.,
legs)
of
the
tour
on
the
basis
of
cost.
It
doesnt
ma@er
if
in
the
intermediate
stages
the
links
are
all
over
the
place
if
we
are
careful
at
the
end,
they
will
all
come
together
and
form
a
tour.
This
is
how
it
works:
Look
at
the
enMre
graph
and
choose
the
cheapest
edge
of
the
graph,
wherever
that
edge
may
be.
Once
this
is
done,
choose
the
next
cheapest
edge
of
the
graph,
wherever
that
edge
may
be.
Cheapest-Link Algorithm
Dont
worry
if
that
edge
is
not
adjacent
to
the
rst
edge.
Con.nue
this
way,
each
.me
choosing
the
cheapest
edge
available
but
following
two
rules:
(1) Do
not
allow
a
circuit
to
form
except
at
the
very
end,
and
(2) do
not
allow
three
edges
to
come
together
at
a
vertex.
A
viola.on
of
either
of
these
two
rules
will
prevent
forming
a
Hamilton
circuit.
Conversely,
following
these
two
rules
guarantees
that
the
end
result
will
be
a
Hamilton
circuit.
Example 7
Example 7
Example 7
Example 7
Example 7
Example 7
Example 7
Example 8
Example 8
The
distances
between
sites
(in
miles)
are
given
in
the
graph
shown.
Example 8
Example 8
Example
Here
is
the
cheapest-link
tour
again
(A,
P,
W,
H,
G,
N,
I,
A
with
a
total
length
of
21,400
miles)
is
shown.
Example
Example
Example
Nearest
neighbor:
A,
P,
W,
H,
G,
I,
N,
A
with
a
total
length
of
20,100
miles.
Surprise One
The
rst
surprise
in
in
the
last
example
is
that
the
nearest-neighbor
algorithm
gave
us
a
beRer
tour
than
the
cheapest-link
algorithm.
Some.mes
the
cheapest-link
algorithm
produces
a
be@er
tour
than
the
nearest-neighbor
algorithm,
but
just
as
onen,
its
the
other
way
around.
The
two
algorithms
are
dierent
but
of
equal
standing
neither
one
can
be
said
to
be
superior
to
the
other
one
in
terms
of
the
quality
of
the
tours
it
produces.
Surprise Two
The
second
surprise
is
that
the
nearest-neighbor
tour
A,
P,
W,
H,
G,
I,
N,
A
turns
out
to
be
an
opMmal
tour.
(This
can
be
veried
using
a
computer
and
the
brute-force
algorithm.)
Essen.ally,
this
means
that
in
this
par.cular
example,
the
simplest
of
all
methods
happens
to
produce
the
op.mal
answera
nice
turn
of
events.
Too
bad
we
cant
count
on
this
happening
on
a
more
consistent
basis!