private int ntreeprivate distpar spath[]private int currentvertprivate int starttocurrent/current number of vertices /number of verts in tree /array for shortest-path data /current vertex /distance to currentvert /public graph(/constructor vertexlist new vertex[max_verts]/adjacency matrix adjmat new int[max_verts][max_verts]nverts ntree for(int = <max_vertsj++/set adjacency for(int = <max_vertsk++/matrix adjmat[ ][kinfinity/to infinity spath new distpar[max_verts]/shortest paths /end constructor /public void addvertex(char labvertexlist[nverts++new vertex(lab)/public void addedge(int startint endint weightadjmat[start][endweight/(directed/public void path(/find all shortest paths int starttree /start at vertex vertexlist[starttreeisintree truentree /put it in tree /transfer row of distances from adjmat to spath for(int = <nvertsj++int tempdist adjmat[starttree][ ]spath[jnew distpar(starttreetempdist)/until all vertices are in the tree while(ntree nvertsint indexmin getmin()/get minimum from spath