Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

No Downloads

Total views

1,719

On SlideShare

0

From Embeds

0

Number of Embeds

14

Shares

0

Downloads

46

Comments

0

Likes

2

No embeds

No notes for slide

- 1. A Mathematical View of Our World 1 st ed. Parks, Musser, Trimpe, Maurer, and Maurer
- 2. Chapter 6 Routes and Networks
- 3. Section 6.1 Routing Problems <ul><li>Goals </li></ul><ul><ul><li>Study graphs, vertices, and edges </li></ul></ul><ul><ul><li>Study paths and circuits </li></ul></ul><ul><ul><li>Study connected graphs </li></ul></ul><ul><ul><ul><li>Use Euler’s Theorem </li></ul></ul></ul><ul><ul><ul><li>Use Fleury’s Algorithm </li></ul></ul></ul>
- 4. 6.1 Initial Problem <ul><li>Can the people of Konigsberg, pictured here, take a walk crossing each bridge exactly one time? </li></ul><ul><ul><li>The solution will be given at the end of the section. </li></ul></ul>
- 5. Graphs <ul><li>A graph is a collection of one or more points, called vertices , and the paths connecting them, called edges . </li></ul><ul><ul><li>The singular of vertices is vertex . </li></ul></ul>
- 6. Graphs <ul><li>The vertices are drawn as dots. </li></ul><ul><li>The edges are drawn as straight or curved lines. </li></ul><ul><ul><li>Each edge has two ends with a vertex at each end, or else it is a loop connecting a vertex to itself. </li></ul></ul>
- 7. Equivalent Graphs <ul><li>Two graphs are considered the same if they have the same number of vertices connected in the same way, even if they look different. </li></ul>
- 8. Example 1 <ul><li>The three graphs shown are equivalent. </li></ul>A is connected to B, B to C, and C to D
- 9. Vertices and Edges <ul><li>Two edges may appear to cross, but they do not actually intersect unless there is a vertex. </li></ul><ul><li>Example: Graph (a) shows two edges crossing where there is no vertex. Think of a road that crosses an interstate but there is not an exit. </li></ul>
- 10. Example 2 <ul><li>Graphs can be drawn to represent real-life connections, such as roads between cities. </li></ul><ul><li>Example: Draw a graph to represent highway connections between Boise, Olympia, Portland, Salem, Seattle, and Spokane. </li></ul>
- 11. Example 2 <ul><li>The vertices represent the cities, and the edges represent the roads. </li></ul><ul><li>4 of the 5 cities are along the same interstate. </li></ul>
- 12. Example 3 <ul><li>List the pairs of adjacent vertices in the graph. </li></ul><ul><li>Two vertices are called adjacent vertices if there is an edge connecting them. </li></ul>
- 13. Example 3, cont’d <ul><li>Solution: The pairs of adjacent vertices are: </li></ul><ul><ul><li>A and B, A and C, A and D, A and E </li></ul></ul><ul><ul><li>B and D </li></ul></ul><ul><ul><li>C and E </li></ul></ul><ul><ul><li>E and E, since there is a loop at E </li></ul></ul>
- 14. Example 4 <ul><li>Draw two different graphs with the following properties : </li></ul><ul><ul><li>Vertices: A, B, C, and D </li></ul></ul><ul><ul><li>Adjacent vertices are: </li></ul></ul><ul><ul><ul><li>A and C, B and C, B and D, C and D. </li></ul></ul></ul>
- 15. Example 4, cont’d <ul><li>Solution: Two possible graphs are shown below. </li></ul><ul><ul><li>Vertices: A, B, C, and D </li></ul></ul><ul><ul><li>Adjacent vertices are: </li></ul></ul><ul><ul><ul><li>A and C, B and C, B and D, C and D. </li></ul></ul></ul>
- 16. Degree of a Vertex <ul><li>The degree of a vertex is the total number of edges at the vertex. </li></ul><ul><ul><li>Find the degree of a vertex by counting the number of edges leaving or arriving at the vertex. </li></ul></ul><ul><ul><li>A loop contributes 2 to the degree of a vertex. </li></ul></ul>
- 17. Example 5 <ul><li>Find the degree of each vertex in the graph. </li></ul>
- 18. Example 5 <ul><li>Find the degree of each vertex in the graph. </li></ul><ul><li>Solution: </li></ul><ul><ul><li>A has degree 5, </li></ul></ul><ul><ul><li>B has degree 3, </li></ul></ul><ul><ul><li>C has degree 2, </li></ul></ul><ul><ul><li>D has degree 2, </li></ul></ul><ul><ul><li>E has degree 4. </li></ul></ul>
- 19. Example 5 <ul><ul><li>A has degree 5, </li></ul></ul><ul><ul><li>B has degree 3, </li></ul></ul><ul><ul><li>C has degree 2, </li></ul></ul><ul><ul><li>D has degree 2, </li></ul></ul><ul><ul><li>E has degree 4. </li></ul></ul><ul><ul><li>How many edges are there? _____ </li></ul></ul><ul><ul><li>How many total degrees are there? </li></ul></ul>
- 20. Theorem <ul><li>If d is the sum of all the degrees of the vertices in a graph and e is the number of edges in the graph, then </li></ul><ul><li>d = 2 e . </li></ul><ul><ul><ul><li>Note: This theorem is true because each edge adds 2 to the degree total. </li></ul></ul></ul>
- 21. Example 6 <ul><li>Verify that the theorem is true for the following graph. </li></ul><ul><li>Solution: The sum of the degrees is 16. The number of edges is 8. Check that 16 = 2(8). </li></ul>
- 22. Paths <ul><li>A path is a route in a graph. </li></ul><ul><ul><li>Each vertex used is adjacent to the next vertex used. </li></ul></ul><ul><ul><li>Each edge in the graph is used at most one time. </li></ul></ul><ul><li>A path is written as a list of vertices. </li></ul>
- 23. Example 7 <ul><li>Find three different paths in the graph. </li></ul><ul><li>Solution: </li></ul><ul><ul><li>One possible path is A,B,D,A,E . </li></ul></ul><ul><ul><li>A second path is B,A,B,D. </li></ul></ul><ul><ul><li>A third path is C,E,E,A </li></ul></ul><ul><ul><ul><li>There are many other paths. </li></ul></ul></ul>
- 24. Circuits <ul><li>A circuit is a path that begins and ends at the same vertex. </li></ul><ul><li>Example: One circuit in the graph is A,B,D,A. </li></ul>
- 25. Euler Paths <ul><li>A path that uses every edge of a graph exactly once is called an Euler path . (Euler is pronounced “oiler.”) </li></ul><ul><li>Example: The edges are numbered in the order used. </li></ul>
- 26. Euler Circuits <ul><li>A circuit that uses every edge of a graph exactly once is called an Euler circuit . </li></ul><ul><li>Example: The edges are numbered in the order used. </li></ul>
- 27. Connected Graphs <ul><li>A graph is said to be connected if, for every pair of vertices, there is a path that contains them. </li></ul><ul><li>If a graph is not connected, it is said to be disconnected . </li></ul><ul><ul><li>An edge is called a bridge if its removal from the graph would change the graph from connected to disconnected. </li></ul></ul>
- 28. Example 8 <ul><li>Explain whether or not the graphs are connected. </li></ul><ul><ul><li>Solution: The graph is connected because there is a path, using one edge or more, between every pair of vertices. </li></ul></ul>
- 29. Example 8, cont’d <ul><ul><li>Solution 2: The graph is disconnected because, for example, there is no path between vertex A and vertex G. </li></ul></ul>
- 30. Example 9 <ul><li>Identify any bridges in the (connected) graph. </li></ul><ul><li>Solution: There are three bridges: the edge between D and E, the edge between D and F, and the edge between F and G. </li></ul>
- 31. Example 10 <ul><li>Find all components of the graph. </li></ul><ul><li>There are three components: the piece containing A, E, F, and G; the piece containing B and C; and the piece containing D. </li></ul>
- 32. Degree Theorem <ul><li>Any graph must have an even number of vertices with odd degree. </li></ul><ul><ul><li>We saw earlier that the sum of all the degrees in a graph is always an even number, so: </li></ul></ul><ul><ul><ul><li>Vertices with even degrees do not have to come in pairs. </li></ul></ul></ul><ul><ul><ul><li>Vertices with odd degrees come in pairs. </li></ul></ul></ul>
- 33. Euler’s Theorem <ul><li>For a connected graph: </li></ul><ul><ul><li>If the graph has zero vertices of odd degree, then it has at least one Euler circuit. </li></ul></ul><ul><ul><li>If a graph has an Euler circuit, then it has no vertices of odd degree. </li></ul></ul>
- 34. Euler’s Theorem cont’d <ul><li>For a connected graph: </li></ul><ul><ul><li>If the graph has exactly two vertices of odd degree, then </li></ul></ul><ul><ul><ul><li>It does not have an Euler circuit . </li></ul></ul></ul><ul><ul><ul><li>It has at least one Euler path . </li></ul></ul></ul><ul><ul><ul><li>Any Euler path starts at one of the two vertices of odd degree and ends at the other. </li></ul></ul></ul>
- 35. Euler’s Theorem cont’d <ul><li>For a connected graph: </li></ul><ul><ul><li>If the graph has more than two vertices of odd degree, then </li></ul></ul><ul><ul><ul><li>It does not have an Euler circuit. </li></ul></ul></ul><ul><ul><ul><li>It does not have an Euler path. </li></ul></ul></ul>
- 36. Example 11 <ul><li>Does the graph have an Euler circuit, Euler path, or neither? </li></ul>2 F 2 E 4 D 2 C 4 B 4 A Degree Vertex
- 37. Example 11 <ul><ul><li>Solution: Every vertex is of degree 2 or degree 4, so by Euler’s theorem the graph has an Euler circuit. </li></ul></ul><ul><li>Does the graph have an Euler circuit, Euler path, or neither? </li></ul>
- 38. Example 11, cont’d <ul><ul><li>Solution: There are two vertices of odd degree, E and G, so by Euler’s theorem the graph has only an Euler path. </li></ul></ul>
- 39. Fleury’s Algorithm <ul><li>If Euler’s Theorem indicates that there is an Euler circuit, Fleury’s Algorithm can be used to find the circuit. </li></ul><ul><li>The step-by-step procedure is as follows: </li></ul><ul><ul><li>Copy all the vertices, but not the edges, of the original graph. </li></ul></ul><ul><ul><li>Select any vertex on the original graph and mark it as the present position. </li></ul></ul>
- 40. Fleury’s Algorithm, cont’d <ul><ul><li>Choose one edge at the marked vertex and transfer it to the new graph. </li></ul></ul><ul><ul><ul><li>Do not choose a bridge, unless it is the only edge available. </li></ul></ul></ul><ul><ul><ul><li>Number the edges in the order they are transferred. </li></ul></ul></ul>
- 41. Fleury’s Algorithm, cont’d <ul><ul><li>Use the vertex on the other end of the edge as the new present position. Repeat step 3. </li></ul></ul><ul><ul><li>When you transfer the last edge you are done. </li></ul></ul>
- 42. Example 12 <ul><li>Use Fleury’s Algorithm to find an Euler circuit for the graph. (See ex.6.10 pgs 350-352 in text.) </li></ul><ul><li>Possible Final Solution: </li></ul>
- 43. 6.1 Initial Problem Solution <ul><li>The idea of Euler circuits can be used to solve the question of whether the people of Konigsberg can take a walk crossing each bridge exactly one time. </li></ul>
- 44. Initial Problem Solution, cont’d <ul><li>The vertices represent the land and the edges the bridges. The described walk would be an Euler path. </li></ul><ul><li>We use Euler’s Theorem to show that there is no such path for their walk because there are four vertices of odd degree. </li></ul>
- 45. Section 6.1 Assignment <ul><li>Pg 353 (3, 11a,b, 17-19,25,27,39) </li></ul>
- 46. Section 6.2 Network Problems <ul><li>Goals </li></ul><ul><ul><li>Study weighted graphs </li></ul></ul><ul><ul><li>Study spanning trees </li></ul></ul><ul><ul><ul><li>Study minimal spanning trees </li></ul></ul></ul><ul><ul><ul><li>Use Kruskal’s algorithm </li></ul></ul></ul>
- 47. 6.2 Initial Problem <ul><li>How can the walkways be constructed so that: </li></ul><ul><ul><li>Students can go from any building on campus to any other building without needing to walk outside. </li></ul></ul><ul><ul><li>The total length of the walkways is minimized. </li></ul></ul><ul><ul><li>The solution will be given at the end of the section. </li></ul></ul>
- 48. Weighted Graphs <ul><li>A graph in which each edge has a number associated with it is called a weighted graph . The number corresponding to an edge is called the weight of the edge. </li></ul>
- 49. Example 1 <ul><li>Suppose Ed has: </li></ul><ul><ul><li>A 35-minute drive from his home to his workplace </li></ul></ul><ul><ul><li>A 15-minute drive from his workplace to his health club </li></ul></ul><ul><ul><li>A 25 minute drive from his health club to his home </li></ul></ul><ul><li>Draw a weighted graph to represent this situation. </li></ul>
- 50. Example 1, cont’d <ul><li>Solution: </li></ul><ul><ul><li>The vertices of the graph will represent Ed’s home ( H ), his workplace ( W ), and his health club ( C ). </li></ul></ul><ul><ul><li>The weight of each edge will represent the driving time between the two places. </li></ul></ul><ul><ul><li>For simplicity, we can draw all the edges as straight lines and with the same length. </li></ul></ul>
- 51. Example 1, cont’d <ul><li>Solution, cont’d: One possible weighted graph is shown below. </li></ul>
- 52. Redundant Edges <ul><li>Redundant edges are edges that can be removed while still leaving a path between the two vertices. </li></ul><ul><li>Example: If edge CH is removed from this graph, Ed can still get from home to his club by driving to work and then to the club. </li></ul><ul><ul><li>The edge CH is a redundant edge. </li></ul></ul>
- 53. Subgraphs <ul><li>A subgraph of a given graph is a set of vertices and edges chosen from among those of the original graph. </li></ul><ul><li>Example: Removing edge CH creates the subgraph shown at right. </li></ul>
- 54. Subgraphs <ul><li>Example: Another subgraph could be created by removing vertex C and its two incident edges. </li></ul>
- 55. Example 2 <ul><li>A bus line goes between the cities shown in the table. </li></ul><ul><ul><li>Draw a weighted graph to represent the situation. </li></ul></ul><ul><ul><li>Find two different routes from Selma to Anniston. </li></ul></ul>
- 56. Example 2 <ul><li>Solution: A weighted graph is shown below. </li></ul>
- 57. Example 2 <ul><li>Solution: One possible route from Selma to Anniston is SMGA , with a total weight (length) of 49 + 127 + 27 = 203 miles. </li></ul>
- 58. Example 2 <ul><li>Solution, cont’d: Another possible route from Selma to Anniston is SBA , with a total weight (length) of 160 + 62 = 222 miles. </li></ul>
- 59. Trees <ul><li>One way to recognize that a graph contains redundant edges is to find a circuit in the graph. </li></ul><ul><ul><li>Recall that a circuit is a path that begins at a vertex and returns to that vertex without using any edges twice. </li></ul></ul><ul><li>A connected graph that has no circuits is called a tree . </li></ul>
- 60. Trees, cont’d <ul><li>The following figure gives examples of graphs that are trees and a graph that is not a tree. </li></ul>
- 61. Example 3 <ul><li>This graph is not a tree because it contains several circuits. </li></ul><ul><li>Find a subgraph that is a tree. </li></ul>
- 62. Example 3 <ul><li>Solution: Circuits are highlighted and edges are removed until the remaining subgraph has no circuits left. </li></ul>
- 63. Spanning Trees <ul><li>A spanning tree is a subgraph that: </li></ul><ul><ul><li>Contains all the original vertices of the graph. </li></ul></ul><ul><ul><li>Is connected. </li></ul></ul><ul><ul><li>Contains no circuits. </li></ul></ul>
- 64. Spanning Trees <ul><li>Every connected graph has at least one spanning tree. </li></ul><ul><li>An example of a spanning tree is shown below. </li></ul>
- 65. Minimal Spanning Trees <ul><li>A spanning tree with the smallest possible total weight is called a minimal spanning tree . </li></ul><ul><ul><li>Since a connected, weighted graph can have multiple spanning trees, there may be one or more than one of those spanning trees with the smallest total weight. </li></ul></ul>
- 66. Minimal Spanning Trees <ul><li>For the connected, weighted graph shown below: </li></ul><ul><ul><li>Subgraph (b) is not a minimal spanning tree. </li></ul></ul><ul><ul><li>Subgraph (c) is a minimal spanning tree. </li></ul></ul>
- 67. Kruskal’s Algorithm <ul><li>A method known as Kruskal’s algorithm can be used to find a minimal spanning tree of a connected, weighted graph. </li></ul><ul><li>Kruskal’s algorithm begins with all the vertices of a graph and adds edges one by one, using the idea of acceptable and unacceptable edges. </li></ul>
- 68. Kruskal’s Algorithm <ul><li>Acceptable edges are </li></ul><ul><ul><li>Edges that do not share a vertex with any edges already chosen. </li></ul></ul>
- 69. Kruskal’s Algorithm <ul><li>Acceptable edges are </li></ul><ul><ul><li>Edges that connect two components of the subgraph. </li></ul></ul>
- 70. Kruskal’s Algorithm <ul><li>Acceptable edges are </li></ul><ul><ul><li>Edges that connect a component of the subgraph to a new vertex. </li></ul></ul>
- 71. Kruskal’s Algorithm <ul><li>Unacceptable edges are </li></ul><ul><ul><li>Edges that add to a component of the subgraph, but do not add a new vertex. </li></ul></ul>
- 72. Kruskal’s Algorithm <ul><li>Consider only the vertices of the graph. </li></ul><ul><li>Add the edge with the smallest weight. </li></ul><ul><li>Add the acceptable edge with the smallest weight. </li></ul><ul><li>Determine whether all vertices are connected by a path. </li></ul><ul><ul><li>If so, you have a minimal spanning tree. </li></ul></ul><ul><ul><li>If not, repeat Step 3. </li></ul></ul>
- 73. Example 4 <ul><li>Construct a minimal spanning tree for the weighted graph. </li></ul>
- 74. Example 4 <ul><li>Solution: </li></ul><ul><ul><li>Start with the 4 vertices. </li></ul></ul><ul><ul><li>Add the edge with the smallest weight. </li></ul></ul>
- 75. Example 4 <ul><li>Solution, cont’d: </li></ul><ul><ul><li>All unused edges are acceptable, so we simply choose the edge with the smallest weight. </li></ul></ul><ul><ul><ul><li>Select the edge with weight 2.6. </li></ul></ul></ul>
- 76. Example 4 <ul><li>Solution, cont’d: </li></ul><ul><ul><li>The acceptable edges at this step were the ones with weights 4.8 and 3.7. </li></ul></ul><ul><ul><ul><li>Select the edge with weight 3.7. </li></ul></ul></ul>
- 77. Example 4 <ul><li>Solution, cont’d: </li></ul><ul><ul><li>The subgraph is now connected, so this is a minimal spanning tree. </li></ul></ul><ul><ul><ul><li>The weight of the tree is 1.5 + 2.6 + 3.7 = 7.8. </li></ul></ul></ul>
- 78. 6.2 Initial Problem Solution <ul><li>How can a college build walkways of the minimum length possible so that students can go from any building on campus to any other building without needing to walk outside? </li></ul>
- 79. Initial Problem Solution <ul><li>Create a weighted graph to represent the buildings and existing sidewalks on the campus. </li></ul><ul><ul><li>The weight of each edge is the distance between the two buildings. </li></ul></ul>
- 80. Initial Problem Solution <ul><li>Use Kruskal’s algorithm to find a minimal spanning tree. </li></ul><ul><ul><li>The edges included in the minimal spanning tree represent the sidewalks that should be converted into covered walkways. </li></ul></ul>
- 81. Initial Problem Solution <ul><li>Under this plan, students can get from any building to any other building without going outside, although they may have to walk farther inside. </li></ul><ul><li>The length of the walkways was minimized to a total of 210 + 220 + 120 + 200 = 750 feet. </li></ul>
- 82. Section 6.2 Assignment <ul><li>Pg 370 (5 a,b and list 2 different routes from St Louis (StL) to Cleveland and the total distance of each route, 9,11,27,29) </li></ul>
- 83. Section 6.3 Traveling-Salesperson Problem <ul><li>Goals </li></ul><ul><ul><li>Study Hamiltonian circuits </li></ul></ul><ul><ul><li>Study the Traveling-Salesperson Problem </li></ul></ul><ul><ul><ul><li>Use the Brute-Force Algorithm </li></ul></ul></ul><ul><ul><ul><li>Use the Nearest-Neighbor Algorithm </li></ul></ul></ul><ul><ul><ul><li>Use the Cheapest-Link Algorithm </li></ul></ul></ul>
- 84. 6.3 Initial Problem <ul><li>An author needs to find a route that will minimize the total distance she must drive between the cities. </li></ul><ul><ul><li>The solution will be given at the end of the section. </li></ul></ul>
- 85. Hamiltonian Circuits <ul><li>A path that visits each vertex in a graph exactly once is called a Hamiltonian path . </li></ul><ul><li>If a Hamiltonian path begins and ends at the same vertex , it is called a Hamiltonian circuit . </li></ul>
- 86. Example 1 <ul><li>The highlighted edges in the graph represent a Hamiltonian path. </li></ul><ul><ul><li>The path can be written AGFEDBC or CBDEFGA. </li></ul></ul>
- 87. Example 2 <ul><li>The highlighted edges in the graph represent a Hamiltonian circuit. </li></ul><ul><ul><li>The circuit, starting at A , can be written AGFEDCBA </li></ul></ul>
- 88. Hamiltonian Circuits, cont’d <ul><li>Note: A Hamiltonian path or circuit must pass through every vertex of the graph, but it does not have to use every edge. </li></ul><ul><li>A Hamiltonian path can be used, for example, to model a delivery truck stopping at every house in a neighborhood but not using every street. </li></ul>
- 89. Example 3 <ul><li>Find a Hamiltonian path in each graph or explain why you cannot. </li></ul>
- 90. Example 3 <ul><li>Solution: The path ABCD is a Hamiltonian path. </li></ul><ul><ul><li>Adding an edge to the path forms the Hamiltonian circuit ABCDA . </li></ul></ul><ul><ul><li>Other Hamiltonian paths and circuits are possible. </li></ul></ul>
- 91. Example 3, cont’d <ul><li>Solution: The path ABCD is a Hamiltonian path. </li></ul><ul><ul><li>There is no Hamiltonian circuit. </li></ul></ul>
- 92. Example 3, cont’d <ul><li>There is no Hamiltonian path. </li></ul><ul><ul><li>Any Hamiltonian path must start at either A or F . </li></ul></ul><ul><ul><li>Any path that starts at A will leave out either C , D , or F. </li></ul></ul><ul><ul><li>Any path that starts at F will leave out either C , D , or A. </li></ul></ul>
- 93. Complete Graphs <ul><li>A complete graph is a graph in which every pair of vertices is connected by exactly one edge. </li></ul>
- 94. Example 4 <ul><li>For each graph, determine whether or not it is complete. </li></ul>
- 95. Example 4, cont’d <ul><li>Solution: Check each pair of vertices. </li></ul><ul><ul><li>There is exactly one edge between each pair of vertices, so the graph is complete. </li></ul></ul>
- 96. Example 4, cont’d <ul><li>Solution: Check each pair of vertices. </li></ul><ul><ul><li>There is no edge from A to C , for example. The graph is not complete. </li></ul></ul>
- 97. Example 4, cont’d <ul><li>Solution: Check each pair of vertices. </li></ul><ul><ul><li>There are two edges from A to F , for example. The graph is not complete. </li></ul></ul>
- 98. Complete Graphs <ul><li>In general, a graph may or may not have a Hamiltonian path or circuit. </li></ul><ul><li>A complete graph, however, always has a Hamiltonian circuit. </li></ul><ul><ul><li>Any list of all the vertices in the graph will be a Hamiltonian path. </li></ul></ul><ul><ul><li>Adding the starting vertex to the end of the list describing the path will create a Hamiltonian circuit. </li></ul></ul>
- 99. Example 6 <ul><li>List all the Hamiltonian paths and all the Hamiltonian circuits in the graph. </li></ul>
- 100. Example 6, cont’d <ul><li>Solution: </li></ul>
- 101. Example 6, cont’d <ul><li>Note that the complete graph in the previous example had 3 vertices and 6 different Hamiltonian circuits. </li></ul><ul><li>This is the case because each circuit can begin at one of the 3 vertices, travel to one of 2 vertices second, and travel to the 1 remaining vertex last. </li></ul><ul><ul><li>There are 3(2)(1) = 6 Hamiltonian circuits. </li></ul></ul>
- 102. Theorem on Complete Graphs <ul><li>The number of Hamiltonian paths in a complete graph with n vertices is </li></ul><ul><li>n ! = n ( n – 1)( n – 2)( n – 3)…(1). </li></ul><ul><ul><li>The symbol n ! is read “n factorial”. </li></ul></ul>
- 103. Question: <ul><li>How many possible Hamiltonian circuits exist in a complete graph with 9 vertices? </li></ul><ul><li>a. 81 </li></ul><ul><li>b. 40,320 </li></ul><ul><li>c. 362,880 </li></ul><ul><li>d. 3,265,920 </li></ul>
- 104. Question: <ul><li>How many possible Hamiltonian circuits exist in a complete graph with 9 vertices? </li></ul><ul><li>9*8*7*6*5*4*3*2*1 = 362,880 </li></ul><ul><li>a. 81 </li></ul><ul><li>b. 40,320 </li></ul><ul><li>c. 362,880 correct answer </li></ul><ul><li>d. 3,265,920 </li></ul>
- 105. Traveling-Salesperson Problem <ul><li>A salesperson who must visit various cities and then return home wants to minimize the cost (measured in distance, time, or money) of his or her trip. </li></ul><ul><li>Because Hamiltonian circuits can be applied to find this type of least-cost trip, the problem of finding a least-cost Hamiltonian circuit is called the Traveling-Salesperson Problem . </li></ul>
- 106. Complete Weighted Graphs <ul><li>The cost of a path in a weighted graph is the sum of the weights assigned to the edges in the path. </li></ul><ul><li>When costs are assigned to each edge in a complete graph, the graph is called a complete weighted graph . </li></ul>
- 107. Question: <ul><li>What is the cost of the path ABD in the graph below? </li></ul><ul><li>a. 26 </li></ul><ul><li>b. 14 </li></ul><ul><li>c. 24 </li></ul><ul><li>d. 41 </li></ul>
- 108. Question: <ul><li>What is the cost of the path ABD in the graph below? </li></ul><ul><li>a. 26 10+16=26 </li></ul><ul><li>b. 14 </li></ul><ul><li>c. 24 </li></ul><ul><li>d. 41 </li></ul>
- 109. Example 7 <ul><li>List all possible Hamiltonian paths, and their costs, in the complete weighted graph. </li></ul><ul><li>Find the path of least cost. </li></ul>
- 110. Example 7, cont’d <ul><li>Solution: The graph has 4 vertices, so there are 4! = 24 different Hamiltonian paths. </li></ul><ul><li>These paths and their costs are listed on the next slide. </li></ul>
- 111. Example 7, cont’d
- 112. Example 7, cont’d <ul><li>Solution, cont’d: There are 2 Hamiltonian paths with the lowest cost of 37. </li></ul><ul><ul><li>CDAB </li></ul></ul><ul><ul><li>BADC </li></ul></ul>
- 113. Example 7, cont’d <ul><li>List all possible Hamiltonian circuits that start and end at vertex A. </li></ul><ul><li>Find the circuit at A of least cost. </li></ul>
- 114. Example 7, cont’d <ul><li>Solution: </li></ul>
- 115. Example 7, cont’d <ul><li>Solution, cont’d: There are 2 least-cost Hamiltonian circuits with a cost of 74. </li></ul><ul><ul><li>ABCDEA </li></ul></ul><ul><ul><li>AEDCBA </li></ul></ul><ul><ul><ul><li>These 2 circuits are mirror images of each other. </li></ul></ul></ul>
- 116. Traveling-Salesperson, cont’d <ul><li>The method used to solve the previous example is called the Brute-Force Algorithm . </li></ul><ul><ul><li>List all possible Hamiltonian circuits. </li></ul></ul><ul><ul><li>Calculate the cost of each circuit. </li></ul></ul><ul><ul><li>Find the 2 mirror image circuits of least cost. </li></ul></ul><ul><li>This method is very time-consuming. </li></ul>
- 117. Traveling-Salesperson, cont’d <ul><li>Instead of the Brute-Force Algorithm, faster approximation algorithms are typically used. </li></ul><ul><li>An approximation algorithm finds a Hamiltonian circuit that is either the least-cost circuit or is one that is not much more costly than the least-cost circuit. </li></ul><ul><ul><li>The Nearest-Neighbor Algorithm </li></ul></ul><ul><ul><li>The Cheapest-Link Algorithm </li></ul></ul><ul><ul><li>(We will not study these other than the names.) </li></ul></ul>
- 118. 6.3 Initial Problem Solution <ul><li>An author needs to find a route that will minimize the total distance she must drive between the cities shown below. </li></ul>
- 119. Initial Problem Solution, cont’d <ul><li>Imagine a graph in which the vertices represent the cities and the weighted edges represent the distances. </li></ul><ul><li>This is a Traveling-Salesperson problem, and there are 9! = 362,880 possible Hamiltonian circuits. </li></ul><ul><ul><li>Of these, 8! = 40,320 circuits start at New Orleans. </li></ul></ul>
- 120. Initial Problem Solution, cont’d <ul><li>With such a large number of circuits, it is foolish to try to solve this by hand using the Brute-Force Algorithm. </li></ul><ul><li>The Cheapest-Link Algorithm will be used to find a low-cost Hamiltonian circuit representing a low-cost trip for the author. </li></ul><ul><ul><li>Rather than drawing the large graph, view the costs (distances) in the table. </li></ul></ul>
- 121. Initial Problem Solution, cont’d <ul><li>Using the algorithm, add acceptable edges one at a time. </li></ul><ul><ul><li>The first 7 edges added are shown below. </li></ul></ul>
- 122. Initial Problem Solution, cont’d <ul><li>The cheapest acceptable edge at this point is the route between Charlotte and Orlando. </li></ul><ul><li>After that, the route from New Orleans to Orlando must be added to complete the circuit. </li></ul>
- 123. Initial Problem Solution, cont’d <ul><li>The approximate least-cost Hamiltonian circuit is shown below. </li></ul><ul><li>The total cost of the circuit is 2462, so the author will drive 2462 miles if she takes this route on her trip. </li></ul>
- 124. A fun website with Traveling Salesman Problem (TSP) Artwork: http://www.oberlin.edu/math/faculty/bosch/tspart-page.html
- 125. Section 6.3 Assignment <ul><li>Pg 396 (1,5,7,17,19,25, 27) For problems 25 and 27 you may look at the charts in the back of the book rather than making one yourself. Then, write a sentence explaining your choice of an answer and how the chart helps you make the choice you did.) </li></ul>
- 126. Chapter 6 Assignments <ul><li>Pg 353 (3, 11a,b, 17-19,25,27,39) </li></ul><ul><li>Pg 370 (5 a,b and list 2 different routes from St Louis (StL) to Cleveland and the total distance of each route, 9,11,27,29) </li></ul><ul><li>Pg 396 (1,5,7,17,19,25, 27) For problems 25 and 27 you may look at the charts in the back of the book rather than making one yourself. Then, write a sentence explaining your choice of an answer and how the chart helps you make the choice you did.) </li></ul>

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment