**Note:** You are looking at a static copy of the former PineWiki site, used for class notes by James Aspnes from 2003 to 2012. Many mathematical formulas are broken, and there are likely to be other bugs as well. These will most likely not be fixed. You may be able to find more up-to-date versions of some of these notes at http://www.cs.yale.edu/homes/aspnes/#classes.

A *topological sort* of a directed acyclic graph is an ordering of the vertices so that if uv is an edge of the graph, then u comes before v in the ordering. A typical application is project planning, where each edge uv represents a constraint that task u must be completed before task v starts.

Topological sort can be solved in O(V+E) time using DepthFirstSearch.

CategoryAlgorithmNotes