Kahn's Algorithm - Topological Sorting
Kahn's algorithm is a method used to perform a topological sort on a directed acyclic graph(DAG). A topological sort produces a linear ordering of vertices such that every directed edge from vertex u to vertex v, u comes before v in the ordering. Main applications of the algorithm are
- Course prerequisite scheduling
- Build dependency resolution
- Task scheduling with dependencies
- Detecting cycles in directed graph
FIG. TOPOLOGICAL SORTING● INTERACTIVE
Problems
207. Course Schedule
802. Find Eventual Safe States
1136. Parallel Courses
2115. Find All Possible Recipes from Given Supplies
Medium·
Solutions:
FIG. FIND ALL POSSIBLE RECIPES FROM GIVEN SUP● INTERACTIVE