04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Graphs<br />

3<br />

Our focus in this book is on problems with a discrete flavor. Just as continuous<br />

mathematics is concerned with certain basic structures such as real numbers,<br />

vectors, and matrices, discrete mathematics has developed basic combinatorial<br />

structures that lie at the heart of the subiect. One of the most fundamental and<br />

expressive of these is the graph.<br />

The more one works with graphs, the more one tends to see them everywhere.<br />

Thus, we begin by introducing the basic definitions surrounding<br />

graphs, and list a spectrum of different algorithmic settings where graphs arise<br />

naturally. We then discuss some basic algorithmic primitives for graphs, beginning<br />

with the problem of connectivity and developing some fundamental<br />

graph search techniques.<br />

5.1 Basic Definitions and Applications<br />

Reca!l from Chapter 1 that a graph G is simply a way of encoding pairwise<br />

relationships among a set of objects: it consists of a collection V of nodes<br />

and a collection E of edges, each of which "joins" two of the nodes. We thus<br />

represent an edge e E E as a two-element subset of V: e = {u, v} for some<br />

u, v E V, where we cal! u and v the ends of e.<br />

Edges in a graph indicate a symmetric relationship between their ends.<br />

Often we want to encode asymmetric relationships, and for this we use the<br />

c!osely related notion of a directed graph. A directed graph G’ consists of a set<br />

of nodes V and a set of directed edges E’. Each e’ ~ E’ is an ordered pair (a, v);<br />

in other words, the roles of u and v are not interchangeable, and we call u the<br />

tail of the edge and v the head. We will also say that edge e’ leaves node u and<br />

enters node v.

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

Saved successfully!

Ooh no, something went wrong!