1 / 32

15.082 and 6.855J

This article discusses the greedy algorithm and its applications in spanning tree algorithms, particularly Prim's Algorithm. It explains how the algorithm works and provides examples of its implementation. The article also introduces Sollin's Algorithm and compares it with Prim's Algorithm in terms of efficiency.

hschlenker
Download Presentation

15.082 and 6.855J

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 15.082 and 6.855J Spanning Tree Algorithms

  2. 10 8 2 4 6 35 15 1 25 20 30 17 21 40 3 5 7 15 11 The Greedy Algorithm in Action 4 2 6 1 5 3 7

  3. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  4. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  5. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  6. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  7. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  8. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  9. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  10. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  11. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  12. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  13. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  14. The Greedy Algorithm in Action 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11

  15. root node The Greedy Algorithm in Action Node 1 2 3 4 5 6 7 First 1 2 3 4 5 4 7 10 10 8 8 2 4 6 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11 15

  16. The Greedy Algorithm in Action Node 1 2 3 4 5 6 7 First 1 4 3 4 5 4 7 10 10 8 8 2 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 5 3 7 15 15 11 16

  17. The Greedy Algorithm in Action Node 1 2 3 4 5 6 7 First 1 4 3 4 5 45 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 5 7 7 5 3 7 15 15 11 17

  18. The Greedy Algorithm in Action Node 1 2 3 4 5 6 7 First 1 45 4 5 45 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 3 5 7 7 5 3 7 15 15 11 18

  19. 3 5 7 The Greedy Algorithm in Action Node 1 2 3 4 5 6 7 First 1 44 4 4 4 4 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 3 5 5 7 7 5 3 7 15 15 11 19

  20. 5 7 The Greedy Algorithm in Action Node 1 2 3 4 5 6 7 First 4 4 4 4 4 4 4 10 10 8 8 2 4 6 4 2 6 35 35 15 15 1 1 1 25 25 20 20 30 30 17 17 21 21 11 40 40 3 3 5 7 5 3 7 15 15 11 20

  21. Prim’s Algorithm in Action 10 8 2 4 4 6 2 6 35 15 1 1 25 20 30 17 21 11 40 3 5 7 5 3 7 15 The minimum cost arc from yellow nodes to green nodes can be found by placing arc values in a priority queue.

  22. 10 25 Prim’s Algorithm in Action 8 10 2 2 4 4 6 2 6 35 35 15 1 25 1 20 30 17 21 11 40 3 5 7 5 3 7 15

  23. 8 30 20 21 Prim’s Algorithm in Action 8 10 10 10 2 2 4 4 4 6 2 6 35 35 15 1 25 25 1 30 17 20 21 11 40 3 5 7 5 3 7 15

  24. 15 17 Prim’s Algorithm in Action 8 8 8 10 10 10 2 2 4 4 4 6 6 2 6 35 35 15 1 25 25 1 30 30 17 20 20 21 21 11 40 3 5 7 5 3 7 15

  25. 11 15 Prim’s Algorithm in Action 8 8 8 10 10 10 2 2 4 4 4 6 6 2 6 35 35 15 15 15 1 25 25 1 30 30 17 17 20 20 21 21 11 40 3 5 5 7 5 3 7 15

  26. 11 15 Prim’s Algorithm in Action 8 8 8 10 10 10 2 2 4 4 4 6 6 2 6 35 35 15 15 15 1 25 25 1 30 30 17 17 20 20 21 21 11 40 3 5 5 7 5 3 7 15

  27. Prim’s Algorithm in Action 8 8 8 10 10 10 2 2 4 4 4 6 6 2 6 35 35 15 15 15 1 25 25 1 30 30 17 17 20 20 21 21 11 11 11 40 3 5 5 7 7 5 3 7 15 15

  28. Prim’s Algorithm in Action 8 8 8 10 10 10 2 2 4 4 4 6 6 2 6 35 35 15 15 15 1 25 25 1 30 30 17 17 20 20 21 21 11 11 11 40 3 3 5 5 7 7 5 3 7 15 15 15

  29. Prim’s Algorithm in Action 8 8 8 10 10 10 2 2 4 4 4 6 6 2 6 35 35 15 15 15 1 25 25 1 30 30 17 17 20 20 21 21 11 11 11 40 3 3 5 5 7 7 5 3 7 15 15 15

  30. Prim’s Algorithm in Action 8 8 8 10 10 10 2 2 4 4 4 6 6 2 6 35 35 15 15 15 1 25 25 1 30 30 17 17 20 20 21 21 11 11 11 40 3 3 5 5 7 7 5 3 7 15 15 15

  31. Sollin’s Algorithm in Action 10 8 2 2 4 4 4 6 6 2 6 35 15 1 1 1 25 20 30 17 21 40 3 3 5 5 7 7 5 3 7 11 15 Treat all nodes as singleton components, and then select the min cost arc leaving the component.

  32. Sollin’s Algorithm in Action 10 8 2 4 4 6 6 2 6 35 15 1 1 25 20 30 17 21 40 3 3 5 5 7 7 5 3 7 11 15 Find the min cost edge out of each component

More Related