CMPS 2200 – Fall 2012
All Pairs Shortest Paths
Carola Wenk Slides courtesy of Charles Leiserson y with changes by Carola Wenk
11/26/12 CMPS 2200 Intro. to Algorithms 1
All Pairs Shortest Paths Carola Wenk Slides courtesy of Charles - - PowerPoint PPT Presentation
CMPS 2200 Fall 2012 All Pairs Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson y with changes by Carola Wenk 11/26/12 CMPS 2200 Intro. to Algorithms 1 Shortest paths p Single-source shortest paths Nonnegative edge
11/26/12 CMPS 2200 Intro. to Algorithms 1
11/26/12 CMPS 2200 Intro. to Algorithms 2
11/26/12 CS 3343 Analysis of Algorithms 3
11/26/12 CS 3343 Analysis of Algorithms 4
11/26/12 CS 3343 Analysis of Algorithms 5
(k) = min {cij (k–1), cik (k–1) + ckj (k–1)}
(k–1)
(k–1)
(k )
(k )
(k–1)
11/26/12 CS 3343 Analysis of Algorithms 6
(k-1) + c (k-1) then
(k 1) > cik
(k 1) + ckj (k 1) then
(k) ← cik (k-1) + ckj (k-1)
(k) ← cij (k-1)
11/26/12 CS 3343 Analysis of Algorithms 7
11/26/12 CS 3343 Analysis of Algorithms 8