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

Sign in to watch this lesson
Algorithms - Graphs II · 4:38
When links have latencies instead of equal costs, hop counting fails, and Dijkstra's algorithm finds the lowest-latency route from one gateway to all others: repeatedly mark the unmarked vertex with the smallest label and relax its edges. We run it on a five-gateway graph (distances 0 3 1 4 7, route 0 2 1 3 4), prove each label is final when marked with the frontier-wall argument, implement the dense O(n^2 + m) version that is optimal when m is close to n^2, and break it with a single negative rebate link.