Download presentation
Presentation is loading. Please wait.
1
Discrete Math 2 Weighted Graph Search Tree
2001 Discrete Math 2 Weighted Graph Search Tree CIS112 February 5, 2007 Daniel L. Silver
2
Overview Building a search tree Step by step
Shortest path in weighted graph Step by step Begin with initial vertex = root node At each step Choose least cost node Expand it Add children to tree Matching vertice? Prune vertex with greatest cost 2007 Kutztown University
3
Example Graph 2007 Kutztown University
4
First Steps Place starting vertex at root Expand the node
Children = vertices directly connected Path cost = weight of edge In this example Seek least cost path from 7 to 12 2007 Kutztown University
5
Resulting Tree #1 2007 Kutztown University
6
Next Step Choose node with lowest path cost Expand it
That is the node for vertex #3 Expand it 2007 Kutztown University
7
Resulting Tree #2 2007 Kutztown University
8
Next Step Choose node with lowest path cost
The path costs are: 15 23 25 34 The least cost is 15 So we expand the node for vertex #10 2007 Kutztown University
9
Resulting Tree #3 2007 Kutztown University
10
Next Step We now have two copies of vertex #8
One has a path cost of 24 The other’s path cost is 25 So we must prune the one with the highest cost 2007 Kutztown University
11
Resulting Tree #4 2007 Kutztown University
12
Next Step Now it is time again to expand
The node for vertex #11 has the lowest cost So we expand it 2007 Kutztown University
13
Resulting Tree #5 2007 Kutztown University
14
Comments Even though we have reached vertex #12, we are not finished; there may be a shorter path yet to be found. We delete the higher cost copy of #8 We remove all nodes with path cost ≥ 26 from consideration Q: Why can we do that? Q: Why do we not remove them? 2007 Kutztown University
15
Resulting Tree #6 2007 Kutztown University
16
Continuing . . We continue by expanding Node #1 And then #8 2007
Kutztown University
17
Resulting Tree #7 2007 Kutztown University
18
Resulting Tree #8 2007 Kutztown University
19
Resulting Tree #9 2007 Kutztown University
20
Final Comments There are no more nodes to expand
So the process is completed We determine the least cost path is: 7 10 11 12 The total cost is 26 2007 Kutztown University
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.