Abstract
- Repeatedly removes nodes without dependencies (incoming edges) from the graph and adds them to the topological ordering
- As nodes without dependencies are removed from the graph, their outgoing edges are also removed, which may be the incoming edges of other nodes. Those other nodes will have their incoming edges removed and thus become free, becoming nodes without dependencies
- We repeat removing nodes without dependencies from the graph until all nodes are processed, or a cycle is discovered
How do I check for dependencies?
We check the incoming degree of the node. If it’s zero, it means it has no dependencies.