Shortest path in DAG, topological sort