示例#1
0
 public void printPath() {
   for (Vertex v : vs) {
     printPath(v);
     System.out.println();
   }
   System.out.println();
 }
示例#2
0
 private void printPath(Vertex v) {
   if (v == vs[start]) System.out.print(v + " ");
   else {
     if (v.pred == null) System.out.print("no path from " + vs[start] + " to " + v);
     else {
       printPath(v.pred);
       System.out.print(v + " ");
     }
   }
 }