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.

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

Next: <strong>The</strong> Friendship Graph Up: Techniques Previous: Implementation Challenges<br />

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

A graph G=(V,E) consists of a set of vertices V together with a set E of vertex pairs or edges. Graphs are<br />

important because they can be used to represent essentially any relationship. For example, graphs can<br />

model a network of roads, with cities as vertices and roads between cities as edges, as shown in Figure<br />

. Electronic circuits can also be modeled as graphs, with junctions as vertices and components as<br />

edges.<br />

Figure: Modeling road networks and electronic circuits as graphs<br />

<strong>The</strong> key to understanding many algorithmic problems is to think of them in terms of graphs. Graph<br />

theory provides a language for talking about the properties of graphs, and it is amazing how often messy<br />

applied problems have a simple description and solution in terms of classical graph properties.<br />

<strong>Design</strong>ing truly novel graph algorithms is a very difficult task. <strong>The</strong> key to using graph algorithms<br />

effectively in applications lies in correctly modeling your problem as a standard graph property, so you<br />

can take advantage of existing algorithms. Becoming familiar with many different graph algorithmic<br />

problems is more important than understanding the details of particular graph algorithms, particularly<br />

since Part II of this book can point you to an implementation as soon as you know the name of your<br />

problem.<br />

In this chapter, we will present basic data structures and traversal operations for graphs, which will<br />

enable you to cobble together solutions to rudimentary graph problems. We will also describe more<br />

sophisticated algorithms for problems like shortest paths and minimum spanning trees in some detail. But<br />

we stress the primary importance of correctly modeling your problem. Time spent browsing through the<br />

catalog now will leave you better informed of your options when a real job arises.<br />

file:///E|/BOOK/BOOK2/NODE59.HTM (1 of 3) [19/1/2003 1:27:44]

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

Saved successfully!

Ooh no, something went wrong!