Depth-First Search (DFS) is a fundamental graph traversal algorithm that explores a branch of a search tree as deeply as possible before backtracking to explore alternative paths. It operates using a Last-In-First-Out (LIFO) stack, either explicitly or via recursion, to manage the search frontier. This strategy makes it memory-efficient for deep trees but risks exploring lengthy, irrelevant paths before finding a solution, a key consideration in agentic planning where the state space is vast.
