spanning
play

Spanning G is a subgraph that has all the vertices of G. Trees - PowerPoint PPT Presentation

SpanningSubgraphs MathematicsforComputerScience MIT6.042J/18.062J A spanning subgraph of graph Spanning G is a subgraph that has all the vertices of G. Trees Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 spanning.1


  1. Spanning Subgraphs Mathematics for Computer Science MIT 6.042J/18.062J A spanning subgraph of graph Spanning G is a subgraph that has all the vertices of G. Trees Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 spanning.1 spanning.2 Spanning Subgraphs Spanning Trees A spanning subgraph of graph G is a subgraph that has all the vertices of G. A spanning tree is a spanning subgraph that is a tree. Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 spanning.3 spanning.4 1

  2. Spanning Trees Spanning Trees another spanning tree a spanning tree (can have many) Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 spanning.5 spanning.6 Spanning Trees Minimum Weight Spanning Trees Suppose edges have weights: Lemma: G connected implies 3 G has a spanning tree 4 1 4 Pf: Namely, any minimum edge 9 7 2 6 connected spanning graph. 1 Find min weight spanning tree? Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 spanning.7 min-tree.9 2

  3. Build MST using gray edges Minimum Spanning Trees color components • Start with vertices • Color components black & white 3 4 4 1 • gray edge ::= 9 7 2 • add min weight gray edge 6 1 Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 min-tree.10 min-tree.11 Minimum Spanning Trees Minimum Spanning Trees color components gray edges 3 3 4 4 1 1 4 4 9 9 7 7 2 2 6 6 1 1 Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 min-tree.12 min-tree.13 3

  4. Minimum Spanning Trees Minimum Spanning Trees gray edges: min weight re-color components 3 3 4 4 4 1 4 1 9 9 7 7 2 2 6 6 1 1 Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 min-tree.14 min-tree.15 Minimum Spanning Trees Minimum Spanning Trees re-color components gray edges 3 3 4 4 1 1 4 4 9 9 7 7 2 2 6 6 1 1 Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 min-tree.16 min-tree.17 4

  5. Minimum Spanning Trees Minimum Spanning Trees gray edges: min weight re-color components 3 3 4 4 4 1 4 1 9 9 7 7 2 2 6 6 1 1 Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 min-tree.18 min-tree.19 Minimum Spanning Trees Minimum Spanning Trees re-color components etc 3 3 4 4 1 1 4 4 9 9 7 7 2 2 6 6 1 1 Albert R Meyer, April 8, 2013 Albert R Meyer, April 8, 2013 min-tree.20 min-tree.21 5

  6. Ways to grow an MST • start at any vertex, keep building one tree. (Prim) • keep choosing min weight edge between diff components (Kruskal) • grow trees in parallel (Meyer) Albert R Meyer, April 8, 2013 min-tree.22 6

  7. MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Recommend


More recommend