implemented with queue these mechanisms resultas we'll seein the graph being searched in different ways depth-first search the depth-first search uses stack to remember where it should go when it reaches dead end we'll show an exampleencourage you to try similar examples with the graphn workshop appletand then finally show some code that carries out the search an example we'll discuss the idea behind the depth-first search in relation to figure the numbers in this figure show the order in which the vertices are visited figure depth-first search to carry out the depth-first searchyou pick starting point--in this casevertex you then do three thingsvisit this vertexpush it onto stack so you can remember itand mark it so you won' visit it again nextyou go to any vertex adjacent to that hasn' yet been visited we'll assume the vertices are selected in alphabetical orderso that brings up you visit bmark itand push it on the stack now whatyou're at band you do the same thing as beforego to an adjacent vertex that hasn' been visited this leads you to we can call this process rule rule if possiblevisit an adjacent unvisited vertexmark itand push it on the stack applying rule again leads you to at this pointhoweveryou need to do something else because there are no unvisited vertices adjacent to here' where rule comes in