Lecture Notes Discrete Optimization - Applied Mathematics
Lecture Notes Discrete Optimization - Applied Mathematics
Lecture Notes Discrete Optimization - Applied Mathematics
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
definition, the interior nodes of P belong to the set {1,...,k}. There are two cases that<br />
can occur: Either node k is an interior node of P or not.<br />
First, assume that k is not an interior node of P. Then all interior nodes of P must belong<br />
to the set {1,...,k−1}. That is, P is a shortest (u,v,k−1)-path and thus δ k (u,v) =<br />
δ k−1 (u,v).<br />
Next, suppose k is an interior node of P, i.e., P=〈u=v 1 ,...,k,...,v l = v〉. We can then<br />
break P into two paths P 1 =〈u,...,k〉 and P 2 =〈k,...,v〉. Note that the interior nodes of<br />
P 1 and P 2 are contained in{1,...,k−1} because P is simple. Moreover, because subpaths<br />
of shortest paths are shortest paths, we conclude that P 1 is a shortest(u,k,k−1)-path and<br />
P 2 is a shortest(k,v,k−1)-path. Therefore, δ k (u,v)=δ k−1 (u,k)+δ k−1 (k,v).<br />
The above observations lead to the following recursive definition of δ k (u,v):<br />
⎧<br />
⎪⎨ 0 if u=v<br />
δ 0 (u,v)= c(u,v) if (u,v)∈E<br />
⎪⎩<br />
∞ otherwise.<br />
and<br />
δ k (u,v)=min{δ k−1 (u,v), δ k−1 (u,k)+δ k−1 (k,v)}<br />
if k≥1<br />
The Floyd-Warshall algorithm simply computes δ k (u,v) in a bottom-up manner. The<br />
algorithm is given in Algorithm 6.<br />
Theorem 4.3. The Floyd-Warshall algorithm solves the APSP problem without negative<br />
cycles in time Θ(n 3 ).<br />
References<br />
The presentation of the material in this section is based on [3, Chapters 25 and 26].<br />
26