[D3] The Roving Photographer (2 pts) [00OT]

Phoebe the Photographer is just leaving for work at the small-town newspaper where she works as a staff photographer, when she suddenly remembers that she was supposed to take a photograph to decorate page C17. She will just have to take a photograph on the way, but she is worried about getting to work late!

Phoebe's town can be represented by a directed, weighted graph with V vertices and E edges, where the weight on each edge represents the time needed to travel along that street in the given direction. (As usual, two-way streets are represented by one edge in each direction, possibly with different weights.) One particular vertex represents Pheobe's house, and another vertex represents her work. There are various locations (i.e. vertices) at which Pheobe could take a photograph; each such vertex has a number representing the amount of time Pheobe would need to spend taking a photograph there (some photographs can be taken quickly, while others need a while to set up).

Pheobe needs to travel to some location where she can take a photograph, pause long enough to take the photo, and then travel to her workplace. Explain how Pheobe could compute such a path which is as short as possible, and analyze the running time of your algorithm.

Context

Dijkstra's algorithm problems [00NS]