LinkedList<N> computeOrder(DirectedGraph<N> g){
  stmtToColor=new HashMap<N,Integer>();
  order=new LinkedList<N>();
  graph=g;
{
    Iterator<N> stmtIt=g.iterator();
    while (stmtIt.hasNext()) {
      N s=stmtIt.next();
      stmtToColor.put(s,WHITE);
    }
  }
{
    Iterator<N> stmtIt=g.iterator();
    while (stmtIt.hasNext()) {
      N s=stmtIt.next();
      if (stmtToColor.get(s) == WHITE) {
        visitNode(s);
      }
    }
  }
  return order;
}

LinkedList < N > computeOrder ( DirectedGraph < N > g ) { stmtToColor = new HashMap < N , Integer > ( ) ; order = new LinkedList < N > ( ) ; graph = g ; { Iterator < N > stmtIt = g . iterator ( ) ; while ( stmtIt . hasNext ( ) ) { N s = stmtIt . next ( ) ; stmtToColor . put ( s , WHITE ) ; } } { Iterator < N > stmtIt = g . iterator ( ) ; while ( stmtIt . hasNext ( ) ) { N s = stmtIt . next ( ) ; if ( stmtToColor . get ( s ) == WHITE ) { visitNode ( s ) ; } } } return order ; }
orders in pseudo - topological order .
