Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit 2 Hamiltonian Circuits. Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where.

Similar presentations


Presentation on theme: "Unit 2 Hamiltonian Circuits. Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where."— Presentation transcript:

1 Unit 2 Hamiltonian Circuits

2 Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where it started.

3 If possible, find a Hamiltonian Circuit

4

5 Minimum –Cost Circuit 1.Generate ALL possible tours 2.Add up distances 3.Choose “cheapest” tour

6

7

8 Complete Graphs - A graph where there is exactly one edge between every pair of vertices.

9 Fundamental Principle of Counting - How many Hamiltonian Circuits are there in a complete graph with 4 vertices? 5? n?

10 Fundamental Principle of Counting If you have 10 shirts and 4 pants, how many outfits? SPS S

11 Fundamental Principle of Counting In general, if there are a ways of choosing one thing, b ways of choosing a second after the first is chosen,…, z ways of choosing the last item after the earlier choices, then the total number of choice patterns is: a x b x c x … x z

12

13

14 License Plates _ _ _ - _ _ _ _ _ _ _ _ _ _

15 Nearest Neighbor Algorithm Starting from the home city, first visit the nearest city, then visit the nearest city that has no already been visited. We return to the start when no other choice is available. Pro: Quicker Con: Not always cheapest route

16

17 On your way home from the Homecoming dance, you agreed to take your friends Sally, Billy, Johnny, and Clyde to their respective houses. If their houses are represented by the map below, who should you take home first? Second? Third? Fourth? (Assume your house is next to the Dance Venue)

18 Literacy Practice Page 38 – Traveling Salesman Problem (TSP)

19 Sorted Edges Algorithm Start by sorting each edge of the complete graph in order of increasing cost. Then at each stage, select an edge that has not been previously chosen of least cost that (1)never requires that three used edges meet at a vertex and that (2) never closes up a circular tour that doesn’t include all the vertices.

20

21

22

23 Heuristic Algorithms “Quick and dirty” algorithms that come “close enough” to giving an optimal solution that they are deemed important for practical uses. Example: Sorted Edges Non-Example: Brute Force

24 Kruskal’s Algorithm Add links in order of cheapest cost so that (1)no circuits form and so that (2) every vertex belongs to some link added. ***THIS IS NOT A HAMILTONIAN CIRCUIT. DO NOT FORM A CIRCUIT!!!!!!!!!

25 Pictaphone Service *Numbers indicate cost (in millions) of implementing pictaphone lines between the cities (0.7 = $700,000).

26 Minimum Cost Spanning Tree A connected graph that is not a circuit and whose costs sum to a minimum value.

27 You are tasked with designing the roads in a subdivision. The following graph are the possible roads that could be added. The values associated with each road is not the distance, but the cost of building that road in thousands of dollars. Figure out which roads should be used by using Kruskal’s Algorithm.

28 Start with just the vertices and work from there. ***Note: The original graph was not a complete graph.

29 Order-Requirement Digraph Used to complete a job with multiple tasks as quickly as possible Made up of tasks (vertices) and arrows (edges). Some tasks (T7 and T8) are independent. This means they can be completed at any time. Tasks that follow an arrow cannot be started until all tasks before them have been completed.

30 Example: Turning a Plane Around Task AUnloading Passengers13 Minutes Task BUnload Cargo25 Minutes Task CClean Cabin15 Minutes Task DLoad New Cargo22 Minutes Task ELoad New Passengers27 Minutes

31 Critical-Path The shortest amount of time for which it is possible to complete a job. The critical path is counter-intuitive in the fact that it is the LONGEST path in the graph. The length of the path is determined by the sum of the costs of each task. *Go back and determine the critical path for the airplane example.

32 Thanksgiving!!!! You have volunteered to host Thanksgiving at your house this year. Let’s determine what tasks need to be completed and how long it will take to prepare for the feast. Get with a partner and determine what tasks need to be completed and approximate how long each will take.


Download ppt "Unit 2 Hamiltonian Circuits. Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where."

Similar presentations


Ads by Google