lecture_10

# lecture_10 - Shortest paths revisited Input: a weighted...

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

Shortest paths revisited Input: s a weighted directed graph G = (V,E) s edge weight w(e) can be +ve or –ve ; s vertexes s and t To find: the shortest (smallest weight) path from s to t (s-t path). Recall that the proof of Dijkstra’s algorithm fails if there are –ve edge weight. Indeed, Dijkstra’s algorithm doesn’t work in the presence of –ve edge. s u v t 2 3 1 -6

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

View Full Document
Negative edge weights A quick fix: Add a “big” number to each edge to ensure the edge weight is positive. E.g., Add 6 to every edge. u 2 Does it work? No, the shortest path is not preserved. s v t 2+6 3+6 1+6 -6+6
Background – negative cycles Fact. If a path from s to t contains a negative cycle, then there doesn’t exists a shortest path from s to t . Intuitively, the path can go through the loop many times to make the total weight smaller than any number. 3 It remains to consider the case when G has negative edges but no negative cycles. s t weight of cycle < 0

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

View Full Document
Background – no negative cycles Lemma. Assume that no s-t path contains a negative cycle. Then there exists a shortest s-t path that is a simple path (no duplicate vertexes). Proof. Let P be an
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/01/2010 for the course CS 1234 taught by Professor Chan during the Spring '10 term at University of the Bío-Bío.

### Page1 / 14

lecture_10 - Shortest paths revisited Input: a weighted...

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

View Full Document
Ask a homework question - tutors are online