200 likes | 303 Views
EMIS 8374 Shortest Path Trees Updated 11 February 2008. Shortest-Path Property 4.1.
E N D
Shortest-Path Property 4.1 If the path s, (s, v1),v1 , (v1, v2), v2 , …, vk is a shortest path from s to k, then the subpaths, (s, v1),v1 , (v1, v2), v2 , …, vi is a shortest path from s to i for i = 1, 2, 3, …, k-1. Subpaths of shortest paths are shortest paths.
P3 Proof of Prop. 4.1: Idea 1) P1+P2is a shortest path from s to k P1 P2 s i k If P3is shorter than P1, then the directed walk P3+P2contains a shorter path from s to k than P1+P2. This contradicts statement 1.
P3 Proof of Prop. 4.1: Details Suppose that P1+P2is a shortest path from s to k, but P1 is not a shortest path from s to i. P1 P2 s i k Let P3 be a shortest path from s to i Case 1: P2 and P3 are node-disjoint Case 2: P2 and P3 have at least one node in common
P3 Proof of Prop. 4.1: Case 1 If P1 is not a shortest path from s to node i and P1 and P3 are node-disjoint, then the path composed of P3 followed by P2 is a shorter path from s to k then the path composed of P1 followed by P2. This is a contradiction. P1 P2 s i k Case 1: P2 and P3 are node-disjoint
P1 P3 P2 Proof of Prop. 4.1: Case 2 s i k j P3andP2have node j in common.
Proof of Prop. 4.1: Case 2 s i k j P4
Proof by Contradiction • We assume there are no negative cycles. • Length (P4) Length(P3+P2). • If P3 is a shortest path from s to i, but P1is not then Length(P3+P2) < Length(P1+P2). • Implies Length (P4) < Length(P1+P2). • Implies P1+P2 is not a shortest path from s to k which is a contradiction.
Corollary to 4.1 • Let d* be the vector of shortest path distances for a given network and source node s. • Let P be a shortest path from s to node t. • d*(j) = d*(i) + cij for every arc (i,j) in P
Converse Property Suppose that d*(j) = d*(i) + cij for every arc (i,j) on a path P from s to t. Claim: P is a shortest path from s to t.
Example of Converse Property 6 4 5 1 4 2 3 s t d*(3) = 15 d*(1) = 0 d*(4) = 6 d*(2) = 10 The converse property says that the path P = 1, (1, 4), 4, (4, 2), 2, (2, 3), 3 is a shortest path from 1 to 3. • d*(4) = d*(1) + c14 • d*(2) = d*(4) + c42 • d*(3) = d*(2) + c23
Shortest-Path Property 4.2 Let d* be the vector of shortest path distances for a given network and source node s. The directed path P from s to node k is a shortest path if and only if d*(j) = d*(i) + cij for every arc (i,j) in P.
Optimality Condition for Shortest Path Trees Let d* be the vector of shortest path distances for a given network. The directed-out tree T rooted at s is a shortest path tree if and only if d*(j) = d*(i) + cij for every arc (i,j) in T and d*(j) d*(i) + cij for every arc (i,j) not in T.
A Shortest Path Tree 7 6 7 5 2 4 5 7 1 1 6 2 0 8 1 6 5 2 3 4 -2 5 3 Tree Arc Non-Tree Arc
Correctness of the Reaching Algorithm • Proof by induction. • Clearly, the algorithm assigns the correct label to node 1 (d(1) = 0). • Since the nodes are visited according to the T.O., d(2) = d(1) + c12. • Since d(1) = 0 = d*(1), d(2) = d*(1) + c12. • Thus, by property 4.2 d(2) = d*(2). • After the algorithm scans node 2, d(3) is either equal to d(1)+c13or d(2)+c12. • In the first case d(3) = d*(1) + c13 and in the second case d(3) = d*(2) + c23. • Either way, d(3) = d*(3) by property 4.2.
Correctness of d(1), d(2), and d(3): Case 1 d(3)=d*(2)+c23 d(2) = c12= d*(1)+c12 1 2 3 0 d(2)=d*(2) d(3)=d*(3)
Correctness of d(1), d(2), and d(3): Case 2 d(2) = c12= d*(1) + c12 2 d(3) = d*(1) + c13 d(2) = d*(2) 1 3 0 d(3) = d*(3)
Inductive Step • Claim: when the reaching algorithm scans node k, the label on node k is correct (i.e., d(k) = d*(k)). • We have established the base case by showing this is true for nodes 1, 2, and 3. • Inductive hypothesis : the labels for nodes 1, 2, …, k-1 are correct. • To complete the proof show that the label on node k is correct.
n1=1 n2 n3 nh k A shortest path to node k Let node 1 = n1, (n1,n2), n2, (n2,n3), n3 , …, nh, (nh,k), k be a shortest path to node k. By 4.1 n1, (n1,n2), n2, (n2,n3), n3 , …, nh is a shortest path to node nh. By 4.2, d*(k) = d*(nh) + cnh,k
n1=1 n2 n3 nh k A shortest path to node k Due to the T.O., node nh is scanned before node k. By the induction hypothesis, d(nh) = d*(nh). When the algorithm reaches nh it scans arc (nh,k) and sets the label on k to d*(nh) + cnh,k Thus, the algorithm sets d(k) = d*(k). QED.