What's topological sorting?
You can define the problem of topological sorting as follows:
An input is:
A set V of values
A set R of pairs of values
When (a, b) appears in R, this means intuitively that a must come before b in the output. An output for such an instance is an ordering of the elements of V such that all relationships in R are obeyed. An example of an instance of this problem is a set of classes offered at a school and prerequisite relationships between them describing which classes you must already have taken to sign up for another one. The output here would be a feasible order to take all of the classes in.
