learngraphtheory.org

Guest User

Using app without sign in

Cover of the book Graph Theory Through Problems

Practice book

Graph Theory Through Problems

300 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.

Available inKindlePaperback

13 chapters

Also by the authorGraph Algorithms for Coding Interviews100 solved interview problems with visual explanations and Python solutions.View on Amazon
Algorithm Selection

Select an algorithm and generate steps to begin visualization

IDDFS Visualizer

Depth-first search with a growing depth limit

Repeats a depth-limited DFS with growing limits to find a target at the smallest depth

Time: O(b^d)
Space: O(d)
Use Case: Searching huge or infinite spaces with little memory
Showing the example graph for this algorithm.
Algorithm Execution

Select an algorithm and generate steps to begin visualization

About Iterative Deepening DFS (IDDFS)

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.

How it works

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).

Applications

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

Interactive Controls

Zoom Controls

48%
Nodes: 9
Edges: 9