/mstw java /demonstrates minimum spanning tree with weighted graphs /to run this programc>java mstwapp import java awt *///////////////////////////////////////////////////////////////class edge public int srcvert/index of vertex starting edge public int destvert/index of vertex ending edge public int distance/distance from src to dest public edge(int svint dvint dsrcvert svdestvert dvdistance /end class edge /constructor ///////////////////////////////////////////////////////////////class priorityq /array in sorted orderfrom max at to min at size- private final int size private edge[quearrayprivate int sizepublic priorityq(/constructor quearray new edge[size]size public void insert(edge itemorder int /insert item in sorted for( = <sizej++/find place to insert ifitem distance >quearray[jdistance breakfor(int =size- >=jk--/move items up quearray[ + quearray[ ]quearray[jitemsize++public edge removemin(/insert item /remove minimum item