Embed presentation
Downloaded 16 times








Depth First Search (DFS) is an algorithm for traversing or searching a graph by exploring as far as possible along each branch before backtracking. It uses a stack to keep track of vertices and processes the next vertex by popping it from the stack, exploring its neighbors, and pushing any unvisited neighbors onto the stack. The algorithm labels vertices as they are discovered to avoid processing any vertex twice.







