Chapter 4 sec 2

advertisement
Chapter 4 sec. 2
A
famous and difficult
problem to solve in
graph theory.
 1.
Hamiltonian path- A path that
passes through all the vertices of
a graph exactly once.
 2. Hamiltonian circuit- If a
Hamilton path begins and ends at
the same vertex. (If a graph has a
Hamilton circuit we will say it is
Hamiltonian)
Although
the
definitions of Hamilton
path and Euler path
sound similar, they are
not the same. Why?
In
producing a
Hamilton path, you do
not have to trace every
edge, as with an Euler
path.
A
A
B
B
C
C
D
D
Graph (a)
E
E
Graph (b)
 A)
If we start from pt. A, the path
is AEDCB is the Hamilton path.
The path AEDCBA is the Hamilton
circuit.
 B)
There are no Hamilton path or
Hamilton circuits.
A
complete graph-
 Is
one in which every pair of
vertices is joined by an edge.
completed graph with n
vertices is denoted by Kn
A
A
B
C
K3
A
B
C
D
K4
A
C
B
D
ABCDA,
ABDCA,
ACBDA, ACDBA,
ADBCA, ADCBA
 Q:
What if I ask you to find all
the Hamilton circuits for a K6 or
K10?
 A:
I hope that you will not list all
the combinations, but tell me how
many Hamilton circuits there are.
Kn has (n-1)(n-2)(n-3)(n-4)…..3x2x1
Hamilton circuits. When there is a
pattern as shown, it is called a
factorial.
Which is written as (n-1)!.
 Therefore,
 K6
= 5x4x3x2x1 = 5! = 120
Hamilton circuits.
 K10
= 9! = 362,880 Hamilton
circuits.

3 Methods to solve the Travel
Salesperson.

1. Brute Force

2. Nearest Neighbor

3. Best Edge
 Weighted
Graph- we assign
numbers to the edges of a graph.
 Weights-
edges
 Weight
the numbers on the
of a path- is the sum of
the weights of the edges of the
path.
 You
want to conference in 5
different cities across the U.S.
The weights represents money.
(In other problems it could
represent distance or time.)
 The
five cities are:
◦A = Albuquerque
◦L = Las Vegas
◦S = Seattle
◦B = Boston
◦D = Dallas
S
350
230
240
310
B
210
290
A
110
250
180
L
170
D
 Find
the Hamilton circuit that has
the smallest weight.
 Solution:
◦ ALDSBA = $1,120
◦ ASBDLA = $1,110
◦ ADBLSA = $1,210
Adv. Or Disadv.?
 1.
Begin at A (Albq)
 2. View the weights around A.
◦ AB = 210
◦ AS = 230
◦ AD = 180
◦ AL = 110
 3. Since AL has the lowest weight,
that is our next vertex.
 4.
View the weights around L.
◦ LD = 170
◦ LS = 240
◦ LB = 310
 5. D is the lowest and next vertex.
 6. Keep doing this til you reach A.
 Solution: ALDBSA = $1,100



1. Begin by choosing any edge with the
smallest weight.
2. Choose any remaining edge in the graph
with the smallest weight.
3. Keep repeating step 2; however, do not
allow a circuit to form until all vertices
have been used. Also, because the final
hamilton circuit cannot have three edges
joined to the same vertex, new allow this
to happen during the construction of the
circuit.


1. Smallest edge to largest: AL(110), LD(170),
AD(180), AB(210), AS(230), LS(240), BD(250),
SD(290), LB(310), SB(350)
2. AL, LD, (cannot use AD for it closes the
circuit.) DB, BS, SA
Download