 Welcome to this course on data structures and algorithms. We will continue our discussion on graphs. Today we are going to look at the graph traversal problem using what we call depth first search. In this particular depth first search algorithm for traversing graph, this one is used for both graphs and trees by the way and the fundamental thing is that the traversal is depth word. So, that means we have to actually traverse all the nodes of the graph in that depth first plan. We shall be using a stack to implement this search. There are many applications such as simulating a game of chess etcetera. Let us look at the main algorithm which has been taken from a Wikipedia article referenced here. Let us look at the algorithm the procedure called depth first search. So, let S be a stack all that we do is we push the node on the stack G is the graph by the way and node is the starting node. So, starting node is pushed on the stack first. Now, while S is not empty we do the following. We pop the node from the stack which currently is the first node and if the node is not visited which initially is true for the first node. We mark the node as visited and we actually visit the nodes by looking at all the edges from node to all the adjacent nodes in G. What we do there? We push the adjacent nodes onto the stack. This we repeat for all nodes which are not visited. A very clear understanding can now we reach through a simple example and demonstration. Let us look at a graph which has A, B, C, D, E as five nodes and these are the directed edges. Let us assume that A is the starting node of the graph. So, we start the algorithm by visiting A. Next we look at the nodes which are adjacent to A when we visit A. When we visit A we will get nodes in the order B and C here of which in the depth first search which as we shall see later C will come is the first one. After C we continue the process we will get D. After that we continue the process we will get E. After that we will have to backtrack because we have visited all these nodes. The only node unvisited is B that will get visited in the next sequence which means that the order of DFS search for this particular graph will be A, C, D, E, B. To conclude in this short session we have seen what a depth first search on a graph is and we have seen an algorithm and this algorithm attempts to use stack to implement the depth first search. In the next session we shall see a program to implement depth first search. Thank you.