A new link costs n squared
transcript
A new link arrives. Rebuild the whole table? That costs n cubed. Links may arrive hundreds of times. There is a cheaper way.
A route uses the link once. Twice would make a loop. A loop only adds cost here.
Old distance, or through the link. Try both directions. Keep the smaller one. One pass over all pairs does it.
With three hundred vertices, an update is ninety thousand steps. A rebuild is twenty-seven million.
Keep the smaller link. Two links may join one pair. A plain assignment keeps the last.
Old routes are already correct. A new route has three parts. Old route, the link, old route.
A link has two ends, a and b. A route may enter at a. Or it may enter at b. Try both for every pair.
Do not rebuild for each link. Compare through the link. One pass of n squared. Full breakdown in the lecture.