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.

In the propositions that follow, we explore a few important properties of graphs.<br />

Proposition 13.6: If G is a graph with m edges, then<br />

Justification: An edge (u,v) is counted twice <strong>in</strong> the summation above; once by<br />

its endpo<strong>in</strong>t u <strong>and</strong> once by its endpo<strong>in</strong>t v. Thus, the total contribution of the edges to<br />

the degrees of the vertices is twice the number of edges.<br />

Proposition 13.7: If G is a directed graph with m edges, then<br />

Justification: In a directed graph, an edge (u,v) contributes one unit to the outdegree<br />

of its orig<strong>in</strong> u <strong>and</strong> one unit to the <strong>in</strong>-degree of its dest<strong>in</strong>ation v. Thus, the total<br />

contribution of the edges to the out-degrees of the vertices is equal to the number of<br />

edges, <strong>and</strong> similarly for the out-degrees.<br />

We next show that a simple graph with n vertices has O(n 2 ) edges.<br />

Proposition 13.8: Let G be a simple graph with n vertices <strong>and</strong> m edges. If G<br />

is undirected, then m ≤ n(n − 1)/2, <strong>and</strong> if G is directed, then m ≤ n(n − 1).<br />

795

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

Saved successfully!

Ooh no, something went wrong!