06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

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.

“mcs” — 2017/3/3 — 11:21 — page 470 — #478<br />

470<br />

Chapter 12<br />

Simple Graphs<br />

Figure 12.16<br />

A 6-node <strong>for</strong>est consisting of 2 component trees.<br />

Corollary 12.8.8. Every connected graph with n vertices has at least n<br />

1 edges.<br />

A couple of points about the proof of Theorem 12.8.7 are worth noticing. First,<br />

we used induction on the number of edges in the graph. This is very common in<br />

proofs involving graphs, as is induction on the number of vertices. When you’re<br />

presented with a graph problem, these two approaches should be among the first<br />

you consider.<br />

The second point is more subtle. Notice that in the inductive step, we took an<br />

arbitrary .kC1/-edge graph, threw out an edge so that we could apply the induction<br />

assumption, and then put the edge back. You’ll see this shrink-down, grow-back<br />

process very often in the inductive steps of proofs related to graphs. This might<br />

seem like needless ef<strong>for</strong>t: why not start with an k-edge graph and add one more to<br />

get an .k C 1/-edge graph? That would work fine in this case, but opens the door<br />

to a nasty logical error called buildup error, illustrated in Problem 12.40.<br />

12.9 Forests & Trees<br />

We’ve already made good use of digraphs without cycles, but simple graphs without<br />

cycles are arguably the most important graphs in computer science.<br />

12.9.1 Leaves, Parents & Children<br />

Definition 12.9.1. An acyclic graph is called a <strong>for</strong>est. A connected acyclic graph<br />

is called a tree.<br />

The graph shown in Figure 12.16 is a <strong>for</strong>est. Each of its connected components<br />

is by definition a tree.<br />

One of the first things you will notice about trees is that they tend to have a lot<br />

of nodes with degree one. Such nodes are called leaves.<br />

Definition 12.9.2. A degree 1 node in a <strong>for</strong>est is called a leaf.<br />

The <strong>for</strong>est in Figure 12.16 has 4 leaves. The tree in Figure 12.17 has 5 leaves.

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

Saved successfully!

Ooh no, something went wrong!