Topological Sorting

Updated Apr 28, 2026

Short answer

Linear ordering of vertices in a Directed Acyclic Graph (DAG) such that for every edge uv, u comes before v.

Deep explanation

Mid-level Graph theory focuses on classic pathfinding and optimization algorithms. Linear ordering of vertices in a Directed Acyclic Graph (DAG) such that for every edge uv, u comes before v.

Real-world example

Google Maps finding the fastest route to a destination.

Common mistakes

  • Using Dijkstra on a graph with negative edge weights.

Follow-up questions

  • Time complexity of Dijkstra?

More Graph Theory interview questions

View all →