CS488 CH 5 Uninformed Search
CS488 CH 5 Uninformed Search
Agenda
Breadth-first search
Uniform-cost search
Depth-first search
Depth-limited search
Iterative deepening search
Bidirectional search
Objectives
After successful completion of this chapter, students will be able to
explain and try to implement the following algorithms.
Breadth-first search
Uniform-cost search
Depth-first search
Depth-limited search
Iterative deepening search
Bidirectional search
Code:
Try BFS Python implementation in the lab
Figure 5.2 Time and memory requirements for breadth-first search. The numbers
shown assume branching factor b = 10; 1 million nodes/second; 1000 bytes/node.
Fig. 5.4 Part of the Romania state space, picked to illustrate uniform-cost search.
Jul-22 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 23
5- Uninformed Search Strategies
(3) Depth-first search (DFS)
Depth-first search always expands the deepest node in the
current frontier of the search tree.
The progress of the search is illustrated in Figure 5.5. The search
proceeds immediately to the deepest level of the search tree,
where the nodes have no successors.
As those nodes are expanded, they are dropped from the
frontier, so then the search “backs up” to the next deepest
node that still has unexplored successors.
The depth-first search algorithm is an instance of the graph-
search algorithm whereas breadth-first-search uses a FIFO
queue, depth-first search uses a LIFO queue (STACK).
Jul-22 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 24
5- Uninformed Search Strategies
(3) Depth-first search (DFS)
Code?
Recursive implementation of DFS in python
Should be tried in the lab
Figure 5.8 Four iterations of iterative deepening search on a binary tree. 1/2
Jul-22 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 42
5- Uninformed Search Strategies
(5) Iterative deepening depth-first search
Figure 5.8 Four iterations of iterative deepening search on a binary tree. 1/2
Jul-22 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 43
5- Uninformed Search Strategies
(5) Iterative deepening depth-first search
Figure 5.8 Four iterations of iterative deepening search on a binary tree. 1/2
Jul-22 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 44
5- Uninformed Search Strategies
(5) Iterative deepening depth-first search
Complete? Yes
Time? O(bd)
Space? O(bd)
Optimal? Yes, if step cost = 1
Figure 5.10 Evaluation of tree-search strategies. b is the branching factor; d is the depth of
the shallowest solution; m is the maximum depth of the search tree; ℓ is the depth limit.
Superscript caveats are as follows: a complete if b is finite; b complete if step costs ≥ ε for
positive ε; c optimal if step costs are all identical; d if both directions use breadth-first search.