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.
4. Shortest Paths<br />
4.1 Introduction<br />
We next consider shortest path problems. These problems are usually defined for directed<br />
networks. Let G =(V,E) be a directed graph with cost function c : E → R. Consider a<br />
(directed) path P=〈v 1 ,...,v k 〉 from s=v 1 to t = v k . The length of path P is defined as<br />
c(P)=∑ k−1<br />
i=1 c(v i,v i+1 ). We can then ask for the computation of an s,t-path whose length<br />
is shortest among all directed paths from s to t. There are different variants of shortest<br />
path problems:<br />
1. Single source single target shortest path problem: Given two nodes s and t, determine<br />
a shortest path from s to t.<br />
2. Single source shortest path problem: Given a node s, determine all shortest paths<br />
from s to every other node in V.<br />
3. All-pairs shortest path problem: For every pair(s,t)∈ V ×V of nodes, compute a<br />
shortest path from s to t.<br />
The first problem is a special case of the second one. However, every known algorithm for<br />
the first problem implicitly also solves the second one (at least partially). We therefore<br />
focus here on the single source shortest path problem and the all-pairs shortest path<br />
problem.<br />
4.2 Single Source Shortest Path Problem<br />
We consider the following problem:<br />
Single Source Shortest Path Problem (SSSP):<br />
Given: A directed graph G=(V,E) with cost function c : E →R and a source<br />
node s∈ V.<br />
Goal: Compute a shortest path from s to every other node v∈ V.<br />
Note that a shortest path from s to a node v might not necessarily exist because of the<br />
following two reasons: First, v might not be reachable from s because there is no directed<br />
path from s to v in G. Second, there might be arbitrarily short paths from s to v because<br />
of the existence of an s,v-path that contains a cycle of negative length (which can be<br />
traversed arbitrarily often). We call a cycle of negative total length also a negative cycle.<br />
The following lemma shows that these are the only two cases in which no shortest path<br />
exists.<br />
Lemma 4.1. Let v be a node that is reachable from s. Further assume that there is no<br />
path from s to v that contains a negative cycle. Then there exists a shortest path from s to<br />
v which is a simple path.<br />
Proof. Let P be a path from s to v. We can repeatedly remove cycles from P until we<br />
obtain a simple path P ′ . By assumption, all these cycles have non-negative lengths and<br />
18