recitation14

recitation14 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

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

MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .

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

View Full Document
6.006 Recitation Build 2008.25
6.006 Proudly Presents Dijkstra: minimum-cost paths on crack Algorithm Concepts Implementation Data structures come back from the dead (not talking about the quiz)

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

View Full Document
Minimum-Path Problem Given: graph G, source vertex s, edge costs Want: paths from s to everything else with minimum costs (sum of edge costs) Approach: let d[v] be upper bounds for the real minimum costs, δ [v] Start out easy: d[v] = , d[s] = 0 Relax until values in d converge to δ
Good Dijkstra Generic initialization 4 B U = V 0 4 Choose v = argmin d[v in U], remove v from U 1 2 1 Notice d[v] = δ [v] 2 1 Relax v’s outgoing edges D 3 Rinse, repeat S A C E

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

View Full Document
Bad Dijkstra Generic initialization U = V Choose v = argmin d[v in U], remove v from U Notice d[v] = δ [v] Relax v’s outgoing edges S A B C D -5 4 2 1 1 1 Rinse, repeat
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 16

recitation14 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

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

View Full Document
Ask a homework question - tutors are online