The idea is to first output vertices with no dependencies; that is, with in-degree = 0.
Once a vertex has been output, we can remove it from the graph and decrease the in-degree of all its adjacent vertices.
Repeat the process until no more vertices remain with in-degree 0.
If all vertices have been output, then the output order is one of perhaps several possible topological sorted orders.
If all vertices have not been output, then a cycle exists and topological sort is not possible.