Presentation is loading. Please wait.

Presentation is loading. Please wait.

Minimum Spanning Tree. p2. Minimum Spanning Tree G=(V,E): connected and undirected w: E  R, weight function a b g h i c f d e 4 8 11 8 2 7 12 6 4 7 14.

Similar presentations


Presentation on theme: "Minimum Spanning Tree. p2. Minimum Spanning Tree G=(V,E): connected and undirected w: E  R, weight function a b g h i c f d e 4 8 11 8 2 7 12 6 4 7 14."— Presentation transcript:

1 Minimum Spanning Tree

2 p2. Minimum Spanning Tree G=(V,E): connected and undirected w: E  R, weight function a b g h i c f d e 4 8 11 8 2 7 12 6 4 7 14 9 10

3 p3. Minimum Spanning Tree Let A be a subset of some minimum spanning tree if is also a subset of a MST, then we call (u,v) a safe edge of A

4 p4. Minimum Spanning Tree A cut (S, V-S) of an undirected graph G=(V, E) is a partition of V An edge crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S A cut respects the set A of edges if no edge in A crosses the cut An edge is a light edge crossing a cut if its weight is the minimum of any edge crossing the cut What is the light edge in the above graph ? 1 2 a b g h i c f d e 4 8 11 8 2 7 6 4 7 14 9 10 a cut S V-S

5 p5. Minimum Spanning Tree Thm1: G=(V,E): connected, undirected w: real-valued weight function on E A: a subset of E and is included in some MST (S, V-S): any cut of G and respects A (u,v): a light edge crossing (S, V-S) Then (u,v) is safe for A. pf: y u x v S : {O} V-S: {O} A: { - } T’ = T – {(x,y)} U {(u,v)} original MST

6 p6. Minimum Spanning Tree w(T’) = w(T) – w(x,y) + w(u,v) = w(T) Thus, T’ is a MST

7 p7. Minimum Spanning Tree Cor2: G=(V,E): connected, undirected w : real-valued weight function and A is in some MST C: a connected component in G A =(V,A) if (u,v) is a light edge connecting C to some other component in G A, then (u,v) is safe for A Pf: The cut(C, V-C) respects A, and (u,v) is therefore a light edge for this cut v u V-C C

8 p8. Disjoint sets

9 p9. Eg. Minimum spanning tree G=(V,E): connected, undirected, edge-weighted graph w : E  R

10 p10. Kruskal’s algorithm 87 (a) a b g h i c f d e 4 8 11 2 7 1 2 6 4 14 9 10 a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (b)

11 p11. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (c) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (d)

12 p12. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (e) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (f)

13 p13. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (g) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (h)

14 p14. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (i) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (j)

15 p15. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (k) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (l)

16 p16. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (m) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (n)

17 p17. Prim’s algorithm: O(V) O(V lg V) O(E) lg V O(lg V), Decrease-key involves

18 p18. Analysis Binary heap: O(V lg V + E lg V) = O(E lg V) Fibonacci heap: Decrease-key: O(1) amortized time O(V lg V + E)

19 p19. Prim’s algorithm a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (a) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (b) r

20 p20. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (c) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (d)

21 p21. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (e) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (f)

22 p22. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (g) a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (h)

23 p23. a b g h i c f d e 4 8 11 8 2 7 1 2 6 4 7 14 9 10 (i)


Download ppt "Minimum Spanning Tree. p2. Minimum Spanning Tree G=(V,E): connected and undirected w: E  R, weight function a b g h i c f d e 4 8 11 8 2 7 12 6 4 7 14."

Similar presentations


Ads by Google