Kahn's algorithm

Essentially, Kahn's algorithm works by keeping track of the number of incoming edges into each node (indegree).