SlideServe
Menu
Préférences
© SlideServe · v2026

Minimum Spanning Tree

jereni avatar
33 diapositives · 578 Views · Sep 02, 2014

Minimum Spanning Tree. Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008. Minimum Spanning Tree. Example of MST. Problem: Laying Telephone Wire. Central office. Wiring: Naïve Approach. Central office. Expensive!. Wiring: Better Approach. Central office.

Minimum Spanning Tree - slide 1
01 / 33Minimum Spanning Tree
1 / 17

Télécharger la présentation

Minimum Spanning Tree
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Minimum Spanning Tree Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008

  2. Minimum Spanning Tree

  3. Example of MST

  4. Problem: Laying Telephone Wire Central office

  5. Wiring: Naïve Approach Central office Expensive!

  6. Wiring: Better Approach Central office Minimize the total length of wire connecting the customers

  7. Growing an MST: general idea • GENERIC-MST(G,w) • A{} • while A does not form a spanning tree • do find an edge (u,v) that is safe for A • A A U {(u,v)} • return A

  8. Tricky part • How do you find a safe edge? • This safe edge is part of the minimum spanning tree

  9. Algorithms for MST • Prim’s • Grow a MST by adding a single edge at a time • Kruskal’s • Choose a smallest edge and add it to the forest • If an edge is formed a cycle, it is rejected

  10. Prim’s greedy algorithm • Start from some (any) vertex. • Build up spanning tree T, one vertex at a time. • At each step, add to T the lowest-weight edge in G that does not create a cycle. • Stop when all vertices in G are touched

  11. Prim’s MST algorithm

  12. Example C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  13. = in heap Min EdgePick a root C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  14. Min Edge = 1 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  15. Min Edge = 2 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  16. Min Edge = 2 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  17. Min Edge = 3 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  18. Min Edge = 4 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  19. Min Edge = 3 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  20. Min Edge = 4 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  21. Min Edge = 6 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  22. Example II

  23. Kruskal’s Algorithm • Choose the smallest edge and add it to a forest • Keep connecting components until all vertices connected • If an edge would form a cycle, it is rejected.

  24. Example C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  25. Min Edge = 1 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  26. Min Edge = 2 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  27. Min Edge = 2 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  28. Min Edge = 3 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D Now have 2 disjoint components: ABFG and CH 9 8 G

  29. Min Edge = 3 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  30. Min Edge = 4 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D Two components now merged into one. 9 8 G

  31. Min Edge = 4 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  32. Min Edge = 5 C 4 1 B F Rejected due to a cycle BFGB 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G

  33. Min Edge = 6 C 4 1 B F 2 7 3 3 2 E A I 4 6 7 5 H D 9 8 G