Presentation is loading. Please wait.

Presentation is loading. Please wait.

Turn in HW and Classwork sheet from last class. You have 10 minutes to complete the warm- up. After the warm-up, we will finish our notes on algorithms.

Similar presentations


Presentation on theme: "Turn in HW and Classwork sheet from last class. You have 10 minutes to complete the warm- up. After the warm-up, we will finish our notes on algorithms."— Presentation transcript:

1

2 Turn in HW and Classwork sheet from last class. You have 10 minutes to complete the warm- up. After the warm-up, we will finish our notes on algorithms for Hamilton Circuits Finally, you will take a group quiz with notes due at the end of class. CH 6 Test next class!

3 2 Repetitive Nearest Neighbor Pick a vertex and apply the Nearest Neighbor procedure (Algorithm) Continue this process until you have applied the Nearest Neighbor Algorithm to each vertex Select the circuit that gives the cheapest result

4 3 Repetitive Nearest Neighbor A D C B AB = 10 DC = 20 BC = 30 BD = 40 AC = 50 AD =70 n Vertex AABCDA = 10+30+20+70 = 130 n Vertex BBACDB = 10+50+20+40 = 120 n Vertex C CDBAC = 20+40+10+50= 120 n Vertex DDCBAD = 20+30+10+70 = 130

5 Try example !!l 4

6 5 CHEAPEST LINK ALGORITHM (sorted edges ) A D C B A D C B AB = 10 DC = 20 BC = 30 BD = 40 AC = 50 AD =70 1. List the edges in order from lowest weight to highest weight 2. Begin the subgraph by choosing the edge of lowest weight. (at any point, if there is more than one edge of a given wt., you may choose which one to use, and may use both, as long as no rules are broken!) RULES: DO NOT… >add any edge that will create a subcircuit (doesn’t contain ALL of the original vertices) >add an edge that will make a vertex have degree greater than 2

7 6 CHEAPEST LINK ALGORITHM (sorted edges ) A D C B A D C B AB = 10 DC = 20 BC = 30 BD = 40 AC = 50 AD =70 3. Continue choosing edges in order of increasing weight (without breaking any rules) until you have a h.c. subgraph. BD would create a subcircuit!

8 7 CHEAPEST LINK ALGORITHM (sorted edges ) A D C B A D C B AB = 10 DC = 20 BC = 30 BD = 40 AC = 50 AD =70 AC would create a subcircuit!

9 8 CHEAPEST LINK ALGORITHM (sorted edges ) A D C B A D C B AB = 10 DC = 20 BC = 30 BD = 40 AC = 50 AD =70 Now you have a h.c. subgraph! Notice that the weight of this circuit is 130 miles. (Compare that with the previous circuit’s weight!) Step N. Connect the last two vertices to close the circuit.

10 Try example !!l 9

11 10 What’s the difference? \ The CHEAPEST LINK algorithm : *The edges are chosen by increasing weight. *No starting vertex is chosen, so optimal path is unique

12 11 What’s the difference? \ The NEAREST NEIGHBOR algorithm : The weight of the h.c. is dependent on the starting point chosen. There are many solutions, depending on the vertex you choose to start at.

13 12 REMEMBER!!! n These algorithms do not guarantee THE OPTIMAL SOLUTION. n They produce a solution QUICKLY,and are especially useful for LARGE APPLICATIONS. n The same algorithm may produce a number of different solutions depending on the starting point chosen. n Different algorithms do not necessarily produce the same solutions.


Download ppt "Turn in HW and Classwork sheet from last class. You have 10 minutes to complete the warm- up. After the warm-up, we will finish our notes on algorithms."

Similar presentations


Ads by Google