Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.3 Hamilton Paths, and Hamilton Circuits.

Similar presentations


Presentation on theme: "Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.3 Hamilton Paths, and Hamilton Circuits."— Presentation transcript:

1 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.3 Hamilton Paths, and Hamilton Circuits

2 Copyright 2013, 2010, 2007, Pearson, Education, Inc. What You Will Learn Hamilton Paths Hamilton Circuits Complete Graphs Traveling Salesman Problems 14.3-2

3 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Hamilton Paths A Hamilton path is a path that contains each vertex of a graph exactly once. 14.3-3

4 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Hamilton Paths The graph shown has Hamilton path A, B, C, E, D. The graph also has Hamilton path C, B, A, D, E. Can you find some others? 14.3-4

5 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Hamilton Paths The graph shown has Hamilton path A, B, C, F, H, E, G, D. The graph also has Hamilton path G, D, E, H, F, C, B, A. Can you find some others? 14.3-5

6 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Hamilton Circuits A Hamilton circuit is a path that begins and ends at the same vertex and passes through all other vertices of the graph exactly one time. 14.3-6

7 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Hamilton Circuits The graph shown has Hamilton circuit A, B, C, E, D, A. Can you find another? 14.3-7

8 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Hamilton Circuits The graph shown has Hamilton circuit A, B, D, G, E, H, F, C, A. A Hamilton circuit starts and ends at the same vertex. 14.3-8

9 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Complete Graph A complete graph is a graph that has an edge between each pair of its vertices. 14.3-9

10 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 2: Finding Hamilton Circuits Determine a Hamilton circuit for the complete graph shown. Solution One is: A, B, C, D, E, A There are many more. 14.3-10

11 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Number of Unique Hamilton Circuits in a Complete Graph The number of unique Hamilton circuits in a complete graph with n vertices is (n – 1)!, where (n – 1)! = (n – 1)(n – 2)(n – 3)…(3)(2)(1) 14.3-11

12 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 4: American Idol Travel Steven Tyler, Jennifer Lopez, and Randy Jackson, the judges for the television show American Idol, are in Hollywood (H). They need to travel to the following cities to judge contestants’ auditions: San Antonio (SA), East Rutherford (ER), Birmingham (B), Memphis (M), and Seattle (S). In how many different ways can Steven, Jennifer, and Randy, traveling together, visit each of these cities and return to Hollywood? 14.3-12

13 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 4: American Idol Travel Solution Represent this problem with the complete graph. 6 vertices represent the 6 locations. Edges represent the one-way flights between these locations. 14.3-13

14 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 4: American Idol Travel Solution Determine the number of Hamilton circuits. There are (6 – 1)! = 5! = 5 4 3 2 1 = 120 different Hamilton circuits. There are 120 ways to start in Hollywood, visit the 5 cities and return to Hollywood. 14.3-14

15 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Traveling Salesman Problems Complete graphs can represent cities and the process of traveling between these cities. Our goal in a traveling salesman problem is to find the least expensive or shortest way to visit each city once and return home. In terms of graph theory, our goal is to find the Hamilton circuit with the lowest associated cost or distance. 14.3-15

16 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Traveling Salesman Problems The Hamilton circuit with the lowest associated cost (or shortest distance, etc.) is called the optimal solution. We will discuss two methods, the brute force method and the nearest neighbor method, for determining the optimal solution. A complete, weighted graph is a complete graph with the weights (or numbers) listed on the edges. 14.3-16

17 Copyright 2013, 2010, 2007, Pearson, Education, Inc. The Brute Force Method of Solving Traveling Salesman Problems To determine the optimal solution: 1.Represent the problem with a complete, weighted graph. 2.List all possible Hamilton circuits for this graph. 3.Determine the cost (or distance) associated with each of these Hamilton circuits. 4.The Hamilton circuit with the lowest cost (or shortest distance) is the optimal solution. 14.3-17

18 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 5: Using the Brute Force Method Julienne Ward is the Southeast District Sales Director for Addison Wesley. On the next slide is a complete, weighted graph, whose numbers represent one- way fares, in dollars, between the cities. We want to use the brute force method to determine the optimal solution for Julienne to visit her regional sales offices. 14.3-18

19 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 5: Using the Brute Force Method She will start in Orlando (O); visit offices in Atlanta (A), Memphis (M), and New Orleans (N); and then return to Orlando. 14.3-19

20 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 5: Using the Brute Force Method Solution There are (4 – 1)! = 3! = 6 possible unique Hamilton circuits we need to examine for costs. We list these Hamilton circuits in the table on the next slide. 14.3-20

21 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 5: Using the Brute Force Method 14.3-21

22 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 5: Using the Brute Force Method Solution Hamilton circuits in column 1. Columns 2 – 5 contain the cost associated with each leg of the circuit. Last column contains the total cost of travel using the given circuit. Two circuits have the lowest cost, $289. These two Hamilton circuits are shown on the maps on the next slide. 14.3-22

23 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 5: Using the Brute Force Method 14.3-23

24 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 5: Using the Brute Force Method Solution The second circuit is the exact reverse order of the first circuit. Although these are different circuits, the cost is the same regardless of the direction flown. Either circuit provides Julienne with the least expensive way to visit each of her regional sales offices. 14.3-24

25 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Nearest Neighbor Method Now we introduce a method for finding an approximate solution to a traveling salesman problem. Approximate solutions can be used in cases where determining the optimal solution is not reasonable. One method for finding an approximate solution is the nearest neighbor method. 14.3-25

26 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Nearest Neighbor Method of Determining an Approximate Solution to a Traveling Salesman Problem To approximate a optimal solution: 1. Represent the problem with a complete, weighted graph. 2.Identify the starting vertex. 14.3-26

27 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Nearest Neighbor Method of Determining an Approximate Solution to a Traveling Salesman Problem 3.Of all the edges attached to the starting vertex, choose the edge that has the smallest weight. This edge is generally either the shortest distance or the lowest cost. Travel along this edge to the second vertex. 14.3-27

28 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Nearest Neighbor Method of Determining an Approximate Solution to a Traveling Salesman Problem 4.At the second vertex, choose the edge that has the smallest weight that does not lead to a vertex already visited. Travel along this edge to the third vertex. 14.3-28

29 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Nearest Neighbor Method of Determining an Approximate Solution to a Traveling Salesman Problem 5.Continue this process, each time moving along the edge with the smallest weight until all vertices are visited. 6.Travel back to the original vertex. 14.3-29

30 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 6: Using the Nearest Neighbor Method In Example 4, we discussed the American Idol judges’ plan to visit five cities in which auditions would take place and then return to Hollywood. Use the nearest neighbor method to determine an approximate solution for the judges’ visits. The one-way per person flight prices between cities are given in the table on the next slide. 14.3-30

31 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 6: Using the Nearest Neighbor Method 14.3-31

32 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 6: Using the Nearest Neighbor Method Solution Here’s the complete, weighted graph. Start at H, go to S. From S, go to SA. From SA, go to B. From B, go to ER. From ER, go to M. From M, go to H. 14.3-32

33 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 6: Using the Nearest Neighbor Method Solution H to S, $108 S to SA, $119 SA to B, $274 B to ER, $258 ER to M, $104 M to H, $144 Total cost is $1007. 14.3-33

34 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 6: Using the Nearest Neighbor Method Solution For comparison, here are 4 randomly chosen Hamilton circuits with costs. 14.3-34

35 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 6: Using the Nearest Neighbor Method Solution From the table, we see that the Hamilton circuit H, ER, M, B, S, SA, H results in a per person cost of $965, which is less than the $1007. Thus, we see that the nearest neighbor method does not always produce the optimal solution. 14.3-35

36 Copyright 2013, 2010, 2007, Pearson, Education, Inc. Example 6: Using the Nearest Neighbor Method Solution The nearest neighbor method produces an approximation for the optimal solution. Without using the brute force method, we cannot determine if the Hamilton circuit H, ER, M, B, S, SA, H is the optimal solution. 14.3-36


Download ppt "Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.3 Hamilton Paths, and Hamilton Circuits."

Similar presentations


Ads by Google