Problem Statement:
Depth First Traversal (or Search) for a graph is similar to Depth First Traversal (DFS) of a tree.
The only catch here is, unlike trees, graphs may contain cycles, so a node might be visited
twice. To avoid processing a node more than once, use a boolean visited array.
Write a program to implement Depth first Traversal iteratively.
Input:
n = 4, e = 6 0 -> 1, 0 -> 2, 1 -> 2, 2 -> 0, 2 -> 3, 3 -> 3
Output:
DFS from vertex 1 : 1 2 0 3