Problem: Input: a directed graph G Output: is an ordering V1, ..., Vn of Vertices(G) s.t. forall all Vi --> Vj (i.e. (Vi,Vj) \in Edges(G)) i < j // DFS implemented using post-visit TopoSort(G) out := EmptyList() for each v in Vertices(G) if not(marked(v)) then Visit(G,v,out) return out Visit(G,v,out) mark(v) for each w in AdjSet(v) if not(marked(w)) Visit(G,w,out) return Push(out,w)