1. Gyanastra
  2. Artificial Intelligence
  3. Approaches to AI
  4. State Space and Uninformed Search
Free lesson, no account needed 12 min read 9 practice questions after it
Asked in past papers4 times
  • UGC NET2020201820132012

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 g(n)g(n) means the exact cost from the initial state to node nn.
  • 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 bb is the number of successors of a node, usually the maximum or average.
    The root is at depth 0. Let dd be the depth of the shallowest goal, mm the maximum depth of the search tree, and ll 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 h(n)h(n) of the cost from nn to the goal. Greedy best-first search, A*, and hill climbing are informed; DFS and BFS are uninformed. A* typically uses f(n)=g(n)+h(n)f(n)=g(n)+h(n).
  • 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 g(n)g(n). IDDFS repeatedly runs DLS with increasing limits.

How it works

Formal problem formulation.

  1. Define the initial state.
  2. Define the set of actions or operators.
  3. Define the transition model: what state results from each action.
  4. Define the goal test.
  5. Define the path cost, usually with non-negative step costs.
    The resulting reachable states and transitions form the state-space graph.

Breadth-First Search.

  1. Put the initial node in a FIFO queue.
  2. Remove the front node.
  3. Test whether it is a goal.
  4. If not, enqueue all unvisited successors, generally left to right.
  5. 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 SS, children A,BA,B, and AA's children C,DC,D, the order is S,A,B,C,DS,A,B,C,D.

Depth-First Search.

  1. Put the initial node on a stack.
  2. Pop the top node.
  3. Test whether it is a goal.
  4. Push its successors, usually in reverse order if left-to-right expansion is desired.
  5. 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 ll. A node at depth ll 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 l≥dl \ge d, the shallowest goal depth.

Iterative Deepening Depth-First Search.

  1. Run DLS with limit 00.
  2. If no solution, run DLS with limit 11.
  3. Run DLS with limit 22, then 33, 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.

  1. Put the initial node in a priority queue ordered by g(n)g(n).
  2. Remove the node with the least path cost.
  3. Test for goal when the node is removed, not merely when generated.
  4. Insert successors with their updated gg-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 O(bd/2)O(b^{d/2}).

Figure. Initial state, actions, and transition model form the state-space graph. The goal test, path cost, and that graph feed the search algorithm, which returns a solution path.

Formulas

  • Path cost: g(n)=∑i=1kcig(n)=\sum_{i=1}^{k} c_i, where cic_i are step costs from the initial state to node nn.
  • Number of nodes in a complete tree up to depth hh, with branching factor b>1b>1:
    N=∑i=0hbi=bh+1−1b−1.N=\sum_{i=0}^{h} b^i=\frac{b^{h+1}-1}{b-1}.
  • BFS time/space: O(bd)O(b^d) 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 O(bd+1)O(b^{d+1}). Space is O(bd)O(b^d).
  • DFS time: O(bm)O(b^m); DFS space on a tree: O(bm)O(bm). With graph search and a visited set, space becomes O(V)O(V) for VV states.
  • DLS time: O(bl)O(b^l); DLS space: O(bl)O(bl).
  • IDDFS time: O(bd)O(b^d); IDDFS space: O(bd)O(bd).
  • UCS time and space: O(b1+⌊C∗/ϵ⌋)O(b^{1+\lfloor C^*/\epsilon \rfloor}), where C∗C^* is the optimal solution cost and ϵ>0\epsilon>0 is the minimum step cost. When all step costs are equal, this reduces to BFS-style O(bd)O(b^d).
  • Bidirectional search time and space: about O(bd/2)O(b^{d/2}) for unit-cost BFS in both directions.

Worked examples

Example 1: Complete tree node count.
A complete tree has branching factor b=3b=3, root at depth 00, and depths 00 through 33 are present.
Number of nodes: 1+3+32+33=1+3+9+27=40.1+3+3^2+3^3=1+3+9+27=40. Using the formula: N=34−13−1=81−12=40.N=\frac{3^{4}-1}{3-1}=\frac{81-1}{2}=40. Final answer: 40 nodes.

Example 2: Depth-limited search with a deeper goal.
A search tree has root at depth 00, depth limit l=4l=4, and the only goal is at depth 66.
DLS explores from the root down to depth 44. At depth 44, it stops expanding nodes. Since the goal is at depth 66, 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 55, then 66, and at limit 66 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 gg, 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 gg; IDDFS repeats DLS with increasing limits.

Example 4: Uniform-cost search, two-step optimality.
Consider directed edges: S→AS\to A cost 1, S→BS\to B cost 4, A→CA\to C cost 3, B→DB\to D cost 1, C→GC\to G cost 4, D→GD\to G cost 2.
Trace by gg-values:

  1. Pop SS with g=0g=0; add A=1A=1, B=4B=4.
  2. Pop AA with g=1g=1; add C=4C=4.
  3. Pop BB with g=4g=4 (tie with C=4C=4; either tie order is acceptable); add D=5D=5.
  4. Pop CC with g=4g=4; add G=8G=8.
  5. Pop DD with g=5g=5; add G=7G=7, which improves the earlier G=8G=8.
  6. Pop GG with g=7g=7; goal reached.
    Path: S→B→D→GS\to B\to D\to G, cost 4+1+2=74+1+2=7. The other path S→A→C→GS\to A\to C\to G costs 1+3+4=81+3+4=8. Final answer: optimal cost 7.

Comparison

AlgorithmFrontier structureComplete?Optimal?TimeSpace
BFSFIFO queueYes if bb is finiteYes only if all step costs are equalO(bd)O(b^d) or O(bd+1)O(b^{d+1}) depending on goal-test timingO(bd)O(b^d)
DFSLIFO stack or recursionNo in infinite or cyclic spaces; yes for finite graph with visited setNoO(bm)O(b^m)O(bm)O(bm) on a tree; O(V)O(V) with visited set
DLSStack with depth cutoff llYes if l≥dl\ge dNo in generalO(bl)O(b^l)O(bl)O(bl)
IDDFSRepeated DLSYes if bb is finiteYes if all step costs are equalO(bd)O(b^d)O(bd)O(bd)
UCSPriority queue by g(n)g(n)Yes for non-negative costs with ϵ>0\epsilon>0YesO(b1+⌊C∗/ϵ⌋)O(b^{1+\lfloor C^*/\epsilon\rfloor})Same order as time
Bidirectional SearchTwo frontiers, often BFSYes under standard finite-branching conditionsYes for unit costs with BFS on both sidesAbout O(bd/2)O(b^{d/2})About O(bd/2)O(b^{d/2})
ConceptState-space graphSearch tree
Nodes representProblem statesPaths from the initial state
Edges representLegal actions with costsOperator applications that generate children
RepetitionMay contain cycles and repeated statesMay duplicate states; can be infinite
PurposeDefines the problemDefines the algorithm's exploration
PairOne-line difference
BFS vs UCSBFS expands by shallowest depth; UCS expands by least path cost gg.
DFS vs DLSDFS has no depth limit; DLS stops at limit ll.
DLS vs IDDFSDLS uses one fixed limit; IDDFS repeats DLS with increasing limits.
Uninformed vs informedUninformed uses only problem definition; informed also uses heuristic h(n)h(n).

Revision summary

  • BFS space is O(bd)O(b^d), not O(bd)O(bd); BFS time is O(bd)O(b^d) under goal-test-on-generation.
  • DFS space is O(bm)O(bm); DFS time is O(bm)O(b^m).
  • DLS space is O(bl)O(bl); IDDFS space is O(bd)O(bd).
  • BFS uses a queue; DFS uses a stack; UCS uses a priority queue by gg.
  • BFS is complete for finite bb, 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 1+b+b2+⋯+bh=(bh+1−1)/(b−1)1+b+b^2+\cdots+b^h=(b^{h+1}-1)/(b-1).
  • 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 O(bd)O(b^d), DFS O(bm)O(bm), DLS O(bl)O(bl), IDDFS O(bd)O(bd).
  • 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 O(bd)O(b^d) with O(bd)O(bd); confusing DFS time O(bm)O(b^m) with space O(bm)O(bm); marking DLS optimal in general; calling BFS optimal when costs differ.
  • If a question mentions α\alpha-β\beta 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 O(bd)O(bd).
  • 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.

Pages 1–2 of 2