SSpaths

# SSpaths - Chapter 24 Single-Source Shortest Paths Given A...

This preview shows pages 1–7. Sign up to view the full content.

Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted , directed graph. Want to compute a shortest path for each possible destination. Similar to BFS. We will assume either no negative-weight edges, or no reachable negative-weight cycles. Algorithm will compute a shortest-path tree . Similar to BFS tree. Many of the slides are from Prof. Plaisted’s resources at University of North Carolina at Chapel Hill

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Outline General Lemmas and Theorems. CLRS now does this last. We’ll still do it first. Bellman-Ford algorithm. DAG algorithm. Dijkstra’s algorithm. We will skip Section 24.4.
Corollary: Let p = SP from s to v, where p = s u v. Then, δ(s, v) = δ(s, u) + w(u, v). General Results (Relaxation) Lemma 24.1: Let p = ‹v 1 , v 2 , …, v k › be a SP from v 1 to v k . Then, p ij = ‹v i , v i+1 , …, v j › is a SP from v i to v j , where 1 i j k. So, we have the optimal-substructure property . Floyd-Warshall algorithm uses dynamic programming . Dijkstra’s algorithm uses the greedy approach . Let δ(u, v) = weight of SP from u to v. → p' Lemma 24.10: Let s V. For all edges (u,v) E, we have δ(s, v) δ(s, u) + w(u,v).

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Relaxation Initialize(G, s) for each v V[G] do d[v] := ; π [v] := NIL od ; d[s] := 0 Relax(u, v, w) if d[v] > d[u] + w(u, v) then d[v] := d[u] + w(u, v); π [v] := u fi Algorithms keep track of d[v], π [v]. Initialized as follows: These values are changed when an edge (u, v) is relaxed :
Properties of Relaxation d[v], if not , is the length of some path from s to v. d[v] either stays the same or decreases with time Therefore, if d[v] = δ (s, v) at any time, this holds thereafter Note that d[v] δ (s, v) always After i iterations of relaxing on all (u,v), if the shortest path to v has i edges, then d[v] = δ (s, v).

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Properties of Relaxation Consider any algorithm in which d[v], and π [v] are first initialized by calling Initialize(G, s) [s is the source], and are only changed by calling Relax. We have: Lemma 24.11: ( 2200 v:: d[v] δ (s, v)) is an invariant. Implies d[v] doesn’t change once d[v] =
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 40

SSpaths - Chapter 24 Single-Source Shortest Paths Given A...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online