Iterative DFS with stack-based graph traversal (2024)