Graph Traversal

Mode:

Graph Traversal

BFS (Breadth-First Search): Explores nodes level by level using a queue. Good for finding shortest paths.

DFS (Depth-First Search): Explores as far as possible along each branch using a stack. Good for cycle detection.

BFS Time: O(V + E)
DFS Time: O(V + E)
Space: O(V)
Unvisited
Visiting
Visited
Start Node
Click to add nodes, then switch to edge mode to connect them