= Topological Sort = '''Definition''' A topological sort of a DAG G=(V,E) is a linear ordering of all its vertices such that if G contains an edge (u,v), then u appears before v in the ordering. (If the graph is not acyclic, then no linear ordering is possible.) '''Theorem (Topological Sort Correctness)''' Topologoical-Sort(G) produces a topological sort of a DAG G. '''Proof''' Suppose that DFS is run on a given DAG G=(V,E) to determin finish times for its vertices. It suffices to show that for any pair of distinct vertices u,v∈V, if there is an edge in G from u to v, then f[v]