1 / 3

Minimal Spanning Tree

Minimal Spanning Tree. In an undirected graph, find a minimal spanning tree Minimal means … Spanning means … Tree means … We can use Prim's Algorithm. Similar to Dijkstra's Algorithm start with initial vertex in MST find minimal edge from MST vertex to other vertex

demi
Télécharger la présentation

Minimal Spanning Tree

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. Minimal Spanning Tree • In an undirected graph, find a minimal spanning tree • Minimal means … • Spanning means … • Tree means … • We can use Prim's Algorithm. Similar to Dijkstra's Algorithm start with initial vertex in MST find minimal edge from MST vertex to other vertex add minimal edge/vertex to MST repeat until each vertex added

  2. Prim's Algorithm • How do we know this algorithm works? • Suppose not, some graph for which algorithm yields non minimal spanning tree, is it not a tree? Not spanning? … • Assume we have such a graph, call it G, now we reason … • Will lead to contradiction (exploit minimal property) • How efficient is Prim's Algorithm? • Depends on implementation, look at Dijkstra and modify • What did Dijkstra's algorithm do? Problem solved?

  3. Implementation, priority queue • Keep track of shortest distance from MST vertices to others, use chosen start vertex • Initially all are infinity except start is 0 from itself • Choose minimal edge between MST vertices and others • This is same as choosing minimal element in PQ • When choosing, modify distances by adding elements to PQ appropriately • When distance < current best modify current best (add new element to PQ) • How is this different from Dijkstra's algorithm? • How do we construct path?

More Related