1 / 14

Minimum Spanning Tree Neil Tang 3/25/2010

Minimum Spanning Tree Neil Tang 3/25/2010. Class Overview. The minimum spanning tree problem Applications Prim’s algorithm Kruskal’s algorithm. Minimum Spanning Tree Problem. The cost of a tree: The sum of the weights of all links on the tree.

Download Presentation

Minimum Spanning Tree Neil Tang 3/25/2010

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. Minimum Spanning Tree Neil Tang3/25/2010 CS223 Advanced Data Structures and Algorithms

  2. Class Overview • The minimum spanning tree problem • Applications • Prim’s algorithm • Kruskal’s algorithm CS223 Advanced Data Structures and Algorithms

  3. Minimum Spanning Tree Problem • The cost of a tree: The sum of the weights of all links on the tree. • The Minimum Spanning Tree (MST) problem: Given a weighted undirected graph G, find a minimum cost tree connecting all the vertices on the graph. CS223 Advanced Data Structures and Algorithms

  4. Minimum Spanning Tree Problem CS223 Advanced Data Structures and Algorithms

  5. Applications • Broadcasting problem in computer networks: Find the minimum cost route to send packages from a source node to all the other nodes in the network. • Multicasting problem in computer networks: Find the minimum cost route to send packages from a source node to a subset of other nodes in the network. CS223 Advanced Data Structures and Algorithms

  6. Prim’s Algorithm CS223 Advanced Data Structures and Algorithms

  7. Prim’s Algorithm CS223 Advanced Data Structures and Algorithms

  8. Prim’s Algorithm CS223 Advanced Data Structures and Algorithms

  9. Prim’s Algorithm • Arbitrarily pick a vertex to start with. • Relaxation: dw=min(dw, cwv), where v is the newly marked vertex, w is one of its unmarked neighbors, cwv is the weight of edge (w,v) and dw indicates the current distance between w and one of the marked vertices. CS223 Advanced Data Structures and Algorithms

  10. Dijkstra’s Algorithm Need to be changed: CS223 Advanced Data Structures and Algorithms

  11. Prim’s Algorithm • Trivial: O(|V|2 + |E|) = O(|V|2) • Heap: deleteMin |V| times + decreaseKey |E| times O(|V|log|V| + |E|log|V|) = O (|E|log|V|) CS223 Advanced Data Structures and Algorithms

  12. Kruskal’s Algorithm CS223 Advanced Data Structures and Algorithms

  13. Kruskal’s Algorithm CS223 Advanced Data Structures and Algorithms

  14. Kruskal’s Algorithm O(|E|) O(|E|log|E|) O(|E|log|V|) O(|E|) Time complexity: O(|E|log|E|) = O (|E|log|V|) CS223 Advanced Data Structures and Algorithms

More Related