iterative DFS and benchmarks