← Back to All Algorithms
📊 Topological Sort (Kahn's Algorithm)
How It Works
Compute in-degree for each vertex
Add all vertices with in-degree 0 to queue
Remove vertex from queue, add to result
Decrease in-degree of neighbors; if 0, add to queue
Repeat until queue is empty
Use Case:
Task scheduling, build systems, course prerequisites
Click "Start" to compute topological order
Queue (in-degree = 0)
Topological Order
Reset
▶ Start
Step →