graphs the graphn workshop applet and bfs use the graphn workshop applet to try out breadth-first search using the bfs button againyou can experiment with the graph of figure or you can make up your own notice the similarities and the differences of the breadth-first search compared with the depth-first search you can think of the breadth-first search as proceeding like ripples widening when you drop stone in water--orfor those of you who enjoy epidemiologyas the influenza virus carried by air travelers from city to city firstall the vertices one edge (plane flightaway from the starting point are visitedthen all the vertices two edges away are visitedand so on java code the bfs(method of the graph class is similar to the dfs(methodexcept that it uses queue instead of stack and features nested loops instead of single loop the outer loop waits for the queue to be emptywhereas the inner one looks in turn at each unvisited neighbor of the current vertex here' the codepublic void bfs(/breadth-first search /begin at vertex vertexlist[ wasvisited true/mark it displayvertex( )/display it thequeue insert( )/insert at tail int while!thequeue isempty(/until queue emptyint thequeue remove()/remove vertex at head /until it has no unvisited neighbors while( =getadjunvisitedvertex( )!- /get onevertexlist[ wasvisited true/mark it displayvertex( )/display it thequeue insert( )/insert it /end while(unvisited neighbors/end while(queue not empty/queue is emptyso we're done for(int = <nvertsj++vertexlist[jwasvisited false/end bfs(/reset flags