question: @ SuppressWarnings ( "unchecked" ) protected final List < N > computeOrder ( DirectedGraph < N > g , boolean reverse ) { final int n = g . size ( ) ; visited = Collections . newSetFromMap ( new IdentityHashMap < N , Boolean > ( n * 2 + 1 ) ) ; indexStack = new int [ n ] ; stmtStack = ( N [ ] ) new Object [ n ] ; order = ( N [ ] ) new Object [ n ] ; graph = g ; orderLength = 0 ; for ( N s : g ) { if ( visited . add ( s ) ) visitNode ( s ) ; if ( orderLength == n ) break ; } if ( reverse ) reverseArray ( order ) ; List < N > o = Arrays . asList ( order ) ; indexStack = null ; stmtStack = null ; visited = null ; order = null ; return o ; }
target:  Orders in pseudo-topological order.