Mental Model
We find an order to do tasks so that all dependencies come before the task itself. We start with tasks that have no dependencies and remove them step by step.
Analogy: Imagine you have to bake a cake, but you must first prepare ingredients like flour and eggs. You start with tasks that need no preparation, then move on to tasks that depend on those, like mixing and baking.
Graph nodes with arrows showing dependencies: [A] -> [B] -> [D] ↓ ↓ [C] -> [E] In-degree counts: A:0, B:1, C:1, D:1, E:2 Queue starts with nodes having in-degree 0: Queue: [A]
