Guest User
Using app without sign in

Practice book
Graph Theory Through Problems300 Exercises with Hints, Worked Algorithms and Complete Solutions
By Mohammed Islam Hadjoudj
Learn graph theory by solving problems: 300 exercises, from routine checks to challenging proofs, each with a complete solution.
Also by the authorGraph Algorithms for Coding Interviews100 solved interview problems with visual explanations and Python solutions.View on AmazonSelect an algorithm and generate steps to begin visualization
Depth-first search with a growing depth limit
Repeats a depth-limited DFS with growing limits to find a target at the smallest depth
Select an algorithm and generate steps to begin visualization
Iterative deepening depth-first search (IDDFS) finds a target vertex by running a depth-limited DFS again and again with limits 0, 1, 2 and so on. It combines the strengths of both classic searches: like BFS it finds the target at the smallest possible depth, and like DFS it only keeps the current path in memory.
Each round is an ordinary DFS that may not go deeper than the current limit. When the limit stops the search at a vertex that still has unexplored neighbours, that vertex is a cut-off, and a deeper round is needed. If a round finishes without any cut-off and without finding the target, the target is unreachable. Shallow levels are explored again in every round, but because the deepest level dominates the work, the total time stays O(b^d) for branching factor b and depth d, while the memory is only O(d).
IDDFS is the standard uninformed search in artificial intelligence when the search space is too large to store, such as game trees and puzzle state spaces. Chess engines use iterative deepening to always have a best move ready within a time limit, and IDA* extends the idea with a heuristic. In interviews it appears in questions about searching huge or infinite graphs with limited memory.
Related algorithms: Depth-First Search, Breadth-First Search, Bidirectional BFS, A* Search Algorithm