Minimal Spanning Trees Lecture 33 Sections 7.1-7.3 Robb T. Koether Hampden-Sydney College Wed, Apr 11, 20 Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 1 / 17
1 Networks and Trees 2 Minimal Spanning Trees 3 Kruskal s Algorithm 4 Examples 5 Assignment Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 2 / 17
Outline 1 Networks and Trees 2 Minimal Spanning Trees 3 Kruskal s Algorithm 4 Examples 5 Assignment Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 3 / 17
Networks and Trees Definition (Network) A network is a connected graph. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 4 / 17
Networks and Trees Definition (Network) A network is a connected graph. Definition (Tree) A tree is a network that contains no circuits. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 4 / 17
Properties of Trees If T is a tree with N vertices, then T has exactly N 1 edges. If any edge of T is removed, then the resulting graph is not connected. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 5 / 17
Properties of Trees Add edges to connect the graph without making a circuit. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 6 / 17
Properties of Trees Erase edges to remove circuits without disconnecting the graph. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 7 / 17
Properties of Trees Theorem A graph G with N vertices is a tree if any two of the following three properties hold. (1) T has exactly N 1 edges. (2) T is connected. (3) T contains no circuits. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 8 / 17
Outline 1 Networks and Trees 2 Minimal Spanning Trees 3 Kruskal s Algorithm 4 Examples 5 Assignment Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 9 / 17
Examples Printer Server Printer Suppose we want to connect devices in a network. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 10 / 17
Examples 10 Printer 8 16 25 15 17 30 14 12 20 16 22 16 Server Printer We want all the devices connected to each other. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 10 / 17
Examples 10 Printer 8 16 25 15 17 30 14 12 20 16 22 16 Server Printer But no two devices need to be connected by more than a single path. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 10 / 17
Examples 10 Printer 12 13 30 15 8 14 25 20 17 17 16 22 Server Printer Given the distances, which lines do we keep? Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 10 / 17
Examples 10 Printer 12 13 30 15 8 14 25 20 17 17 16 22 Server Printer The best choice is the tree of minimal total length Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 10 / 17
Examples 10 Printer 12 15 16 Server 8 Printer The total length of this tree is 61 Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 10 / 17
Minimal Spanning Trees Definition (Spanning Tree) Given a graph G, a spanning tree of G is a subgraph T that is a tree and includes all the vertices of G. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 11 / 17
Minimal Spanning Trees Definition (Spanning Tree) Given a graph G, a spanning tree of G is a subgraph T that is a tree and includes all the vertices of G. Definition (Minimal Spanning Tree) Given a weighted graph G, a minimal spanning tree of G is a spanning tree T that has the smallest total weight of all possible spanning trees of G. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 11 / 17
Outline 1 Networks and Trees 2 Minimal Spanning Trees 3 Kruskal s Algorithm 4 Examples 5 Assignment Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 12 / 17
Kruskal s Algorithm Kruskal s Algorithm Given a graph G of N vertices, we may construct a minimal spanning tree as follows. (1) Include all the vertices of G in T. (2) Add to T the edge of minimal weight. (3) Repeatedly add to T edges of minimal weight of the remaining edges while being careful not to create a circuit. (4) Once we have added N 1 edges, T is a minimal spanning tree of G. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 13 / 17
Outline 1 Networks and Trees 2 Minimal Spanning Trees 3 Kruskal s Algorithm 4 Examples 5 Assignment Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 14 / 17
Power Grid A 12 23 B 26 C 22 D E 25 F 20 27 23 14 G 21 20 H 14 I 42 35 28 J 22 20 12 K 21 15 38 33 32 24 L 34 14 N O M Given the possible links, find the minimal spanning tree. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 15 / 17
Power Grid A 12 23 B 26 C 22 D E 25 F 20 27 23 14 G 21 20 H 14 I 42 35 28 J 22 20 12 K 21 15 38 33 32 24 L 34 14 N O M The minimal spanning tree. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 15 / 17
Power Grid A B D 12 C E 25 F 20 14 G 20 H 14 20 21 L I 28 J 12 K 15 14 N O M Total weight is 251. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 15 / 17
Practice A E 15 40 34 42 F B 29 41 27 C 44 16 31 38 G 20 28 D H 45 47 48 26 32 36 46 22 L I 37 24 M 35 25 J 17 N K 19 33 23 O 43 39 21 30 P Find the minimal spanning tree. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 16 / 17
Outline 1 Networks and Trees 2 Minimal Spanning Trees 3 Kruskal s Algorithm 4 Examples 5 Assignment Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 17 / 17
Assignment Assignment Chapter 7 Exercises 1, 3, 7, 35, 37, 39, 40, 45. Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 / 17