Algorithms and Data Structures · Middle · Question 31 of 75
What is a topological sort?
- 1Sorting vertices by how many neighbors they have
- 2An order of vertices from the shortest path to the longest
- ✓Correct answer: An order of DAG vertices where every edge points forward
Explanation
It's how build tools, package managers and task schedulers order work: a task comes after everything it depends on. It exists only if the graph has no cycles.