Пример #1
0
 public static void test(String[] args) {
   In in = new In(args[0]);
   EdgeWeightedGraph G = new EdgeWeightedGraph(in);
   KruskalMST mst = new KruskalMST(G);
   for (Edge e : mst.edges()) {
     StdOut.println(e);
   }
   StdOut.printf("%.5f\n", mst.weight());
 }
Пример #2
0
 public static void test(String[] args) {
   String filename = args[0];
   String delimiter = args[1];
   SymbolGraph sg = new SymbolGraph(filename, delimiter);
   Graph G = sg.G();
   while (StdIn.hasNextLine()) {
     String source = StdIn.readLine();
     int s = sg.index(source);
     for (int v : G.adj(s)) {
       StdOut.println("   " + sg.name(v));
     }
   }
 }