Overview
DFS explores a graph by going deep into neighbors before exploring siblings. It uses a stack (explicit or call stack) to track the path.
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Explore DFS step‑by‑step on a custom graph. DFS explores as far as possible along each branch before backtracking.
DFS explores a graph by going deep into neighbors before exploring siblings. It uses a stack (explicit or call stack) to track the path.
LIFO (Last‑In, First‑Out). Pushing unvisited neighbors onto the stack ensures we visit the most recently discovered node next.
A visited set prevents cycles and redundant exploration, ensuring every node and edge is processed once.
Topological sort, finding connected components, solving puzzles (mazes), and cycle detection.