Exp NO 8
Exp NO 8
AIM:
To write a program to implement Graph Traversals using Breath First Search tree
algorithm.
ALGORITHM :
4. If we see an adjacent node that has not been ‘visited’, add it to the stack.
5. Then pop of the top node on the stack and traverse to it.
And go back to step 1
PROGRAM:
void Graph::DFS(int v)
{
// Mark the current node as visited and
// print it
visited[v] = true;
cout<< "";
return 0;
}
OUTPUT :
novice@it002:~$ ./a.out