Directed graphs and topological sorting can be used to determine a feasible ordering of courses based on prerequisites. Topological sorting algorithms perform a depth-first search on a directed acyclic graph (DAG) of course prerequisites to output a linear ordering of courses with no edges between earlier and later courses. For example, a topological sorting of computer science courses outputs an order allowing each course to be taken only after completing its prerequisites.