23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

13.5 Weighted Graphs<br />

As we saw <strong>in</strong> Section 13.3.3, the breadth-first search strategy can be used to f<strong>in</strong>d a<br />

shortest path from some start<strong>in</strong>g vertex to every other vertex <strong>in</strong> a connected graph.<br />

This approach makes sense <strong>in</strong> cases where each edge is as good as any other, but<br />

there are many situations where this approach is not appropriate. For example, we<br />

might be us<strong>in</strong>g a graph to represent a computer network (such as the Internet), <strong>and</strong> we<br />

might be <strong>in</strong>terested <strong>in</strong> f<strong>in</strong>d<strong>in</strong>g the fastest way to route a data packet between two<br />

840

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

Saved successfully!

Ooh no, something went wrong!