public void printPath() { for (Vertex v : vs) { printPath(v); System.out.println(); } System.out.println(); }
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 + " "); } } }