Download presentation
Presentation is loading. Please wait.
1
Search Exhaustive/Blind Search Methods Depth First Search Breadth First Search Heuristic Methods Hill Climbing Beam Search Best First Search…
2
Goal You should be able to tell if search is the best way to solve a problem and If so, which search method is most suitable
3
Find a Path s A D B E C F G 3 4 4 5 5 2 4 4 3
4
Shortest Path Any Path Blind Search BFS DFS
5
Search Tree List all possible paths Eliminate cycles from paths Result: A search tree A special kind of semantic tree where each node denotes a path
6
Search Tree – Terminology Root Node Leaf Node Ancestor/Descendant Branching factor Complete path/Partial path Expanding open nodes results in closed nodes
7
Search Trees - Analysis Exponential explosion of possible paths Branching factor b, Depth d, how many possible paths?
8
Depth First Search (DFS) Form a one element queue consisting of a zero- length path that only contains root Until the first path in the queue terminates at the goal node or the queue is empty Remove the first path from the queue; create new paths by extending the first path to all neighbors of the terminal node Reject all new paths with loops Add the new paths if any to the FRONT of the queue If the goal node is found success; else failure
9
Breadth First Search (BFS) Form a one element queue consisting of a zero- length path that only contains root Until the first path in the queue terminates at the goal node or the queue is empty Remove the first path from the queue; create new paths by extending the first path to all neighbors of the terminal node Reject all new paths with loops Add the new paths if any to the BACK of the queue If the goal node is found success; else failure
10
BFS or DFS DFS is good when partial paths quickly reach dead ends or become complete paths. DFS is bad when there are long paths (infinite) BFS works on trees that are effectively infinitely deep, bad when all paths lead to the goal node at more or less the same depth. BFS is not good when b is large
11
NonDeterministic Search Form a one element queue consisting of a zero- length path that only contains root Until the first path in the queue terminates at the goal node or the queue is empty Remove the first path from the queue; create new paths by extending the first path to all neighbors of the terminal node Reject all new paths with loops Add the new paths at RANDOM places in the queue If the goal node is found success; else failure
12
NDFS When you do not have enough information to choose between BFS and DFS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.