New answers tagged topological-ordering
0
votes
Why do we do topological sorting to find shortest or longest path in weighted DAG?
Toposort also work as a visited array and prevent from getting into a cycle where every time your distance increase
0 ---> 2 ---> 0
Now, you are thinking why don't we use a visited array instead ...
Top 50 recent answers are included
Related Tags
topological-ordering × 23graphs × 17
dag × 9
algorithms × 4
depth-first-search × 4
optimization × 3
graph-traversal × 3
connected-components × 2
time-complexity × 1
algorithm-analysis × 1
terminology × 1
sorting × 1
dynamic-programming × 1
np-hard × 1
distributed-systems × 1
sets × 1
greedy-algorithms × 1
parallel-computing × 1
scheduling × 1
induction × 1
genetic-algorithms × 1
colorings × 1
stacks × 1
hamiltonian-path × 1
partial-order × 1