Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shortest-Path Property 4.1

Similar presentations


Presentation on theme: "Shortest-Path Property 4.1"— Presentation transcript:

1 Shortest-Path Property 4.1
If the path s -> n1 -> n2 -> … -> nk is a shortest path from s to k, then the subpath s -> n1 -> n2 -> … -> ni is a shortest path from s to i for i = 1, 2, 3, …, k-1.

2 1) P1 + P2 is a shortest path from s to k
Proof of Prop. 4.1: Idea 1) P1 + P2 is a shortest path from s to k P1 P2 s i k P3 If P3 is shorter than P1, then the directed walk P3 + P2 contains a shorter path from s to k than P1 + P2. Contradicts statement 1.

3 Proof of Prop. 4.1: Details Suppose P1 + P2 is a shortest path from s to k, but P1 is not a shortest path from s to i. P1 P2 s i k P3 Case 1: P1 and P3 are node-disjoint Case 2: P1 and P3 have at least one node in common

4 Proof of Prop. 4.1: Case 1 P1 P2 s i k P3
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 P3 Case 1: P1 and P3 are node-disjoint

5 P3 and P2 pass have node j in common.
Proof of Prop. 4.1: Case 2 P1 s i k P2 P3 j P3 and P2 pass have node j in common.

6 Directed Path Contained in the Directed Walk P3 + P2
s i k P4 j

7 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 P1 is 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.

8 A shortest path from 1 to 5 1 5 2 4 3 d(3) d(4) d(5) d(2) d(1)
From 4.1: d(2) = c12 = c = c12 + d(1) d(3) = d(2) + c23 d(4) = d(3) + c34 d(5) = d(4) + c45

9 Shortest Path Tree 7 6 7 5  2 4 5 7 1 1 2 6  8 9 1 6 5 2 3 -2  5 3
1 6 5 2 3 4 -2 5 3

10 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 some node k. d*(j) = d*(i) + cij for every arc (i,j) in P

11 Converse Property Suppose 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.

12 A path where d(j) = d(i) + cij
Length of path = c12 + c23 + c34 + c45 1 5 2 4 3 d(2) = d(1) + c12 = c12 d(3) = d(2) + c23 = c12 + c23 d(4) = d(3) + c34 = c12 + c23 + c34 d(5) = d(4) + c45 = c12 + c23 + c34 + c45 Length of path = d(5) (shortest path length)

13 Shortest-Path Property 4.2
Let d be the vector of shortest path distances for a given network. The directed path P from the source to node k is a shortest path if and only if d(j) = d(i) + cij for every arc (i,j) in P.

14 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.

15 Correctness of the Reaching Algorithm
Proof by induction. Suppose the algorithm has reached node k-1 and that the labels on nodes 1,2,…,k-1 are optimal. Show that when the algorithm reaches node k that the label on node k is optimal.

16 A shortest path to node k
ni k By 4.1, the subpath to ni is a shortest path. Since we have a T.O., ni < k. Inductive hypothesis: the label on is ni is a correct shortest path label. When the algorithm reached ni it scanned arc (ni,k) and set the label on k to d(ni) + c(ni,k) = length of shortest path from s to node k.


Download ppt "Shortest-Path Property 4.1"

Similar presentations


Ads by Google