What is topological sorting, and under what conditions can it be applied to a graph? Walk through the execution of the algorithm.