You are on page 1of 4

ECE 606, Algorithms

Addendum to Lecture 2

Mahesh Tripunitara

tripunit@uwaterloo.ca
ECE, University of Waterloo
2

Clarifications to the proof of Theorem B.2 (Properties of free trees)

(3) =⇒ (4)
The proof in the textbook (which is from CLRS) refers to Exercise B.4-3.
Here are two proofs for that claim. The claim is:

If G = hV, Ei is a connected undirected graph, then |E| ≥ |V | − 1.

Proof 1:
As G is connected, given any u, v ∈ V , there exists a path u v. If there
exists a path u v, then there exists a shortest path from u to v, i.e., a
path with the fewest number of edges amongst all paths u v.
Assume that V = {u0 , u1 , . . . , un−1 }. Now, write the vertices in V \ {u0 }
in order of non-decreasing shortest path lengths of paths from u0 to each of
u1 , . . . , un−1 . Without loss of generality, assume that this ordering is u0
u1 , u0 u2 , . . . , u0 un−1 . Now, we claim that the last edge in any shortest
path u0 ui in our list does not exist in any of the prior shortest paths
u0 u1 , u0 u2 , . . . , u 0 ui−1 . If the claim is indeed true, we can infer
immediately that there are at least |V | − 1 distinct edges in G.
We prove the claim by induction on i. For the base case, i.e., i = 1, because
u1 6= u0 , there in an edge in the path u0 u1 , and this edge is in no prior
path because there is no prior path. For the step, i.e., any i > 1, let the last
edge of a shortest path u0 ui be hx, ui i. For the purpose of contradiction,
assume that this edge hx, ui i appears in some prior shortest path in our list.
Then, the edge appears either as (i) hx, ui i, or, (ii) hui , xi. In case (i), it
cannot be the last edge in any prior shortest path u0 uj because uj 6= ui .
Thus, in either case, there exists a shorter path u0 ui , because the strict
sub-path u0 ui of the earlier path is strictly shorter that the path we have
in our list from u0 to ui . This is a contradiction to the assumption that the
u0 ui path in our list is indeed a shortest path from u0 to ui .

Proof 2 (credit: Armin Sadeghi, ECE, UWaterloo):


By induction on |V |. We consider non-empty graphs only, i.e., V 6= ∅. For
the base case |V | = 1, and the graph can have no edges, and in this case, it
is indeed true that |E| = 0 ≥ |V | − 1 = 0.
3

For the step, suppose the degree of a vertex u ∈ V , i.e., number of edges
incident on u, is written as d(u). As G is connected, if |V | > 1, we know that
for every u ∈ V, d(u) ≥ 1. We consider two cases. (i) There exists a vertex u
such that d(u) = 1, and, (ii) For every u ∈ V , d(u) > 1. In case (i), remove
u and the edge incident on it to yield a new graph G0 = hV 0 , E 0 i. G0 must
be connected because given any two vertices 6= u, call them v, v 0 , there must
exist a (simple) path v v 0 that does not traverse u — any paths that do
not start nor end at u and traverse u must be cyclic. Also, G0 falls under the
induction assumption because |V 0 | < |V |, and therefore |E 0 | ≥ |V 0 | − 1 =⇒
|E 0 | + 1 = |E| ≥ |V 0 | − 1 + 1 = |V | − 1.
In case (ii), we observe:
1X 1X X
|E| = d(u) ≥ 2= 1 = |V | > |V | − 1.
2 u∈V 2 u∈V u∈V

(5) =⇒ (6)
Following is my rewrite of the proof for (5) =⇒ (6).
(5): G is acyclic and |E| = |V | − 1.
(6): G is acyclic and if an edge is added to E, the resulting graph contains
a cycle.
Proof:
Let k, where 1 ≤ k ≤ |V |, be the number of connected components in G.
Then, if Vi ⊆ V is the ith connected component, the subgraph of G induced
by the vertices in Vi is acyclic; if it is not, then G is not acyclic. Also,
that subgraph induced by vertices in Vi must be a free tree, because it is
acyclic and every vertex in Vi has a path to every other vertex in Vi — that
latter part is exactly the definition of a connected component. Now, because
(1) =⇒ (5), and each connected component is a free tree, we know that the
number of edges in the ith connected component is |Vi | − 1.
|E|, the total number of edges in G, is the sum of the number of edges in each
connected component, i.e., |E| = |V1 | − 1 + |V2 | − 1 + . . . + |Vk | − 1 = |V | − k.
But part of the premise (5) is |E| = |V | − 1. So k = 1, i.e., the entire graph
G is a single connected component. This means that G is a free tree because
4

we inferred above that each of the k connected components of G, for any


k ≥ 1, is a free tree.
Now, because (1) =⇒ (2), every pair of vertices in G is connected by a
unique simple path. Suppose we add an edge hu, vi to G that did not exist
before. Suppose we denote the unique simple path in G from u to v as u v.
Then the hu, vi edge cannot be that path because the edge hu, vi does not
exist in G. So, once we add the edge hu, vi to G, u v → u is a cycle in G.

(6) =⇒ (1)
Following is my rewrite of the proof for (6) =⇒ (1).
(6): G is acyclic and if an edge is added to E, the resulting graph contains
a cycle.
(1): G is a free tree.
Proof:
We already know that G is acyclic because that is part of the premise (6).
So all we need to prove to prove that G is indeed a free tree is to prove that
G is connected, i.e., given any pair of vertices u, v, there exists a path u v
in G.
Pick any two such vertices u, v in G. We have two possibilities only. (i) The
edge hu, vi exists in G. In this case, we know that u and v are connected, i.e.,
reachable from one another. (ii) The edge hu, vi does not exist in G. Then,
by the premise (6), if we add the edge hu, vi to G, a cycle results. If the
cycle is c = hx0 , x1 , . . . , xk−1 , x0 i, then u and v must be adjacent vertices in
that cycle, i.e., u = xi for some i = 0, . . . , k − 1 and v = x(i+1) mod k , because
it is exactly the addition of the edge hu, vi that created the cycle. But this
means that there is path that connects u and v in G — it comprises every
edge in c except hu, vi. Thus, in this case as well, we have inferred that the
two vertices u, v are connected by a path between them.

You might also like