UNIHIVE

Study Hub UNIPORT CSC 494

CSC 494 · Introduction to Artificial Intelligence

Uninformed (blind) search

Breadth-first, depth-first, uniform-cost, depth-limited and iterative deepening search, and how they are compared.

Our notes

2 min read

Search trees

Search builds a tree from the initial state: the frontier holds nodes waiting to be expanded; the explored set avoids repeating states. Strategies differ in which node they expand next.

Comparing strategies

  • Completeness: finds a solution if one exists?
  • Optimality: finds the cheapest?
  • Time and space complexity: in terms of b (branching factor), d (depth of the shallowest goal), m (maximum depth).

The strategies

StrategyFrontierComplete?Optimal?TimeSpace
Breadth-first (BFS)queue (FIFO)yesyes if all step costs equalO(b^d)O(b^d)
Uniform-cost (UCS)priority queue by path cost gyes (positive costs)yesabout O(b^(1 + C*/ε))same
Depth-first (DFS)stack (LIFO)no (infinite paths)noO(b^m)O(bm)
Depth-limitedDFS to limit lno if l < dnoO(b^l)O(bl)
Iterative deepening (IDS)DFS with limits 0, 1, 2, ...yesyes if equal costsO(b^d)O(bd)
Bidirectionalfrom start and goalyesyes (with BFS)O(b^(d/2))O(b^(d/2))

IDS combines BFS's completeness with DFS's small memory; it is the usual choice for large spaces with unknown depth.

Worked example

Graph: A → B, C; B → D, E; C → F; E → G. Start A, goal G. Children are taken left to right.

  • BFS expands A, B, C, D, E, F, then finds G: order A, B, C, D, E, F, G. Path A-B-E-G.
  • DFS expands A, B, D (dead end), E, then G: order A, B, D, E, G.
  • IDS: limit 0: A; limit 1: A, B, C; limit 2: A, B, D, E, C, F; limit 3: A, B, D, E, G found.

Worked example: memory

With b = 10 and d = 6, BFS may keep about 10⁶ nodes (a million) in memory; DFS or IDS keeps about b × d = 60.

Uniform-cost search

Expands the node with the lowest path cost g(n), so it handles unequal step costs (road distances). It is Dijkstra's algorithm with a goal test.

Exams usually ask

  • Describe BFS, DFS, UCS and IDS and compare them.
  • Give the order of node expansion on a given graph.

Common mistake

Claiming DFS is optimal. DFS may find a long path first; BFS (equal costs) and UCS (any positive costs) are optimal.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 494 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.