public void addvertex(char labvertexlist[nverts++new vertex(lab)/public void addedge(int startint endadjmat[start][end adjmat[end][start /public void displayvertex(int vsystem out print(vertexlist[vlabel)/public 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 /end while(queue not empty/queue is emptyso we're done for(int = <nvertsj++vertexlist[jwasvisited false/end bfs(/reset flags //returns an unvisited vertex adj to public int getadjunvisitedvertex(int vfor(int = <nvertsj++if(adjmat[ ][ ]== &vertexlist[jwasvisited==false