Lecture 4: Uninformed Search

Learn Uninformed Search in Artificial Intelligence including State Space, Breadth First Search (BFS), Depth First Search (DFS), Depth Limited Search, and Iterative Deepening Search with examples and explanations.

1. Introduction to Problem Solving by Searching

In Artificial Intelligence, many problems are solved by searching through possible solutions.
The system explores different states until it finds a goal state.

A search algorithm helps an AI agent move from the initial state to the goal state.

Examples:

  • Finding the shortest route on Google Maps
  • Solving puzzles
  • Robot navigation
  • Game playing

Search methods that do not use extra knowledge about the goal are called Uninformed Search.

These algorithms only know:

  • Initial state
  • Possible actions
  • Goal test
  • Path cost

They do not know which direction leads closer to the goal.

2. State Space

Definition

A state space is the set of all possible states or configurations of a problem.

Each state represents a possible situation in the problem.

Example

Maze problem:

  • Each position in the maze = state
  • Moving left/right/up/down = actions
  • Exit of maze = goal state

Components of State Space

  1. Initial State
    Starting point of the problem.
  2. Actions (Operators)
    Possible moves from one state to another.
  3. Transition Model
    Shows how actions change states.
  4. Goal Test
    Checks if the goal state is reached.
  5. Path Cost
    Cost required to reach the goal.

State Space Representation

State space is usually represented as a tree or graph.

Example:

        A
/ \
B C
/ \ \
D E F

A = Initial state
F = Goal state

3. Uninformed Search

Definition

Uninformed search is also called Blind Search.

These algorithms explore the search space without guidance.

They only use the information provided in the problem definition.

  1. Breadth First Search (BFS)
  2. Depth First Search (DFS)
  3. Depth Limited Search (DLS)
  4. Iterative Deepening Search (IDS)

4. Breadth First Search (BFS)

Definition

Breadth First Search explores the shallowest nodes first.

It searches the tree level by level.

Working Principle

BFS uses a Queue (FIFO).

FIFO = First In First Out.

Steps:

  1. Start with the initial node.
  2. Add it to the queue.
  3. Remove the first node.
  4. Expand its children.
  5. Add children to the queue.
  6. Repeat until goal is found.

Example

        A
/ \
B C
/ \ \
D E F

BFS traversal:

A → B → C → D → E → F

Goal found at F.

Properties of BFS

Completeness: Yes
Optimal: Yes (if path costs are equal)
Time Complexity: O(b^d)
Space Complexity: O(b^d)

Where:

  • b = branching factor
  • d = depth of goal

Advantages

  • Finds shortest path
  • Guaranteed to find solution

Disadvantages

  • Requires large memory

5. Depth First Search (DFS)

Definition

Depth First Search explores the deepest nodes first before exploring siblings.

It goes as far as possible down one branch before backtracking.

Working Principle

DFS uses a Stack (LIFO).

LIFO = Last In First Out.

Steps:

  1. Start at root.
  2. Expand one child.
  3. Continue deeper.
  4. If dead end reached → backtrack.

Example

        A
/ \
B C
/ \ \
D E F

DFS traversal:

A → B → D → E → C → F

Properties of DFS

Completeness: No
Optimal: No
Time Complexity: O(b^m)
Space Complexity: O(bm)

Where:

  • m = maximum depth

Advantages

  • Requires less memory
  • Simple implementation

Disadvantages

  • May get stuck in infinite path
  • Not guaranteed shortest path

6. Depth Limited Search (DLS)

Breadth First Search Algorithm Explanation

Definition

Depth Limited Search is a modified version of DFS with a depth limit.

It restricts the search depth to a fixed value.

Purpose

DFS can go into infinite depth.

DLS prevents this by setting a maximum depth limit (L).

Example

Depth limit = 2

        A
/ \
B C
/ \ \
D E F

Levels:

Level 0 → A
Level 1 → B C
Level 2 → D E F

Search stops at level 2.

Properties

Completeness: No
Optimal: No
Time Complexity: O(b^L)
Space Complexity: O(bL)

Advantages

  • Avoids infinite search
  • Uses less memory

Disadvantages

  • If limit is too small, solution may be missed

7. Iterative Deepening Search (IDS)

Definition

Iterative Deepening Search combines BFS and DFS.

It repeatedly performs Depth Limited Search with increasing depth.

Working Process

Depth limits increase gradually:

Depth = 0
Depth = 1
Depth = 2
Depth = 3

Until goal is found.

Example

        A
/ \
B C
/ \ \
D E F

Goal = F

Iteration 1 (Depth 0)

A

Iteration 2 (Depth 1)

A → B → C

Iteration 3 (Depth 2)

A → B → D → E → C → F

Goal found.

Properties

Completeness: Yes
Optimal: Yes (if cost same)
Time Complexity: O(b^d)
Space Complexity: O(bd)

Advantages

  • Uses less memory than BFS
  • Guaranteed solution
  • Finds optimal solution

Disadvantages

  • Repeats some work

8. Comparison of Uninformed Search Algorithms

AlgorithmCompleteOptimalTime ComplexitySpace Complexity
BFSYesYesO(b^d)O(b^d)
DFSNoNoO(b^m)O(bm)
DLSNoNoO(b^L)O(bL)
IDSYesYesO(b^d)O(bd)

9. Summary

In this lecture we studied Uninformed Search algorithms used in Artificial Intelligence.

Main concepts:

  • State Space – all possible states of a problem.
  • Breadth First Search (BFS) – explores level by level.
  • Depth First Search (DFS) – explores deepest nodes first.
  • Depth Limited Search (DLS) – DFS with a depth limit.
  • Iterative Deepening Search (IDS) – repeated DLS with increasing depth.

These algorithms help AI systems explore problems when no extra knowledge about the goal is available.

Lecture 3: Knowledge Representation and Reasoning

Multiple Choice Questions (MCQs)

1. Uninformed search is also called:
A) Guided search
B) Blind search
C) Intelligent search
D) Optimal search

Answer: B) Blind search

2. Which of the following explores nodes level by level?
A) DFS
B) DLS
C) BFS
D) IDS

Answer: C) BFS

3. BFS uses which data structure?
A) Stack
B) Queue
C) Tree
D) Array

Answer: B) Queue

4. DFS uses which data structure?
A) Queue
B) Stack
C) Heap
D) Graph

Answer: B) Stack

5. In BFS, nodes are expanded in:
A) Random order
B) Depth order
C) Level order
D) Reverse order

Answer: C) Level order

6. Which search algorithm explores the deepest nodes first?
A) BFS
B) DFS
C) IDS
D) DLS

Answer: B) DFS

7. What does DLS stand for?
A) Deep Learning Search
B) Depth Limited Search
C) Data Level Search
D) Directed Level Search

Answer: B) Depth Limited Search

8. Which algorithm combines BFS and DFS?
A) DFS
B) BFS
C) IDS
D) DLS

Answer: C) IDS

9. Which search algorithm guarantees the shortest path if costs are equal?
A) DFS
B) BFS
C) DLS
D) IDS

Answer: B) BFS

10. In DFS, when a dead end is reached, the algorithm:
A) Stops completely
B) Goes to root
C) Backtracks
D) Deletes node

Answer: C) Backtracks

11. The set of all possible states of a problem is called:
A) Search tree
B) State space
C) Algorithm
D) Data structure

Answer: B) State space

12. Which search algorithm may get stuck in infinite paths?
A) BFS
B) DFS
C) IDS
D) DLS

Answer: B) DFS

13. In Iterative Deepening Search, depth limit:
A) Decreases
B) Remains constant
C) Increases gradually
D) Is random

Answer: C) Increases gradually

14. BFS time complexity is:
A) O(b^d)
B) O(n)
C) O(log n)
D) O(b)

Answer: A) O(b^d)

15. Which search algorithm uses the least memory?
A) BFS
B) DFS
C) IDS
D) DLS

Answer: B) DFS

SHORT QUESTIONS ANSWERS

1. What is uninformed search in Artificial Intelligence?

Answer:
Uninformed search is a search technique that explores the state space without using any additional information about the goal. It only uses the initial state, possible actions, and goal test to find a solution.

2. Define state space in AI.

Answer:
State space is the set of all possible states or configurations that can occur in a problem from the initial state to the goal state.

3. What is Breadth First Search (BFS)?

Answer:
Breadth First Search is a search algorithm that explores nodes level by level, expanding the shallowest nodes first before moving deeper into the search tree.

4. What is Depth First Search (DFS)?

Answer:
Depth First Search is a search algorithm that explores the deepest nodes first, going down one branch completely before backtracking.

Answer:
Depth Limited Search is a modified version of DFS where the search is limited to a predefined depth level, preventing the algorithm from going too deep.

Answer:
Iterative Deepening Search repeatedly performs Depth Limited Search with increasing depth limits until the goal state is found.

7. Write two advantages of BFS.

Answer:

  1. It guarantees finding a solution if one exists.
  2. It finds the shortest path when all step costs are equal.

8. Write two disadvantages of DFS.

Answer:

  1. It may get stuck in infinite loops or deep paths.
  2. It does not guarantee the shortest solution.

9. What data structure is used in BFS?

Answer:
BFS uses a Queue (FIFO – First In First Out) data structure.

Answer:
The main purpose of Depth Limited Search is to avoid infinite search paths by restricting the search to a fixed depth limit.

LONG QUESTIONS ANSWERS

1. Explain Breadth First Search (BFS) in detail. Discuss its working principle, advantages, disadvantages, and properties.

Breadth First Search (BFS) is an uninformed search algorithm used in Artificial Intelligence to explore nodes of a search tree level by level. It expands the shallowest nodes first before moving to deeper levels of the tree.

BFS is commonly used when the goal state is expected to be near the starting point because it guarantees finding the shortest path if all costs are equal.

Working Principle of BFS

Breadth First Search uses a Queue data structure (FIFO – First In First Out) to store nodes that need to be explored.

Steps of BFS

  1. Start with the initial state and place it in the queue.
  2. Remove the first node from the queue.
  3. Check if the node is the goal state.
  4. If it is not the goal, expand the node and generate its child nodes.
  5. Add the child nodes to the end of the queue.
  6. Repeat the process until the goal node is found or the queue becomes empty.

Example

Search Tree:

        A
/ \
B C
/ \ \
D E F

Traversal using BFS:

A → B → C → D → E → F

The algorithm visits all nodes at one level before moving to the next level.

Properties of BFS

PropertyDescription
CompletenessBFS is complete because it will always find a solution if one exists.
OptimalityBFS finds the shortest path when all step costs are equal.
Time ComplexityO(b^d)
Space ComplexityO(b^d)

Where
b = branching factor
d = depth of the goal node

Advantages of BFS

  1. BFS guarantees finding a solution if it exists.
  2. It finds the shortest path in problems where step costs are equal.
  3. It systematically explores all nodes level by level.

Disadvantages of BFS

  1. BFS requires large memory because it stores all nodes in the queue.
  2. It can be slow for large search spaces with many nodes.

2. Describe the following uninformed search algorithms with examples.

Depth First Search (DFS)

Depth First Search is a search algorithm that explores the deepest nodes first before exploring other branches. It follows one path from the root node down to the deepest node before backtracking.

DFS uses a Stack data structure (LIFO – Last In First Out).

Example

        A
/ \
B C
/ \ \
D E F

DFS traversal:

A → B → D → E → C → F

The algorithm goes deep along one branch before exploring other branches.

Advantages of DFS

  • Requires less memory compared to BFS.
  • Simple to implement.

Disadvantages of DFS

  • May get stuck in infinite paths.
  • Does not guarantee the shortest path.

Depth Limited Search (DLS)

Depth Limited Search is a modified version of Depth First Search where a maximum depth limit is imposed on the search.

This prevents the algorithm from exploring infinite paths.

Example

If the depth limit is 2, the search will only explore nodes up to level 2.

        A
/ \
B C
/ \ \
D E F

Nodes beyond level 2 will not be explored.

Advantages of DLS

  • Prevents infinite depth problems.
  • Uses less memory.

Disadvantages of DLS

  • If the depth limit is too small, the algorithm may miss the solution.

Iterative Deepening Search (IDS)

Iterative Deepening Search combines the advantages of BFS and DFS.

It repeatedly performs Depth Limited Search with increasing depth limits until the goal is found.

Process

Depth limits increase gradually:

Iteration 1 → Depth 0
Iteration 2 → Depth 1
Iteration 3 → Depth 2

Example:

        A
/ \
B C
/ \ \
D E F

Traversal:

Iteration 1: A
Iteration 2: A → B → C
Iteration 3: A → B → D → E → C → F

The goal is found when the required depth is reached.

Advantages of IDS

  • Uses less memory than BFS.
  • Guaranteed to find a solution.
  • Finds optimal solution when step costs are equal.

Disadvantages of IDS

  • Some nodes are repeatedly explored in each iteration.

Leave a Reply

Your email address will not be published. Required fields are marked *