Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 39s1 days 16 hours 1 minutes 39 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 39s1 days 16 hours 1 minutes 39 seconds.

Sign in to watch this lesson
Algorithms - Graphs I · 3:59
A topological order lines up the vertices of a directed graph so every arrow points forward, and it exists exactly when there is no cycle. We build one two ways on six start-of-day jobs: reversing the DFS finishing order (5 4 1 0 3 2) and Kahn's algorithm, which peels vertices with in-degree zero (4 5 1 0 3 2), checks for cycles and tells you when the order is unique. Then a single left-to-right DP sweep over that order gives the earliest finish times, a 10-minute morning, and its critical chain 4 0 3 2.