19-sssp - Algorithms Lecture 19: Shortest Paths [ Sp’10 ]...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Algorithms Lecture 19: Shortest Paths [ Sp’10 ] Well, ya turn left by the fire station in the village and take the old post road by the reservoir and...no, that won’t do. Best to continue straight on by the tar road until you reach the schoolhouse and then turn left on the road to Bennett’s Lake until...no, that won’t work either. East Millinocket, ya say? Come to think of it, you can’t get there from here. — Robert Bryan and Marshall Dodge, Bert and I and Other Stories from Down East (1961) Hey farmer! Where does this road go? Been livin’ here all my life, it ain’t gone nowhere yet. Hey farmer! How do you get to Little Rock? Listen stranger, you can’t get there from here. Hey farmer! You don’t know very much do you? No, but I ain’t lost. — Michelle Shocked, “Arkansas Traveler" (1992) 19 Shortest Paths 19.1 Introduction Suppose we are given a weighted directed graph G = ( V , E , w ) with two special vertices, and we want to find the shortest path from a source vertex s to a target vertex t . That is, we want to find the directed path p starting at s and ending at t that minimizes the function w ( p ) : = X u v ∈ p w ( u v ) . For example, if I want to answer the question ‘What’s the fastest way to drive from my old apartment in Champaign, Illinois to my wife’s old apartment in Columbus, Ohio?’, I might use a graph whose vertices are cities, edges are roads, weights are driving times, s is Champaign, and t is Columbus. 1 The graph is directed, because driving times along the same road might be different in different directions. 2 Perhaps counter to intuition, we will allow the weights on the edges to be negative. Negative edges make our lives complicated, because the presence of a negative cycle might imply that there is no shortest path. In general, a shortest path from s to t exists if and only if there is at least one path from s to t , but there is no path from s to t that touches a negative cycle. If there is a negative cycle between s and t , then we can always find a shorter path by going around the cycle one more time. s t 5 2-8 4 1 3 There is no shortest path from s to t . 1 West on Church, north on Prospect, east on I-74, south on I-465, east on Airport Expressway, north on I-65, east on I-70, north on Grandview, east on 5th, north on Olentangy River, east on Dodridge, north on High, west on Kelso, south on Neil. Depending on traffic. We both live in Urbana now. 2 At one time, there was a speed trap on I-70 just east of the Indiana / Ohio border, but only for eastbound traffic. c Copyright 2010 Jeff Erickson. Released under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )....
View Full Document

This note was uploaded on 10/14/2011 for the course ECON 101 taught by Professor Smith during the Spring '11 term at West Virginia University Institute of Technology.

Page1 / 11

19-sssp - Algorithms Lecture 19: Shortest Paths [ Sp’10 ]...

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

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