0% found this document useful (0 votes)
2 views

1comb Lecture6 Trees

A tree is a connected graph without cycles, and a spanning tree connects all vertices with minimum cost. The document discusses the properties and characterizations of trees, including theorems and lemmas that define their structure. It also introduces the Minimum Spanning Tree problem and Kruskal's algorithm for finding such trees in networks, highlighting its applications and efficiency.

Uploaded by

allrounderguno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

1comb Lecture6 Trees

A tree is a connected graph without cycles, and a spanning tree connects all vertices with minimum cost. The document discusses the properties and characterizations of trees, including theorems and lemmas that define their structure. It also introduces the Minimum Spanning Tree problem and Kruskal's algorithm for finding such trees in networks, highlighting its applications and efficiency.

Uploaded by

allrounderguno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

5.

Trees

A tree is a connected graph containing no cycles.


Tree is the simplest structure in graph, but it is very useful.

EX) Imagine that there is a network, and want to send a message to all people.
Suppose that sending a message costs 100 won.
How can we send a message with smallest cost?

We need to take a subgraph which is a connected.


But if we have a cycle, one edge is not useful,
as removing does not change its connectivity.

So, a solution would be a tree connecting all vertices with minimum cost.
(This is called a ‘spanning tree’)
We will study the several characterizations of trees.

[Theorem 5.1.2] Let G be a graph. The following are equivalent.

(1) G is a tree.
(2) (Unique path) For every two vertices x, y in G, there is a unique path from x to y.
(3) (Minimal connected) G is connected, and deleting any edge makes disconnected.
(4) (Maximal graph without cycle)
G contains no cycles, and any graph obtained by adding an edge contains a cycle.
(5) G is connected and | V(G) | = | E(G) | + 1.
We will use two lemmas. A vertex of degree 1 is called a leaf.

[Lemma 5.1.3] Every tree G with at least two vertices contains at least two leaves.

PF) Let P = v1v2⋯vm be a longest path in G.

We claim that v1 and vm are leaves.


Suppose that v1 has degree at least 2.
If it has a neighbor not in P, then we can find a longer path, a contradiction.

If it has a neighbor in V(P)∖{v1, v2}, then we get a cycle,


contradicting the assumption that G is a tree.

A similar argument holds for vm.


[Lemma 5.1.4] Let G be a graph and v be a leaf.
G is a tree if and only if G − v is a tree.

PF) (=>) Suppose G is a tree.


G − v has no cycles as G has no cycles.

Suppose G − v is not connected.


Then v must have a neighbor in each component of G − v.
So, v has degree at least 2, a contradiction.
[Lemma 5.1.4] Let G be a graph and v be a leaf.
G is a tree if and only if G − v is a tree.

PF) (<=) Suppose that G − v is a tree.


Clearly, G is connected, as v has a neighbor in V(G)∖{v}.

As v is a leaf, v cannot be in any cycle.


So, G has no cycles.
We will study the several characterizations of trees.

[Theorem 5.1.2] Let G be a graph. The following are equivalent.

(1) G is a tree.
(2) (Unique path) For every two vertices x, y in G, there is a unique path from x to y.
(3) (Minimal connected) G is connected, and deleting any edge makes disconnected.
(4) (Maximal graph without cycle)
G contains no cycles, and any graph obtained by adding an edge contains a cycle.
(5) G is connected and | V(G) | = | E(G) | + 1.

Will show (1)->(2)->(3)->(4)->(1)

(1)->(5)->(1)
(1) G is a tree.
(2) (Unique path) For every two vertices x, y in G, there is a unique path from x to y.
(1)->(2)

Let x, y be two vertices. Suppose there are two distinct paths P, Q from x to y.
Let P = a1a2⋯an and Q = b1b2⋯bm with a1 = b1 = x.

Let i be the minimum integer such that bi ∈ V(P) but bi+1 ∉ V(P).
Let j > i be the minimum integer such that bj ∈ V(P).
Such an integer exists as bm ∈ V(Q).

Then biPbj ∪ bibi+1…bj is a cycle, a contradiction.


(2) (Unique path) For every two vertices x, y in G, there is a unique path from x to y.
(3) (Minimal connected) G is connected, and deleting any edge makes disconnected.
(2)->(3)

It is clear that G is connected.

Assume there is uv ∈ E(G) such that G − uv is connected.


As G − uv is connected, there is a path P from u to v in G − uv.

Then uv and P are distinct paths from u to v in G.


(3) (Minimal connected) G is connected, and deleting any edge makes disconnected.
(4) (Maximal graph without cycle)
G contains no cycles, and any graph obtained by adding an edge contains a cycle.
(3)->(4)

Assume G has a cycle C. Let uv ∈ E(C).


Then removing uv cannot disconnect between u and v.
So, G − uv is connected, a contradiction.

As G is connected, adding an edge creates a cycle.


(1) G is a tree.
(4) (Maximal graph without cycle)
G contains no cycles, and any graph obtained by adding an edge contains a cycle.
(4)->(1)

Sufficient to show that G is connected.

Suppose G is disconnected, and let G1, G2 be two components.


Then adding an edge between G1 and G2 does not create a cycle,
as if there is a cycle it should contain this edge twice.
(1) G is a tree.
(5) G is connected and | V(G) | = | E(G) | + 1.
(1)->(5)

We prove by induction on | V(G) | .


If | V(G) | = 1, then it is clear. Assume | V(G) | ≥ 2.

By Lemma 5.1.3, G has a leaf v.


By Lemma 5.1.4, G − v is a tree.
By induction | V(G − v) | = | E(G − v) | + 1.

So, | V(G) | = | V(G − v) | + 1 = | E(G − v) | + 2 = | E(G) | + 1.


(1) G is a tree.
(5) G is connected and | V(G) | = | E(G) | + 1.
(5)->(1) We may assume | V(G) | ≥ 2.

Suppose G contains a leaf v.


Then G − v is connected and | V(G − v) | = | E(G − v) | + 1.
So, G − v is a tree, and by Lemma 5.1.4, G is a tree.

Thus, we may assume that every vertex has degree at least 2.


Then | E(G) | ≥ (2 | V(G) | )/2 = | V(G) | , a contradiction.
5.4 Minimum Spanning Tree problem

A spanning tree in a connected graph G is a subgraph on the vertex set V(G)


which is a tree.

A pair (G, w) of a graph and a weight function w : E(G) → ℝ is called a network.


We are interested in the following problem :

Given a network, we want to find a spanning tree where


the sum of all lengths of edges is minimum.

This problem has a lot of applications :

- want to connect to a system supplying electricity


(length represents the cost to build the connection)

- establishing traffic connections

- building a network for TV broadcasts ..


Let (G, w) be a network.


For A ⊆ E(G), w(A) = w(e) is called the weight of A.
e∈A
For a subgraph F of G, we denote by w(F) = w(E(F)).

A spanning tree T of G
is called a minimum spanning tree if its weight w(T) is minimum.
History :

Minimum spanning trees were first considered by Boruvka (1926).


Want to find a minimum network that supports electricity for a rural area.
He found an algorithm.

Often the solution is attributed to Kruskal (1956) and Prim (1957).

See [On the history of the minimum spanning tree problem, Graham, Hell 1985]
for more history.
Kruskal’s greedy algorithm:

Assume edges of G are ordered e1, e2, …, em so that


w(e1) ≤ w(e2) ≤ ⋯ ≤ w(em)

T←∅
for k = 1 to m
if ek does not form a cycle together with some edges of T,
then append ek to T

[Proposition 5.4.3] The algorithm correctly computes a minimum spanning tree.


It runs in time O( | E(G) | log | E(G) | ).
ordering : O( | E(G) | log | E(G) | )
test cycle : sufficient to look at endpoints are in the same component or not.
(need to store partitions)
(finding the set containing a vertex can be done in O(log | V(G) | ).)
PF) Let T be the spanning tree found by the algorithm, and
let T* be any other spanning tree of G.
We show that w(T) ≤ w(T*). This will prove the proposition

Let e′1, …, e′n−1 be the edges of T where w(e′1) ≤ w(e′2) ≤ ⋯ ≤ w(e′n−1).


Let e*
1
, …, e*
n−1
be the edges of T* where w(e*
1
) ≤ w(e*
2
) ≤ ⋯ ≤ w(e*
n−1
).

We claim that for each i, w(e′i ) ≤ w(e*


i
).






PF) We claim that for each i, w(e′i ) ≤ w(e*
i
).
Suppose that this is not true.
Let i be the smallest index for which it is violated, that is, w(e′i ) > w(e*
i
).

We consider E′ = {e′1, …, e′i−1} and E* = {e*


1
, …, e* ,
i−1 i
e* } .
The graphs (V, E′) and (V, E*) are forests.

We claim that there exists an edge e ∈ E*∖E′ such that (V, E′ ∪ {e}) is still a forest.

Then w(e) ≤ w(e*


i
) < w(e′
i ), contradicting the choice of e′
i .










PF) We consider E′ = {e′1, …, e′i−1} and E* = {e*
1
, …, e* ,
i−1 i
e* } .
The graphs (V, E′) and (V, E*) are forests.

We claim that there exists an edge e ∈ E*∖E′ such that (V, E′ ∪ {e}) is still a forest.

subproof) This is done by a simple counting argument.


For each component C of (V, E′), a tree on C has exactly | V(C) | − 1 edges.
So, (V, E′) has edges exactly as the sum of | V(C) | − 1 over all components C.

If (V, E*) has no edges between two components of (V, E′),


(V, E*) has at most edges of (V, E′), a contradiction.










What is a running time?

For analyzing ‘quality’ of an algorithm


we usually measure ‘necessary (worst) time’ and ‘necessary space’ of the algorithm.

They are called ‘running time / time complexity’ and ‘space complexity’.

The running time of this algorithm is O( | E(G) | log | E(G) | )


for ordering edges with respect to weights.

To test whether a new edge makes a cycle,


it is sufficient to test whether endpoints are in the same component or not.

So, we need to store partitions for components.


Finding the set containing a specified vertex can be done in O(log | V(G) | ) time.
(using some efficient data structure)

You might also like