@Override public GraphNode nextElement(){
  if (empty()) {
    GraphNode v=theNextElement;
    currentRoot=theNextElement;
    info.set(v.getIndex(),getConnected(v));
    push(v);
  }
  recurse:   while (!empty()) {
    GraphNode v=peek();
    Enumeration<GraphNode> pendingChildren=info.get(v.getIndex());
    for (Enumeration<GraphNode> e=pendingChildren; e.hasMoreElements(); ) {
      GraphNode n=e.nextElement();
      Enumeration<GraphNode> nChildren=info.get(n.getIndex());
      if (nChildren == null) {
        info.set(n.getIndex(),getConnected(n));
        push(n);
        continue recurse;
      }
    }
    while (info.get(theNextElement.getIndex()) != null && e.hasMoreElements()) {
      theNextElement=e.nextElement();
    }
    return pop();
  }
  return null;
}

@ Override public GraphNode nextElement ( ) { if ( empty ( ) ) { GraphNode v = theNextElement ; currentRoot = theNextElement ; info . set ( v . getIndex ( ) , getConnected ( v ) ) ; push ( v ) ; } recurse : while ( ! empty ( ) ) { GraphNode v = peek ( ) ; Enumeration < GraphNode > pendingChildren = info . get ( v . getIndex ( ) ) ; for ( Enumeration < GraphNode > e = pendingChildren ; e . hasMoreElements ( ) ; ) { GraphNode n = e . nextElement ( ) ; Enumeration < GraphNode > nChildren = info . get ( n . getIndex ( ) ) ; if ( nChildren == null ) { info . set ( n . getIndex ( ) , getConnected ( n ) ) ; push ( n ) ; continue recurse ; } } while ( info . get ( theNextElement . getIndex ( ) ) != null && e . hasMoreElements ( ) ) { theNextElement = e . nextElement ( ) ; } return pop ( ) ; } return null ; }
find the next graph node in finishing time order .
