public class Prim { static int MAX = 65535; public static void prim(int[][] graph, int n){ char[] c = new char[]{'A','B','C','D','E','F','G','E','F'}; int[] lowcost = new int[n]; int[] mst = new int[n]; int i, j, min, minid, sum = 0; for(i = 1; i < n…