TOPOLOGICAL_SORT(G)
- Call DFS(g) to compute f[v] for each vertex.
- As each vertex is finished, insert it onto the front of a linked list.
- Return the list.
TOPOLOGICAL_SORTII(G)
- L ← []
- while there are verticies in G
- Locate a source vertex v.
- L.push_back(v)
- Remove v from G.