import java.util.ArrayList; public class PrimsAlgorithm { public static boolean added[]; public static ArrayList mst; public static IndexedPriorityQueue pq; public static int cost[]; public static int fromVertex[]; public static void primsMST(WeightedGraph G) { added=new boolean[G.V]; mst=new ArrayList(); pq=new IndexedPriorityQueue(G.V); cost=new int[G.V]; fromVertex=new int[G.V]; for(int i=0;i