Download presentation

Presentation is loading. Please wait.

Published byJeffery Eugene Page Modified over 2 years ago

1
1 Section 9.4 Spanning Trees

2
2 Let G be a simple graph. A spanning subtree of G is a subgraph of G containing every vertex of G –must be connected; contains path between any 2 vertices –every connected simple graph has a spanning tree

3
3 Example 1 Find a spanning tree of the following simple graph: We can form a spanning tree by removing simple circuits; for example, removing {e,g} produces:

4
4 Example 1 Original graph: Current subgraph: We need to remove two more edges to produce a tree; for example, removing {b,f} and {c, f} produces one of several possible spanning trees:

5
5 Spanning tree & connectivity A simple graph is connected if and only if it has a spanning tree –If a simple graph contains a spanning tree, then by definition it has a subgraph including all vertices, and there is a path between any 2 vertices; thus, it is connected –If G is a connected simple graph and is not a spanning tree, it contains a simple circuit; removing edges, we can remove the circuit, leaving a subgraph that is a spanning tree

6
6 Constructing spanning trees Can construct a spanning tree from a simple graph by removing edges that create circuits, as we have seen More efficient algorithms don’t rely on the necessity of finding circuits; instead, they build trees by successively adding edges Two such algorithms are depth-first and breadth-first searching

7
7 Depth-first search Also known as backtracking: –choose a root vertex –form a path from root, adding edges so that each new edge is incident with the current vertex and with a vertex not already in the path –if the path goes through all vertices, it’s a spanning tree –if not, go to the next-to-last vertex and form a path from here to an unincluded vertex (if possible) - if not, go back to vertex before this one and attempt the same process

8
8 Example 2 Use depth-first search to find a spanning tree for the graph below: We start by picking an arbitrary vertex, say d. From here we can form the path: d, e, f, g, h, i

9
9 Example 2 The circled vertices are those already visited, yielding the partially completed tree below, right: Backtracking to vertex h, we can form the path h, k, j

10
10 Example 2 Visited vertices and the resulting tree are shown below: We now have to backtrack all the way to e to find a vertex connected to an unvisited vertex, c. From here we create the path e, c, a

11
11 Example 2 There is one remaining unvisited vertex, b. We can reach this by backtracking to c, forming the path c, b. The complete spanning tree of the graph at left is shown below, right:

12
12 Breadth-first search Begin by arbitrarily choosing a root vertex Add all edges incident with this vertex; the vertices added at this stage become the spanning tree’s level 1 vertices For each vertex at level 1, add all incident edges that do not produce any simple circuits Arbitrarily order the children of level 1 vertices; these are the vertices of level 2 Follow the same procedure with level 2 vertices, and all subsequent levels until all vertices of the graph have been added to the tree

13
13 Example 2 Use depth-first search to find a spanning tree for the graph below: Arbitrarily choosing vertex f as root, we add edges {f,e}, {f,d}, {f,h} and {f,g}, forming the tree below:

14
14 Example 2 From the level 1 vertices, we can add edges {e,c}, {h,i}, and {h,k}, forming level 2 of the tree:

15
15 Example 2 Finally, we can add the edges connecting the remaining vertices to the vertices at level 2: {c,a}, {c,b} and {k,j}. The result is the spanning tree below:

16
16 Section 9.4 Spanning Trees

Similar presentations

OK

Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.

Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on ufo and aliens found Show ppt on samsung tv Ppt on employee motivation Download ppt on pulse code modulation pcm Ppt on history of atoms Ppt on festival of india Download ppt on save fuel Ppt on electric motor class 10 Convert pdf ppt to ppt online shopping Ppt on travel agency management