lecture_06 - Shortest paths Dasgupta et al. 4.1-4.5 Cormen...

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

View Full Document Right Arrow Icon
Shortest paths Dasgupta et al. 4.1-4.5 Cormen et al. 24.2-24.3
Background image of page 1

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

View Full DocumentRight Arrow Icon
Shortest Paths in a Graph Input: s A directed graph G = (V, E), each edge e is associated with a positive weight (length), denoted w(e). s Source s , destination t . 2 Shortest path problem : Find a shortest (total length) directed path from s to t . NB. The total length of this path is called the shortest distance from s to t .
Background image of page 2
Shortest Paths: simple case Simple case. Assume that w(e) = 1 for all edges e. Use breath first search . u w 1 1 3 s u v w x t Shortest distance from s to t = 2. s v t x 1 1 1 1 1 1 1 1 1
Background image of page 3

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

View Full DocumentRight Arrow Icon
Arbitrary edge weights. For any node u, let d(u) be the shortest distance from s to u. The appraoch . Step 1. Find the node u such that d(u) is the smallest. 4 Step 2. Find the node w such that d(w) is the next smallest. Step 3. Repeat the steps until we encounter the node t .
Background image of page 4
Example u w 5 3 1 1 d(v) = 2 d(u) = 4 d(x) = 6 d(w) =6 (t) = 7 5 s v t x 6 2 2 6 5 4 2 d(t) = 7
Background image of page 5

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

View Full DocumentRight Arrow Icon
Dijkstra's algorithm Maintain a set of visited nodes S for which we have determined the shortest distance d(u) from s to u. Initialize
Background image of page 6
Image of page 7
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_06 - Shortest paths Dasgupta et al. 4.1-4.5 Cormen...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online