adjmat[ ][ sortedarray new char[max_verts]/end constructor /matrix to /sorted vert labels /public void addvertex(char labvertexlist[nverts++new vertex(lab)/public void addedge(int startint endadjmat[start][end /public void displayvertex(int vsystem out print(vertexlist[vlabel)/public void topo(/toplogical sort int orig_nverts nverts/remember how many verts while(nverts /while vertices remain/get vertex with no successorsor - int currentvertex nosuccessors()if(currentvertex =- /must be cycle system out println("errorgraph has cycles")return/insert vertex label in sorted array (start at endsortedarray[nverts- vertexlist[currentvertexlabeldeletevertex(currentvertex)/end while /delete vertex /vertices all gonedisplay sortedarray system out print("topologically sorted order")for(int = <orig_nvertsj++system out printsortedarray[ )system out println("")/end topo