graphs else /if it existsvertexlist[vwasvisited true/mark it displayvertex( )/display it thestack push( )/push it /end while /stack is emptyso we're done for(int = <nvertsj++/reset flags vertexlist[jwasvisited false/end dfs at the end of dfs()we reset all the wasvisited flags so we'll be ready to run dfs(again later the stack should already be emptyso it doesn' need to be reset now we have all the pieces of the graph class we need here' some code that creates graph objectadds some vertices and edges to itand then performs depth-first searchgraph thegraph new graph()thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addedge( )thegraph addedge( )thegraph addedge( )thegraph addedge( )(start for dfs/ab /bc /ad /de system out print("visits")thegraph dfs()/depth-first search system out println()figure shows the graph created by this code here' the outputvisitsabcde you can modify this code to create the graph of your choiceand then run it to see it carry out the depth-first search