Download presentation
Presentation is loading. Please wait.
Published byMonica Seabright Modified over 9 years ago
1
10.4 Spanning Trees
2
Def Def: Let G be a simple graph. A spanning tree of G is a subgraph of G that is a tree containing every vertex of G See handout for examples
3
Thm. 1 Thm 1.: A simple graph is connected iff it has a spanning tree Recall some def: – Connected ____ – Spanning tree______ – Tree_________
4
Proof of Thm. 1 A simple graph is conn.iff it has a spanning tree: Proof Suppose G has a spanning tree T Because it is spanning, ________ Because it is a tree, 10.1 Thm. 1 says _________ Since T is a subgraph of G, G is ________ Suppose G is connected If G is NOT a tree it must ___________ Remove an edge. The resulting graph has ___ edge and contains ___vertices of G and is ________ Repeat until _____ This is possible because______________
5
Algorithms for constructing spanning trees See handout and use the following methods – Depth first (backtracking) Start with a root Form a path by adding vertices as long as possible (without adding a circuit) When you can’t add any more, go back to previous one and add more… – Breath first Start with a root Add all edges incident to this vertex (level 1), arbitrarily order them For each vertex in level 1, add each edge incident (as long as it doesn’t form a circuit),…
6
Depth example adij cefhk bg Start at f
7
Breadth example abcl defg hij mkstart at e
8
Use backtracking to find a subset, if possible, … Of the set {27, 24, 19, 14, 11, 8} with the sum of 20
9
Use backtracking to find a subset, if possible, … Of the set {27, 24, 19, 14, 11, 8} with the sum of 41
10
Use backtracking to find a subset, if possible, … Of the set {27, 24, 19, 14, 11, 8} with the sum of 60
11
Ex with colors See if a graph has 3 colors– use a tree
12
10.5 Minimum spanning trees Prim’s Algorithm – Start with smallest weight – Successively add edges that are incident, choosing smallest weights, and not forming a circuit – Stop after n-1 edges selected (with n vertices) Kruskal’s Algorithm – Start with smallest weight – Successively add edges that are smallest weight (not necessarily incident) and not forming a circuit – Stop after n-1 edges selected (with n vertices) See handout or book ex
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.