Divide and Conquer
Explore the divide and conquer strategy to enhance shortest path computations in graphs. This lesson covers advanced dynamic programming approaches like Fischer-Meyer and Leyzorek algorithms, enabling you to efficiently calculate all-pairs shortest paths in C++.
We'll cover the following...
Improving the Bellman-Ford algorithm
We can make a more significant improvement, as suggested by Michael Fischer and Albert Meyer in 1971. Bellman’s recurrence breaks the shortest path into a slightly shorter path and a single edge by considering all possible predecessors of the target vertex. Instead, let’s break the shortest paths into two shorter shortest paths at the middle vertex. This idea gives us a different recurrence for the same function . Here, we need to stop at the base case instead of , because a path with at most one edge has no “middle” vertex. To simplify the recurrence slightly, let’s define for every vertex .
As stated, this recurrence only works when is a power of ...