weighted graphs /calculate distance for one spath entry /get edge from currentvert to column int currenttofringe adjmat[currentvert][column]/add distance from start int starttofringe starttocurrent currenttofringe/get distance of current spath entry int spathdist spath[columndistance/compare distance from start with spath entry if(starttofringe spathdist/if shorter/update spath spath[columnparentvert currentvertspath[columndistance starttofringecolumn++/end while(column nverts/end adjust_spath(the main(routine in the path java program creates the tree of figure and displays its shortest-path array here' the codepublic static void main(string[argsgraph thegraph new graph()thegraph addvertex(' ')/ (startthegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addvertex(' ')/ thegraph addedge( )thegraph addedge( )thegraph addedge( )thegraph addedge( )thegraph addedge( )thegraph addedge( )thegraph addedge( )thegraph addedge( )/ab /ad /bc /bd /ce /dc /de /eb system out println("shortest paths")thegraph path()/shortest paths system out println()/end main(