3/29/05Tucker, Sec. 4.21 Applied Combinatorics, 4th Ed. Alan Tucker Section 4.2 Minimal Spanning Trees Prepared by Amanda Dargie and Michele Fretta.

  • Published on
    21-Dec-2015

  • View
    212

  • Download
    0

Transcript

<ul><li> Slide 1 </li> <li> 3/29/05Tucker, Sec. 4.21 Applied Combinatorics, 4th Ed. Alan Tucker Section 4.2 Minimal Spanning Trees Prepared by Amanda Dargie and Michele Fretta </li> <li> Slide 2 </li> <li> 3/29/05Tucker, Sec. 4.22 Recall: A spanning tree of a graph G is a subgraph of G that is a tree containing all vertices of G. 3 2 6 9 1 5 1 11 3 2 7 4 3 6 2 2 Recall </li> <li> Slide 3 </li> <li> 3/29/05Tucker, Sec. 4.23 Definition A minimal spanning tree in a network is a spanning tree whose sum of edge lengths k(e) is as small as possible. 12 3 2 6 9 1 5 1 3 2 7 4 3 6 2 2 </li> <li> Slide 4 </li> <li> 3/29/05Tucker, Sec. 4.24 Kruskals Algorithm Let T be a minimal spanning set (which is initially empty). Add to T the shortest edge that does not form a circuit with edges already in T. Repeat adding edges in this manner until set T has n-1 edges </li> <li> Slide 5 </li> <li> 3/29/05Tucker, Sec. 4.25 Example First include all 3 edges of length 1: (a, f), (l, q), (r, w) Next add all the edges of length 2: (a, b), (e, j), (g, l), (h, i), (l, m), (p, u), (s, x), (x, y) Next add almost all the edges of length 3: (c, h), (d, e), (k, l), (k, p), (q, v), (r, s), (v, w), but not (w, x) unless (r, s) were omitted [if both were present we would get a circuit containing these 2 edges together with edges (r, w) and (s, x) Next add all the edges of length 4 (f, g), (h, m), (c, d), (n, o), (s, t) Finally add either (m, n) or (o, t) to obtain a minimal spanning set f o p t j a y k w x q l n mr s v u i h g d c b e 2 5 5 7 3 7 3 3 28 7 4 3 5 2 95 42 6 8 1 10 3 1 3 4 2 732 4 6 2 4 8 2 1 5 3 X </li> <li> Slide 6 </li> <li> 3/29/05Tucker, Sec. 4.26 Prims Algorithm Let T be a minimal spanning tree, initially including any one edge of shortest length. Add to T the shortest edge between a vertex in T and a vertex not in T. Repeat adding edges in this manner until T has n-1 edges. </li> <li> Slide 7 </li> <li> 3/29/05Tucker, Sec. 4.27 Example There are 3 edges of length 1: (a, f), (l, q), (r, w) Suppose we pick (a, f) Next add (a, b), of length 2 Then (f, g), of length 4 Then (g, l), (l, q), (l, m) and so forth The next-to-last addition can be either (m, n), (o, t) (both of length 5) in this case well use (m, n) Then follow with (n, o) a y k w x q l n mr s v u i h g d c b e 2 5 5 7 3 7 3 3 28 7 4 3 5 2 95 42 6 8 1 10 3 1 3 4 2 732 4 6 2 4 8 2 1 5 3 f j p o t </li> <li> Slide 8 </li> <li> 3/29/05Tucker, Sec. 4.28 Theorem Prims algorithm yields a minimal spanning tree. Proof Assume that all edges have different lengths. Let T ' be a minimal spanning tree chosen to have as many edges as possible in common with T* (which will be constructed by Prims algorithm). </li> <li> Slide 9 </li> <li> 3/29/05Tucker, Sec. 4.29 Proof (contd) </li> <li> Slide 10 </li> <li> 3/29/05Tucker, Sec. 4.210 Proof (contd) a b </li> <li> Slide 11 </li> <li> 3/29/05Tucker, Sec. 4.211 Proof (contd) a b </li> <li> Slide 12 </li> <li> 3/29/05Tucker, Sec. 4.212 Proof (contd) a b </li> <li> Slide 13 </li> <li> 3/29/05Tucker, Sec. 4.213 For the class to try: The red numbers indicate the value of each edge. Find a minimal spanning tree. a 7 5 5 4 3 3 2 8 g f e d c b 5 Hint: use Kruskals Algorithm </li> <li> Slide 14 </li> <li> 3/29/05Tucker, Sec. 4.214 Solution a 5 First, add (c,f) to T Then, add (a,b) and (d,g) Then, add (a,e) Then add (e,f) and (f,g). Dont add (b,e), because we cant have a circuit! 7 5 5 4 3 3 2 8 g f e d c b </li> </ul>

Recommended

View more >