18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Shortest Paths<br />

Next: Dijkstra's <strong>Algorithm</strong> Up: Graph <strong>Algorithm</strong>s Previous: Kruskal's <strong>Algorithm</strong><br />

Shortest Paths<br />

Figure: <strong>The</strong> shortest path from to t can pass through many intermediate vertices.<br />

<strong>The</strong> shortest path between two vertices and t in an unweighted graph can be constructed using a breadthfirst<br />

search from . When we first encounter t in the search, we will have reached it from using the<br />

minimum number of possible edges. This minimum-link path is recorded in the breadth-first search tree,<br />

and it provides the shortest path when all edges have equal weight. However, in an arbitrary weighted<br />

graph, the weight of a path between two vertices is the sum of the weights of the edges along the path.<br />

<strong>The</strong> shortest path might use a large number of edges, just as the shortest route (timewise) from home to<br />

office may involve shortcuts using backroads and many turns, as shown in Figure .<br />

Shortest paths have a surprising variety of applications. See catalog Section and the war story of<br />

Section for further examples.<br />

● Dijkstra's <strong>Algorithm</strong><br />

● All-Pairs Shortest Path<br />

<strong>Algorithm</strong>s<br />

Mon Jun 2 23:33:50 EDT 1997<br />

file:///E|/BOOK/BOOK2/NODE76.HTM [19/1/2003 1:29:16]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!