Professional Documents
Culture Documents
1
Outline
• The TSP for cubic graph
• Special Rule
– Triangle
– 4-cycle
• Example
• Analysis
• Degree Four
• Hamiltonian Cycles
2
Traveling Salesman Problem
• Given a number of cities and the costs of
traveling from any city to any other city.
• What is the least-cost round-trip route that
visits each city exactly once and then
returns to the starting city?
2
1
4 3
1
1
3
Cubic
• 3-regular graph.
• E. g.
4
This Algorithm
• The solution of TSP in a graph of
degree at most three.
• n vertices, in time O(2n/3) ≈
1.260n.
5
Triangle (1/2)
6
Triangle (2/2)
7
4-cycle
8
Example
Case Case
2 1: 2 2: 2
1 1 1 1 1 1 1
1 1 2 2
2 2 2 2
3 3 3
3 3 1 3
1 1
5 4 5 4 5 4
2 2 2
9
Case 2 (1/2)
2 3
1 1 1
2 2 2 2
3 3
1 3 3
1
5 4
5
2 6
10
Case 2 (2/2)
Case 2-1: Case 2-2:
3 3
1 1
2 2 2
2
3 3
3 1 3
1
5 5
6 6
Cost : 21 Cost : 17
11
Case 1
Case 1-1: Case 1-2:
2
2
1 1 1
2 2 1 1 1
2 2
3
3
1 3
1 3
5 4
2 5 4
2
12
Case 1-1
2
1 1 1
2 2 2 4
3
1 3
5 4
2
Cost: 16
13
Case 1-2
2 2
1
1 1 1 1 1 1
2 2 16 2 2
18 3
3 3
1 1
5 4 5 4
2 2
Cost: 17
14
Algorithm Review
• TSP ( G, F):
• 1. Repeat the following steps until one of the steps returns or none of them
applies:
– (a)~(h)
– (i) If G contains a triangle xyz, …
– (j) If G contains a cycle of four unforced edges, …
• 2. If G \ F forms a collection of disjoint 4-cycles, perform the following steps.
• (a)~(e)
• 3. Choose an edge yz according to the following cases:
• (a)~(c)
• 4. TSP(G, F ∪ {yz})
• 5. TSP(G \ {yz}, F)
• 6. Return the minimum of the numbers returned by the two recursive calls.
(step 4, 5)
15
Analysis
• A nonstandard measure of the size of a
graph G: let s(G, F) = |(G)| − |F| − |C|
• C denotes the set of 4-cycles of G that
form connected components of G \ F.
• Clearly, s ≤ n,
16
Chain (1/2)
s(G1,F1) = s(G, F) - 2
17
Chain (2/2)
18
Cycle Length is Six or More
(1/2)
19
Cycle Length is Six or More
(2/2)
20
4-cycle (1/3)
21
4-cycle (2/3)
22
4-cycle (3/3)
(G) - 3
23
Case
24
Time Complexity
• T(s) ≤ 1 + max{ sO(1), T(s − 1), 2T(s − 3),
T(s − 2) + T(s − 5)}.
• T(s) = O(2s/3).
• s is at most n.
• A bound of O(2n/3)
25
Degree Four
• Randomly splitting vertices
27
Listing All Hamiltonian Cycles
29
Graphs with Many Hamiltonian
Cycles (2/2)
31
References (2/2)
• [9] E. L. Lawler. A note on the complexity of the chromatic number problem.
Information Processing Letters, 5(3):66–67, August 1976.
• [10] B. D. McKay and G. F. Royle. Constructing the cubic graphs on up to 20 vertices.
Ars Combinatorica, 21(A):129–140, 1986.
• [11] J. M. Robson. Algorithms for maximum independent sets. J. Algorithms,
7(3):425–440, September 1986.
• [12] N. Schemenauer, T. Peters, and M. L. Hetland. Simple generators. Python
Enhancement Proposal 255, python.org, May 2001.
• [13] R. E. Tarjan and A. E. Trojanowski. Finding a maximum independent set. SIAM
J. Comput., 6(3):537–546, September 1977.
• [14] G. van Rossum et al. Python Language Website. http://www.python.org/.
• [15] B. Vandegriend. Finding Hamiltonian Cycles: Algorithms, Graphs and
Performance. Master’s thesis, Univ. of Alberta, Dept. of Computing Science, 1998.
32