Kahn’s algorithm for topological sorting is used mainly when tasks or items have to be ordered, where some tasks or items have to occur before others can. For example:
Scheduling jobs, given dependencies some jobs have on some other jobs.
Course arrangement in educational institutions. Finding prerequisites of any job or task.
Detecting deadlocks in operating systems. Finding out if cycles exist in a graph.
Resolving symbol dependencies in linkers. Compile-time build dependencies. Deciding the appropriate order of performing compilation tasks in makefiles.