Uninformed and Informed Search Algorithms
Uninformed and Informed Search Algorithms
The uninformed search algorithm does not have any domain knowledge such as closeness, location
of the goal state, etc. it behaves in a brute-force way.
It only knows the information about how to traverse the given tree and how to find the goal state.
This algorithm is also known as the Blind search algorithm or Brute -Force algorithm.
The uninformed search strategies are of six types.
They are-
Breadth-first search
Depth-first search
Depth-limited search
Iterative deepening depth-first search
Bidirectional search
Uniform cost search
Let’s discuss these six strategies one by one.
1. Breadth-first search
It is of the most common search strategies. It generally starts from the root node and examines the
neighbor nodes and then moves to the next level. It uses First-in First-out (FIFO) strategy as it
gives the shortest path to achieving the solution.
BFS is used where the given problem is very small and space complexity is not considered.
Now, consider the following tree.
Here, let’s take node A as the start state and node F as the goal state.
The BFS algorithm starts with the start state and then goes to the next level and visits the node
until it reaches the goal state.
In this example, it starts from A and then travel to the next level and visits B and C and then
travel to the next level and visits D, E, F and G. Here, the goal state is defined as F. So, the
traversal will stop at F.
1
If the graph has more than one solution, then BFS will return the optimal solution which
provides the shortest path.
Disadvantages of BFS
BFS stores all the nodes in the current level and then go to the next level. It requires a lot of
memory to store the nodes.
BFS takes more time
to reach the goal state which is far away.
2. Depth-first search
The depth-first search uses Last-in, First-out (LIFO) strategy and hence it can be implemented by
using stack. DFS uses backtracking. That is, it starts from the initial state and explores each path to
its greatest depth before it moves to the next path.
DFS will follow
Root node —-> Left node —-> Right node
Now, consider the same example tree mentioned above.
Here, it starts from the start state A and then travels to B and then it goes to D. After reaching
D, it backtracks to B. B is already visited, hence it goes to the next depth E and then backtracks to
B. as it is already visited, it goes back to A. A is already visited. So, it goes to C and then to F. F is
our goal state and it stops there.
3. Depth-limited search
Depth-limited works similarly to depth-first search. The difference here is that depth-limited
search has a pre-defined limit up to which it can traverse the nodes. Depth-limited search solves
one of the drawbacks of DFS as it does not go to an infinite path.
DLS ends its traversal if any of the following conditions exits.
Standard Failure
It denotes that the given problem does not have any solutions.
Cut off Failure Value
It indicates that there is no solution for the problem within the given limit.
Now, consider the same example.
Let’s take A as the start node and C as the goal state and limit as 1.
The traversal first starts with node A and then goes to the next level 1 and the goal state C is there.
It stops the traversal.
2
The path of traversal is:
A —-> C
If we give C as the goal node and the limit as 0, the algorithm will not return any path as the goal
node is not available within the given limit.
If we give the goal node as F and limit as 2, the path will be A, C, F.
Advantages of DLS
It takes lesser memory when compared to other search techniques.
Disadvantages of DLS
DLS may not offer an optimal solution if the problem has more than one solution.
DLS also encounters incompleteness.
5. Bidirectional search
The bidirectional search algorithm is completely different from all other search strategies. It
executes two simultaneous searches called forward-search and backwards-search and reaches the
goal state. Here, the graph is divided into two smaller sub-graphs. In one graph, the search is
started from the initial start state and in the other graph, the search is started from the goal state.
When these two nodes intersect each other, the search will be terminated.
Bidirectional search requires both start and goal start to be well defined and the branching factor to
be the same in the two directions.
Consider the below graph.
Here, the start state is E and the goal state is G. In one sub-graph, the search starts from E and in
the other, the search starts from G. E will go to B and then A. G will go to C and then A. Here,
both the traversal meets at A
and hence the traversal ends.
4
The path of traversal is
E —-> B —-> A —-> C —-> G
Advantages of bidirectional search
This algorithm searches the graph fast.
It requires less memory to complete its action.
Disadvantages of bidirectional search
The goal state should be pre-defined.
The graph is quite
difficult to implement.
5
Advantages of UCS
This algorithm is optimal as the selection of paths is based on the lowest cost.
Disadvantages of UCS
The algorithm does not consider how many steps it goes to reach the lowest path. This may
result in an infinite loop also.
Comparison of various uninformed search algorithms
Now, let me compare the six different uninformed search strategies based on the time complexity.
Optimalit
Algorithm Time Space Complete
y
Breadth First O(b^d) O(b^d) Yes Yes
Depth First O(b^m) O(bm) No No
Depth Limited O(b^l) O(bl) No No
Iterative Deepening O(b^d) O(bd) Yes Yes
Bidirectional O(b^(d/2)) O(b^(d/2)) Yes Yes
Uniform Cost O(bl+floor(C*/epsilon)) O(bl+floor9C*/epsilon)) Yes Yes
This is all about uninformed search algorithms.
6
INFORMED SEARCH ALGORITHMS
The informed search algorithm is also called heuristic search or directed search. In contrast to
uninformed search algorithms, informed search algorithms require details such as distance to reach
the goal, steps to reach the goal, cost of the paths which makes this algorithm more efficient.
Here, the goal state can be achieved by using the heuristic function.
The heuristic function is used to achieve the goal state with the lowest cost possible. This function
estimates how close a state is to the goal.
Let’s discuss some of the informed search strategies.
7
Comparison of various uninformed search algorithms
Now, let me compare the six different uninformed search strategies based on the time complexity.
Optimalit
Algorithm Time Space Complete
y
Breadth First O(b^d) O(b^d) Yes Yes
Depth First O(b^m) O(bm) No No
Depth Limited O(b^l) O(bl) No No
Iterative Deepening O(b^d) O(bd) Yes Yes
Bidirectional O(b^(d/2)) O(b^(d/2)) Yes Yes
Uniform Cost O(bl+floor(C*/epsilon)) O(bl+floor9C*/epsilon)) Yes Yes
8
The path of traversal is
A —-> C —-> G —-> H
The time complexity of the A* search is O(b^d) where b is the branching factor.
Advantages of A* search algorithm
This algorithm is best when compared with other algorithms.
This algorithm can be used to solve very complex problems also it is an optimal one.
Disadvantages of A* search algorithm
The A* search is based on heuristics and cost. It may not produce the shortest path.
The usage of memory is more as it keeps all the nodes in the memory.
Now, let’s compare uninformed and informed search strategies.
End Notes
Search algorithms are used in games, stored databases, virtual search spaces, quantum computers,
and so on. In this article, we have discussed some of the important search strategies and how to use
them to solve the problems in AI
and this is not the end. There are several algorithms to solve any problem. Nowadays, AI is
growing rapidly and applies to many real-life problems.