listing graphs continued /returns an unvisited vertex adj to public int getadjunvisitedvertex(int vfor(int = <nvertsj++if(adjmat[ ][ ]== &vertexlist[jwasvisited==falsereturn jreturn - /end getadjunvisitedvertex(//end class graph ///////////////////////////////////////////////////////////////class bfsapp public static void main(string[argsgraph thegraph new graph()thegraph addvertex(' ')/ (start for dfsthegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addedge( )thegraph addedge( )thegraph addedge( )thegraph addedge( )/ab /bc /ad /de system out print("visits")thegraph bfs()/breadth-first search system out println()/end main(/end class bfsapp ///////////////////////////////////////////////////////////////the breadth-first search has an interesting propertyit first finds all the vertices that are one edge away from the starting pointthen all the vertices that are two edges awayand so on this is useful if you're trying to find the shortest path from the starting vertex to given vertex you start bfsand when you find the specified vertexyou know the path you've traced so far is the shortest path to the node if there were shorter paththe bfs would have found it already