⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 29s17 days 22 hours 19 minutes 29 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 29s17 days 22 hours 19 minutes 29 seconds.

Sign in to watch this lesson
Advanced - Graphs · 4:32
A currency loop whose rates multiply to more than one becomes a negative cycle once every rate r is turned into the weight −log r. Starting every Bellman–Ford label at zero (a virtual source joined to every vertex) finds a negative cycle anywhere in the graph, and n parent steps from the last relaxed vertex land on the loop before we collect it. For all pairs, Floyd–Warshall marks (i, j) as −∞ when i reaches a vertex with a negative distance to itself that reaches j, and Johnson's potentials make every weight non-negative for Dijkstra.