18-Shortest-Paths-II

18-Shortest-Paths-II - Algorithms LECTURE 18 Shortest Paths...

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

View Full Document Right Arrow Icon
Algorithms L18.1 Professor Ashok Subramanian L ECTURE 18 Shortest Paths II Bellman-Ford algorithm Linear programming and difference constraints VLSI layout compaction Algorithms
Background image of page 1

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

View Full DocumentRight Arrow Icon
Algorithms L18.2 Negative-weight cycles Recall: If a graph G = ( V , E ) contains a negative- weight cycle, then some shortest paths may not exist. Example: u v < 0
Background image of page 2
Algorithms L18.3 Negative-weight cycles Recall: If a graph G = ( V , E ) contains a negative- weight cycle, then some shortest paths may not exist. Example: u v < 0 Bellman-Ford algorithm: Finds all shortest-path lengths from a source s V to all v V or determines that a negative-weight cycle exists.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Algorithms L18.4 Bellman-Ford algorithm d [ s ] 0 for each v V – { s } do d [ v ] for i 1 to | V | – 1 do for each edge ( u , v ) E do if d [ v ] > d [ u ] + w ( u , v ) then d [ v ] d [ u ] + w ( u , v ) for each edge ( u , v ) E do if d [ v ] > d [ u ] + w ( u , v ) then report that a negative-weight cycle exists initialization At the end, d [ v ] = δ ( s , v ) , if no negative-weight cycles. Time = O ( V E ) . relaxation step
Background image of page 4
Algorithms L18.5 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3
Background image of page 5

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

View Full DocumentRight Arrow Icon
Algorithms L18.6 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 Initialization.
Background image of page 6
Algorithms L18.7 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 1 2 3 4 5 7 8 Order of edge relaxation. 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
Algorithms L18.8 Example of Bellman-Ford A B E C D –1 4 1 –3 5 3 0 2 4 5 7 8 6
Background image of page 8
Algorithms L18.9 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 1 2 3 4 5 7 8 6
Background image of page 9

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

View Full DocumentRight Arrow Icon
Algorithms L18.10 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 1 2 4 5 7 8 6
Background image of page 10
Algorithms L18.11 -1 Example of Bellman-Ford A B E C D 4 1 –3 2 5 3 0 1 2 3 4 5 8 6
Background image of page 11

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

View Full DocumentRight Arrow Icon
Algorithms L18.12 4 -1 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 1 2 3 4 7 8 6
Background image of page 12
Algorithms L18.13 4 -1 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 1 2 3 4 5 7 8 6
Background image of page 13

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

View Full DocumentRight Arrow Icon
Algorithms L18.14 4 2 -1 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 1 2 3 4 5 7 8 6
Background image of page 14
Algorithms L18.15 2 -1 Example of Bellman-Ford A B E C D –1 4 1 –3 2 5 3 0 1 2 3 4 5 7 6
Background image of page 15

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

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/29/2011 for the course IT 201 taught by Professor K.v.arya during the Spring '11 term at IIT Kanpur.

Page1 / 45

18-Shortest-Paths-II - Algorithms LECTURE 18 Shortest Paths...

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

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