public static void main(String[] args) throws FileNotFoundException { /* Read an edge-weighted graph from a file */ EdgeWeightedGraph ewg = new EdgeWeightedGraph( new Scanner(new File("/home/aldin-sxr/Downloads/tinyEWG.txt"))); /* Instantiate the lazy Prim's algorithm */ LazyPrimMST prim = new LazyPrimMST(ewg); /* Print out MST edges*/ Iterable edges = prim.edges(); for (Edge e: edges) { System.out.println("(" + e.either() + ", " + e.other(e.either()) + ") - " + e.weight()); } /* Print out MST weight */ System.out.println("MST weight: " + prim.weight()); }