90 likes | 792 Views
6.8 The Cheapest-Link Algorithm. The Cheapest-Link Algorithm. Pick the edge with the smallest weight and mark it Pick the next edge with the smallest weight available and mark it Continue doing that following these rules Do not pick an edge that will close a circuit
E N D
The Cheapest-Link Algorithm • Pick the edge with the smallest weight and mark it • Pick the next edge with the smallest weight available and mark it • Continue doing that following these rules • Do not pick an edge that will close a circuit • Do not pick an edge that will create 3 edges coming out from a single vertex • Connect the last two vertices to close the circuit
Apply the Cheapest-Link Algorithm to find the Hamilton circuit. Write the circuit starting and ending at A • Pick BD = 10 • Pick CB = 15 • Can not pick AB, so pick AD = 30 • Can not pick CD, so pick AC = 70 to close the circuit • Therefore the best route is C, A, D, B, C or A, D, B, C, A = 125
Apply the Cheapest-Link Algorithm to find the Hamilton circuit. Write the circuit starting and ending at A • Pick AC = 119 • Pick EC = 120 • Can not pick CB nor AE so the next edge is BD = 150 • Pick AD = 152 • Can not pick CD, can not pick AB, can not pick ED so the last edge is EB =200 which will close the circuit • Therefore: the route is A, C, E, B, D, A = $741
Apply the Cheapest-Link Algorithm to find the Hamilton circuit. Write the circuit starting and ending at B The circuit is: B, A, D, C, B with a total of 17
Apply the Cheapest-Link Algorithm to find the Hamilton circuit. Write the circuit starting and ending at A A B F C E D The Hamilton circuit: A, D, B, C, F, E, A with a total weight of 35
Apply the Cheapest-Link Algorithm to find the shortest way to go to the bank, dry cleaner, post office, and wegmans starting and ending at home. The mileage chart is shown below. D W Shortest way using the C.Link Home, Post Office, Dry Cleaner, Bank, Wegmans, then Home Total: 16 miles B P HOME
Apply the Cheapest-Link Algorithm to find the shortest way to go to the bank (B), candy store (C), and the airport (A) to pick up a friend starting and ending at home. Each block is exactly 1 mile. A B 6 12 10 5 9 7 H C Home, Bank, Airport, Candy Store, Home Total: 28 miles