Artificial Intelligence · Approaches to AI
State Space and Uninformed Search
Overview
A search problem is solved by representing possible situations as states, legal moves as operators, and solutions as paths from the start state to a goal state.
This topic is the foundation of problem-solving and search in the syllabus; it explains how a problem is formulated before any search algorithm is applied.
The lesson covers the formal components of a search problem, the difference between a state-space graph and a search tree, and the standard uninformed search algorithms.
These ideas are needed before studying informed search, local search, game search, or constraint-based problem solving.
Key concepts
- A state is a complete description of a situation at one stage of a problem. The initial state is where search begins; a goal state satisfies the goal test.
- An operator or action is a legal move that changes one state into another. In the state-space graph, states are vertices and operators are directed, cost-labelled edges.
- The transition model or successor function returns the states reached by applying legal actions to a state, usually with the action name and step cost.
- A path cost is the sum of the step costs along a path. The notation means the exact cost from the initial state to node .
- A solution is a path from the initial state to a goal state. An optimal solution has the least path cost among all solutions.
- A state-space graph contains problem states and legal transitions; it may have cycles and repeated states.
A search tree is generated by the search algorithm: the root is the initial state, and a child is produced by applying an operator. - The branching factor is the number of successors of a node, usually the maximum or average.
The root is at depth 0. Let be the depth of the shallowest goal, the maximum depth of the search tree, and the depth limit. - Uninformed search, also called blind search, uses only the problem definition: initial state, operators, goal test, and path cost. It does not use problem-specific heuristic knowledge.
Standard uninformed searches are Breadth-First Search (BFS), Depth-First Search (DFS), Depth-Limited Search (DLS), Iterative Deepening Depth-First Search (IDDFS), Uniform-Cost Search (UCS), and Bidirectional Search. - Informed search uses a heuristic estimate of the cost from to the goal. Greedy best-first search, A*, and hill climbing are informed; DFS and BFS are uninformed. A* typically uses .
- Completeness means the algorithm finds a solution whenever one exists. Optimality means it finds a least-cost solution.
Time complexity counts nodes generated or expanded; space complexity counts nodes stored in memory. - The frontier or open list stores generated nodes not yet expanded. The explored set or closed list stores states already expanded, used to avoid repeated states and cycles.
- Expansion means removing a node from the frontier, applying operators, and inserting its successors. Goal-test timing matters: testing when a node is generated can stop earlier than testing only when it is expanded.
- Abstraction is the process of removing irrelevant details from a state representation while preserving the distinctions needed to solve the problem. It keeps the state space manageable.
- BFS uses a queue and explores level by level. DFS uses a stack or recursion and follows one branch deeply. UCS uses a priority queue ordered by . IDDFS repeatedly runs DLS with increasing limits.
How it works
Formal problem formulation.
- Define the initial state.
- Define the set of actions or operators.
- Define the transition model: what state results from each action.
- Define the goal test.
- Define the path cost, usually with non-negative step costs.
The resulting reachable states and transitions form the state-space graph.
Breadth-First Search.
- Put the initial node in a FIFO queue.
- Remove the front node.
- Test whether it is a goal.
- If not, enqueue all unvisited successors, generally left to right.
- Repeat until the queue is empty or a goal is found.
BFS expands all depth-0 nodes, then all depth-1 nodes, then depth-2 nodes, and so on. On a tree with root , children , and 's children , the order is .
Depth-First Search.
- Put the initial node on a stack.
- Pop the top node.
- Test whether it is a goal.
- Push its successors, usually in reverse order if left-to-right expansion is desired.
- Continue down one branch until it cannot go deeper, then backtrack.
DFS is memory-light on trees but can get trapped in an infinite branch or cycle unless a visited set or depth limit is used.
Depth-Limited Search.
DLS is DFS with a depth limit . A node at depth is not expanded; if it is not a goal, the branch returns cutoff. If a goal is found, return success. If no branch reaches the limit and no goal is found, return failure. DLS is complete only when , the shallowest goal depth.
Iterative Deepening Depth-First Search.
- Run DLS with limit .
- If no solution, run DLS with limit .
- Run DLS with limit , then , and so on.
It repeats shallow work, but the total cost is still dominated by the deepest level. It gives BFS-like shallow-solution behaviour with DFS-like memory.
Uniform-Cost Search.
- Put the initial node in a priority queue ordered by .
- Remove the node with the least path cost.
- Test for goal when the node is removed, not merely when generated.
- Insert successors with their updated -values; if a cheaper path to a state is found, update it.
UCS is optimal with non-negative step costs. BFS is the special case of UCS when all steps have equal cost.
Bidirectional Search.
Run one search forward from the initial state and another backward from the goal state; stop when the two frontiers meet. For unit-cost BFS in both directions, time and space are about .
Drawing the diagram…
Formulas
- Path cost: , where are step costs from the initial state to node .
- Number of nodes in a complete tree up to depth , with branching factor :
- BFS time/space: under the common convention that the goal test is applied when a node is generated. If the goal test is applied only when a node is expanded, BFS time is often written . Space is .
- DFS time: ; DFS space on a tree: . With graph search and a visited set, space becomes for states.
- DLS time: ; DLS space: .
- IDDFS time: ; IDDFS space: .
- UCS time and space: , where is the optimal solution cost and is the minimum step cost. When all step costs are equal, this reduces to BFS-style .
- Bidirectional search time and space: about for unit-cost BFS in both directions.
Worked examples
Example 1: Complete tree node count.
A complete tree has branching factor , root at depth , and depths through are present.
Number of nodes:
Using the formula:
Final answer: 40 nodes.
Example 2: Depth-limited search with a deeper goal.
A search tree has root at depth , depth limit , and the only goal is at depth .
DLS explores from the root down to depth . At depth , it stops expanding nodes. Since the goal is at depth , it is never reached.
If a depth-4 node has successors, the branch returns cutoff; otherwise it returns failure. To find the goal, IDDFS must increase the limit to , then , and at limit the goal is reached.
Final answer: DLS with limit 4 cannot find a goal at depth 6.
Example 3: Match-the-list style.
List-I: A. BFS, B. DFS, C. UCS, D. IDDFS.
List-II: i. FIFO queue, ii. LIFO stack, iii. priority queue by path cost , iv. repeated DLS.
Matching: A-i, B-ii, C-iii, D-iv.
Reason: BFS expands level by level with a queue; DFS follows one branch with a stack; UCS expands least ; IDDFS repeats DLS with increasing limits.
Example 4: Uniform-cost search, two-step optimality.
Consider directed edges: cost 1, cost 4, cost 3, cost 1, cost 4, cost 2.
Trace by -values:
- Pop with ; add , .
- Pop with ; add .
- Pop with (tie with ; either tie order is acceptable); add .
- Pop with ; add .
- Pop with ; add , which improves the earlier .
- Pop with ; goal reached.
Path: , cost . The other path costs . Final answer: optimal cost 7.
Comparison
| Algorithm | Frontier structure | Complete? | Optimal? | Time | Space |
|---|---|---|---|---|---|
| BFS | FIFO queue | Yes if is finite | Yes only if all step costs are equal | or depending on goal-test timing | |
| DFS | LIFO stack or recursion | No in infinite or cyclic spaces; yes for finite graph with visited set | No | on a tree; with visited set | |
| DLS | Stack with depth cutoff | Yes if | No in general | ||
| IDDFS | Repeated DLS | Yes if is finite | Yes if all step costs are equal | ||
| UCS | Priority queue by | Yes for non-negative costs with | Yes | Same order as time | |
| Bidirectional Search | Two frontiers, often BFS | Yes under standard finite-branching conditions | Yes for unit costs with BFS on both sides | About | About |
| Concept | State-space graph | Search tree |
|---|---|---|
| Nodes represent | Problem states | Paths from the initial state |
| Edges represent | Legal actions with costs | Operator applications that generate children |
| Repetition | May contain cycles and repeated states | May duplicate states; can be infinite |
| Purpose | Defines the problem | Defines the algorithm's exploration |
| Pair | One-line difference |
|---|---|
| BFS vs UCS | BFS expands by shallowest depth; UCS expands by least path cost . |
| DFS vs DLS | DFS has no depth limit; DLS stops at limit . |
| DLS vs IDDFS | DLS uses one fixed limit; IDDFS repeats DLS with increasing limits. |
| Uninformed vs informed | Uninformed uses only problem definition; informed also uses heuristic . |
Revision summary
- BFS space is , not ; BFS time is under goal-test-on-generation.
- DFS space is ; DFS time is .
- DLS space is ; IDDFS space is .
- BFS uses a queue; DFS uses a stack; UCS uses a priority queue by .
- BFS is complete for finite , but optimal only when step costs are equal.
- DFS can fail in an infinite-depth space even if a solution exists.
- A goal deeper than the depth limit causes DLS to return cutoff or failure, not success.
- IDDFS combines BFS-like shallow-solution behaviour with DFS-like low memory.
- UCS tests the goal when a node is popped, which protects optimality.
- Abstraction removes irrelevant state details and keeps only useful distinctions.
- Complete tree node count is .
- A state-space graph is the problem; a search tree is what the algorithm generates.
Previous-year exam insights
- Matching questions commonly pair each search algorithm with its worst-case space complexity: BFS , DFS , DLS , IDDFS .
- Direct concept questions ask which algorithm is not informed; DFS and BFS are uninformed, while A*, best-first search, and hill climbing use heuristic guidance.
- Assertion-reason questions test DFS incompleteness in infinite-depth spaces; DFS may keep going down one branch and never return to the shallow solution.
- Numeric questions ask for total nodes in a complete tree or the effect of a depth limit when the goal lies deeper than the limit.
- Order-of-expansion questions require careful queue or stack tracing; BFS is level by level, DFS is deep first, and “left to right” must be respected.
- Match-the-list questions also test frontier structures: queue for BFS, stack for DFS, priority queue for UCS, repeated DLS for IDDFS.
- Traps: confusing BFS space with ; confusing DFS time with space ; marking DLS optimal in general; calling BFS optimal when costs differ.
- If a question mentions - pruning or minimax, that is adversarial game search, not uninformed search.
Practice at PARIKSHA
You are ready for the PARIKSHA tests of this sub-topic when you can:
- Define initial state, operators, transition model, goal test, and path cost for a small problem.
- Distinguish a state-space graph from a search tree and explain why repeated states occur.
- Identify the frontier data structure used by BFS, DFS, UCS, DLS, and IDDFS.
- State completeness, optimality, time, and space for each standard uninformed search.
- Trace BFS and DFS on a small tree and write the exact expansion order.
- Trace DLS with a given limit and explain the difference between failure and cutoff.
- Trace IDDFS limits and show why its memory remains .
- Trace UCS on a weighted graph with different path costs and justify the optimal path.
- Compute the number of nodes in a complete tree using the geometric-series formula.
- Explain abstraction and quickly separate informed from uninformed search techniques.
Attempt the PARIKSHA sub-topic test first, then the subject test.