Topological Sort
Domain: Algorithms
🎯 Motivation
Order the nodes of a Directed Acyclic Graph (DAG) so that every edge goes from earlier to later. Essential for scheduling and dependency resolution.
📋 Concrete Example
Course prerequisites: CS101 -> CS201 -> CS301. A topological sort gives [CS101, CS201, CS301] — a valid order to take the courses.
🔗 Analogy
Getting dressed: underwear before trousers, trousers before shoes. A topological sort gives a valid dressing order where no item comes before its prerequisite.