⚡ Graph Algorithms

Topological Sort (Kahn's)

Linearly orders vertices of a Directed Acyclic Graph (DAG) such that for every directed edge (u, v), node u comes before node v. Essential for task scheduling and package resolution.

📊
0
Total Nodes
🔗
0
Total Edges
🏁
0
Sorted Count
📥
0
Queue Size
TOPOLOGICAL SORT DAG

💡 Editor Guide: Click empty space to add a node. Click and drag from one node to another to create a dependency edge.

Execution Log

Click Load DAG Example or draw a custom DAG, then run.

🎯 Topological Sort Order

No nodes sorted yet.

📊 In-Degree Tracker

Node In-Degree
No nodes defined.

🛠️ Presets

⚡ Kahn's Algorithm

Kahn's algorithm runs in O(V + E) time. If any node has non-zero in-degree at the end, a cycle exists.