When tasks depend on other tasks, you need an order that does the prerequisites first, like a course plan or the build order of modules. Topological sort gives such an order for a directed acyclic graph. Kahn's algorithm also detects a cycle for free, because some vertices never reach in-degree 0. It only applies to directed graphs, and if a cycle exists no valid order is possible.