# Uninformed Search Strategies in Artificial Intelligence

Uninformed search strategies are foundational techniques in artificial intelligence. They explore state spaces systematically without using heuristics or domain knowledge to guide the search.

This article provides an in-depth look at popular uninformed search algorithms. Their advantages, disadvantages, and real world applications. Main uninformed algorithms are breadth-first search, depth-first search, uniform cost search, iterative deepening, and bidirectional search.

## What are Uninformed Search Strategies?

Uninformed search strategies, also called blind search methods, explore paths from an initial state to the goal state without using domain-specific knowledge. They expand nodes based solely on the structure of the search space rather than an intelligent strategy. Some well-known uninformed search algorithms are:

## Breadth-First Search (BFS)

Breadth-First Search (BFS) is a fundamental algorithm used for traversing or searching tree or graph data structures. Unlike Depth-First Search, which goes deep before going wide, BFS explores all the nodes at the present depth before moving on to the nodes at the next depth level.

Here’s an overview of BFS:

**Traversal Order**: BFS starts at the root (or any arbitrary node) and explores the neighbor nodes at the present depth before moving on to nodes at the next depth level.**Queue Usage**: BFS uses a queue to keep track of the nodes to be explored. It follows the First In First Out (FIFO) principle.**Completeness**: BFS is complete, meaning that if a solution exists, it will find it.**Optimality**: BFS is optimal for unweighted graphs, meaning it will find the shortest path to a goal.**Time and Space Complexity**: The time complexity of BFS is*O*(*V*+*E*), where*V*is the number of vertices and*E*is the number of edges. The space complexity is*O*(*V*) as it needs to store all vertices in the queue.

### Breadth-First Search Example

Consider the following tree, and we want to perform a BFS starting from node A:

```
A
/ | \
B C D
/ | \
E F G
```

Here’s how BFS would work:

**Step 1**: Visit A and enqueue its children (B, C, D).**Step 2**: Dequeue B (the front of the queue) and visit it, then enqueue its child (E).**Step 3**: Dequeue C (the front of the queue) and visit it, then enqueue its child (F).**Step 4**: Dequeue D (the front of the queue) and visit it, then enqueue its child (G).**Step 5**: Dequeue E, F, and G (the front of the queue) and visit them.

The order of visited nodes is A -> B -> C -> D -> E -> F -> G.

Breadth-First Search is widely used in various applications, including finding the shortest path in unweighted graphs, spreading processes like network broadcasting, and more. Its preference for exploring breadth over depth ensures that it explores nodes in a way that moves steadily farther from the starting point, making it a suitable choice when the shortest path is required.

## Depth-First Search (DFS)

Depth-First Search (DFS) is a fundamental algorithm used for traversing or searching tree or graph data structures. It explores as far as possible along each branch before backtracking, making it an excellent tool for tasks that require visiting every vertex of a graph in a specific order.

Here’s an overview of DFS:

**Traversal Order**: DFS starts at the root (or any arbitrary node) and explores as far as possible along each branch before backtracking. It goes deep before going wide.**Stack Usage**: DFS uses a stack (either explicitly or via recursion) to remember which vertices to visit next.**Completeness**: DFS is generally not complete for infinite graphs or graphs with loops, as it can get stuck in a loop.**Optimality**: DFS does not guarantee that it will find the shortest path to a goal.**Time and Space Complexity**: The time complexity of DFS is*O(V+E)*, where*V*is the number of vertices and*E*is the number of edges. The space complexity depends on the implementation, a recursive implementation can have a*O*(*h*) space complexity [worst-case], where*h*is the maximal depth of your tree.

### Depth-First Search Example

Consider the following tree, and we want to perform a DFS starting from node A:

```
A
/ | \
B C D
/ | \
E F G
```

Here’s how DFS would work:

**Step 1**: Visit A and push its children (B, C, D) onto the stack.**Step 2**: Visit B (the top of the stack) and push its child (E) onto the stack.**Step 3**: Visit E (the top of the stack) and pop it off since it has no children.**Step 4**: Visit C (the next on the stack) and push its child (F) onto the stack.**Step 5**: Visit F (the top of the stack) and pop it off since it has no children.**Step 6**: Visit D (the next on the stack) and push its child (G) onto the stack.**Step 7**: Visit G (the top of the stack) and pop it off since it has no children.

The order of visited nodes is A -> B -> E -> C -> F -> D -> G.

Depth-First Search is a fundamental algorithm with various applications, including topological ordering, cycle detection, pathfinding, and more. Its preference for exploring depth over breadth can be useful in many scenarios, but it also means that it might not find the shortest path between two nodes.

## Uniform-Cost Search (UCS)

Uniform-Cost Search (UCS) is a tree traversal or graph searching algorithm that is a key part of many artificial intelligence applications. Unlike other informed search algorithms that use heuristics, UCS is considered an uninformed search method as it doesn’t have any additional information about the distance from the current state to the goal.

Here’s a brief overview of UCS:

**Principle**: UCS explores paths in the increasing order of cost. It prioritizes nodes based on the cumulative cost from the start node to the current node, ensuring that the paths with the lowest total cost are explored first.**Data Structure**: UCS typically uses a priority queue to keep track of nodes, where the nodes are prioritized by their path cost from the start node.**Optimality**: UCS is guaranteed to find the optimal solution if the cost function satisfies the condition of non-negativity. It will explore all paths with cost less than the cost of the optimal path to ensure that the solution found is indeed the best one.**Completeness**: UCS is complete, meaning that if a solution exists, UCS will find it.**Time and Space Complexity**: The time and space complexity of UCS can be high, depending on the branching factor and the depth of the optimal solution. It can be inefficient if there are many paths with similar costs.**Usage**: UCS is often used in scenarios where the path cost is a critical factor, and the goal is to find the least costly path without any heuristic information about the goal’s location.

### Example of Uniform-Cost Search

Imagine a road network connecting cities, and you want to find the least costly path from city A to city D. The costs between the cities are as follows:

- A to B: 2
- A to C: 1
- B to D: 5
- C to D: 3

The graph can be represented as:

```
A
/ \
2/ \1
B C
\5 /3
\ /
D
```

Here’s how UCS would work:

**Initialize**: Start at city A with a cost of 0. Add A to the priority queue.**Step 1**: Expand city A. Add B with a cost of 2 and C with a cost of 1 to the priority queue.**Step 2**: Expand city C (since it has the lowest cost of 1). Add D with a cost of 4 (1 from A to C + 3 from C to D) to the priority queue.**Step 3**: Expand city B (since it has the next lowest cost of 2). Add D with a cost of 7 (2 from A to B + 5 from B to D) to the priority queue.**Step 4**: Expand city D with a cost of 4 (since it has the next lowest cost). Since D is the goal, the search ends.

The path found by UCS is A -> C -> D with a total cost of 4.

UCS ensures that the path with the lowest total cost is found by always expanding the node with the lowest cost so far. In this example, even though there are two paths to city D, UCS correctly identifies the path with the lowest total cost.

## Iterative Deepening Depth-First Search (IDDFS)

Iterative Deepening Depth-First Search (IDDFS) is a hybrid search algorithm that combines the benefits of both Depth-First Search (DFS) and Breadth-First Search (BFS). It performs a series of depth-limited DFS, gradually increasing the depth limit in each iteration until the goal is found or all nodes are explored.

Here’s an overview of IDDFS:

**Depth Limit**: IDDFS starts with a depth limit of 0 and performs a depth-first search up to that limit. If the goal is not found, the depth limit is increased by 1, and the search is repeated.**Space Efficiency**: Like DFS, IDDFS uses linear space, making it more space-efficient than BFS, especially for large search spaces.**Time Efficiency**: Although IDDFS may seem inefficient because it revisits nodes multiple times, it is often as time-efficient as BFS for uniform tree structures.**Completeness**: IDDFS is complete, meaning it will find a solution if one exists.**Optimality**: In a tree with uniform step costs, IDDFS is optimal, meaning it will find the shortest path to the goal.

### Iterative Deepening Depth-First Search Example

Consider the following tree, and we want to find the node “G”:

```
A
/ | \
B C D
/ | \
E F G
```

Here’s how IDDFS would work:

**Depth 0**: Search only node A. No goal found.**Depth 1**: Search nodes A -> B, A -> C, A -> D. No goal found.**Depth 2**: Search nodes A -> B -> E, A -> C -> F, A -> D -> G. Goal found at depth 2.

The path found by IDDFS is A -> D -> G.

IDDFS provides a way to perform a depth-first search while ensuring that the shallowest goal node is found first, like BFS. It’s particularly useful when you have limited memory and a large search space, and you want to find the shortest path to the goal.

## Bidirectional Search

Bidirectional Search is a search algorithm that runs two simultaneous searches: one forward from the initial state and the other backward from the goal state. The aim is to meet in the middle, reducing the search space and often speeding up the search process.

Here’s an overview of Bidirectional Search:

**Two Frontiers**: The algorithm maintains two frontiers, one for the forward search from the start and one for the backward search from the goal.**Meeting Point**: The search continues until there is a common node that appears in both frontiers. This common node is the meeting point, and the path from the start to the goal can be constructed by concatenating the paths from the start to the meeting point and from the meeting point to the goal.**Efficiency**: By searching from both directions, the algorithm can significantly reduce the search space, often leading to faster search times compared to unidirectional methods like BFS or DFS.**Completeness**: Bidirectional Search is complete, meaning it will find a solution if one exists.**Optimality**: If both searches are done using BFS (or a variant that ensures the shortest path), then the solution found will be optimal.

### Bidirectional Search Example

Consider the following graph, and we want to find the shortest path from A to G:

```
A - B - C
| | |
D - E - F
| |
G - H - I
```

Here’s how Bidirectional Search would work:

**Initialize**: Start the forward search from A and the backward search from G.**Step 1**: Forward search explores B and D; backward search explores H.**Step 2**: Forward search explores E; backward search explores F and I.**Step 3**: Forward search explores C and F; backward search explores C and E. The node E is now in both frontiers.**Meeting Point**: The meeting point is E, and the path is constructed as A -> B -> E -> F -> G.

The path found by Bidirectional Search is A -> B -> E -> F -> G.

Bidirectional Search can be a powerful method when the search space is large, and a path exists from both the start to the goal and the goal to the start. By reducing the search space and meeting in the middle, it often finds solutions more quickly than traditional unidirectional search methods.

## How Uninformed Search Strategies Work

Uninformed search strategies share a general template. The algorithm maintains a frontier of unexpanded nodes. It repeatedly selects the next node to expand based on predefined rules, checking if the goal is reached. New successors are added to the frontier until a solution is found or states are exhausted.

The node selection and expansion mechanics vary across specific algorithms. BFS and UCS use a FIFO queue, selecting the oldest node first. DFS uses a LIFO stack, picking the newest node first. IDDFS limits selection by depth thresholds. Bidirectional search synchronizes two frontiers.

Uninformed methods lack heuristics to judge node relevance. They treat all states equally during exploration. Through systematic expansion, these simple but effective strategies can solve a remarkably wide range of AI search problems.

## Applications of Uninformed Search Strategies

Uninformed search provides a versatile tool for navigating state spaces across domains:

**Puzzle Solving**

Algorithms like BFS and IDDFS are commonly used to solve puzzles like the 15-puzzle, Rubik’s Cube, Sokoban, and more by modeling states and transitions. Optimal solutions are found without domain knowledge.

**Route Planning**

BFS or UCS efficiently find shortest paths in transportation networks by expanding nodes in a graph representing intersections and streets. No heuristic guidance is needed.

**Game Playing**

Game state spaces are traversed by uninformed methods to explore possible moves and determine optimal plays. Minimax tree search uses DFS and IDDFS for games like chess and checkers.

**Pathfinding in Robotics**

Searching grid maps of the environment allows robots to navigate obstacles using simple uninformed strategies like BFS without sensing capabilities. DFS is also popular for online path planning.

Uninformed methods have distinct advantages as well as limitations to consider:

## Advantages of Uninformed Search

- Complete – Guaranteed to find solution if one exists (besides DFS).
- Optimality – Finds lowest-cost solution (UCS, IDDFS).
- Simple to implement – No complex heuristic functions needed.
- Generic – Broadly applicable across problem domains.
- No domain knowledge required – Searches based purely on problem structure.

## Disadvantages of Uninformed Search

- Slow performance – Expands many unnecessary nodes.
- High memory needs – All frontier nodes must be tracked.
- Scalability issues – Becomes impractical for very large spaces.
- No informed guidance – Results in exponential time complexity.
- DFS risks getting stuck in infinite loops.

## Real-World Examples

Two classic problems highlight applications and tradeoffs of uninformed search strategies:

The Traveling Salesman Problem

TSP involves finding the shortest tour through a set of cities. It can be solved optimally using BFS/UCS by modeling each tour permutation as a node. But the huge state space causes scaling issues.

The 8-Puzzle Problem

This classic sliding tile puzzle is efficiently solved using IDDFS. The depth limits prune the search space well. Repeated iterations find the optimal solution sequence of moves.

These examples demonstrate how uninformed search can tackle NP-hard combinatorial problems in AI, but also motivates informed techniques for practical solution times.

## Best Practices for Using Uninformed Search Strategies

Key guidelines for effectively applying uninformed search include:

- Match the algorithm to problem constraints like optimality needs, memory limitations etc.
- Use iterative deepening for memory-efficient depth-first search.
- Apply bidirectional search for problems with natural goal state symmetry.
- Formulate objective function and transition model carefully based on problem structure.
- Leverage mechanisms like duplicate detection to prune state space.
- If slow, use domain knowledge to switch to an informed search strategy.
- Analyze tradeoffs between optimality, speed, completeness etc. for the problem.

**More to read**

- Artificial Intelligence Tutorial
- History of Artificial Intelligence
- AI Career Path
- How to Become AI Engineer?
- 4 Types of Artificial Intelligence
- What is the purpose of Artificial Intelligence?
- Artificial and Robotics
- Benefits of Artificial Intelligence
- Benefits of Artificial Intelligence in Marketing
- Benefits of Artificial Intelligence in Workplace
- Benefits of Artificial Intelligence in Education
- 15 Benefits of Artificial Intelligence in Society
- Intelligent Agents in AI
- Hill Climbing in AI
- Informed Search Strategies in AI
- Production System in AI
- Artificial Intelligence Vs. Machine Learning
- Artificial Intelligence Vs. Human Intelligence
- Artificial Intelligence Vs. Data Science
- Artificial Intelligence Vs. Computer Science
- What Artificial Intelligence Cannot Do?
- Importance of Artificial Intelligence
- How has Artificial Intelligence Impacted Society?
- Application of Artificial Intelligence in Robotics