Exemplo n.º 1
0
 public static void depthFirst(Vertex[] VA, Vertex v) {
   SimpleStack stack = new SimpleStack("stack");
   ArrayList<Vertex> visited = new ArrayList<Vertex>();
   stack.push(v);
   while (!stack.isEmpty()) {
     Vertex x = (Vertex) stack.pop();
     if (!visited.contains(x)) {
       visited.add(x);
       System.out.println(x.name + " was visited.");
       //				for (Edge e : ) {
       //
       //				}
     }
   }
 }