Académique Documents
Professionnel Documents
Culture Documents
Topics to be covered
Trees
Equivalent Definitions
Some Results
Spanning Trees
Minimum Spanning Tree
Kruskals Algorithm
Trees
Definition: A graph G is said to be acyclic if it has no
cycles.
Definition: A connected acyclic graph G is called tree.
Bridge: An edge e = uv is said to a bridge if G - e is
disconnected.
Definition: An acyclic graph is called a forest in which
each component is a tree.
BITS, PILANI K. K. BIRLA GOA CAMPUS
Motivation
Kirchoff had developed theory of tress in 1847 in order to
solve the system of simultaneous linear equations which
gives the current in each branch and around each circuit of
an electrical network.
In 1857, the concept of tree was discovered by Aurther
Cayley in the very natural setting of organic chemistry, in
enumeration of isomers in CnH2n+2. He had used the
connected graph to represent CnH2n+2.
p = 3n+2 and q = (4n+2n+2)/2 = 3n+1.
Motivation contd.
The graph corresponding to CnH2n+2 molecule is an acyclic
graph. In this case, the problem of counting structural
isomers of the given hydrocarbon becomes the problem of
counting trees with certain qualifying properties of order p
and size q = p-1.
Trees Contd.
A connected graph is said to be a minimally connected graph
if removal of any edge from it disconnects the graph.
Remark:
A minimally connected graph does not have any cycle.
A tree is minimally connected graph
A tree with maximum number of pendent vertices is star K1,r.
Equivalent Definitions
Theorem: Let G = (V, E) be a (p, q)-graph. The
exists a (u , v)-path in G.
Suppose there are two paths P1, and P2 respectively, joining
u and v in G.
Then there will be some vertex ui not in P1 but in P2 and
some vertex uj in P1 but not in P2 where i < j. Then we shall
get a contradiction.
So there is a unique (u , v)-path in G.
Proof Contd.
2 implies 3:
Proof Contd.
3 implies 4:
10
Proof Contd.
4 implies 1:
11
12
13
MST Problem
So this problem is equivalent to find a spanning
tree with minimum weight.
It has many applications in computer Sciences,
Telecommunications, Transportation Networks,
Biology, etc.
Now we shall discuss two Algorithms namely,
KRUSKALS AND PRIMS which enable us to
find a minimum spanning tree from a weighted
graph G.
BITS, PILANI K. K. BIRLA GOA
CAMPUS
14
Kruskals Algorithm(1956)
Input: G = (V,E,w) is a connected weighted
graph with vertex set V = {1,2,,p}.
Step-1(Initialization):
T.
For i =1 to p do Vi = {i}. O(p)
Arrange edges in non decreasing order : w(e1)
w(e2) w(eq). O(q log q)(Heap Short).
(Break the ties arbitrarily)
BITS, PILANI K. K. BIRLA GOA
CAMPUS
15
Algorithm contd.
Step-2: For j = 1 to q,
do {* Find end vertices of ej =(u,v)(say).
* Find the components of u & v say Vk and Vl,
respectively (k < l).
* If Vk Vl, then
do { T T {ej}
V Vk Vl, Vl = }
* If Vk = Vl, then do nothing.
}
Output: A minimum spanning tree.
BITS, PILANI K. K. BIRLA GOA
CAMPUS
16
Algorithm contd.
Output: T is a minimum spanning tree with
weight = w(T).
Complexity: The complexity of this
algorithm is O(q log p) in the worst case.
Note: This is also a greedy algorithm.
17
Prims Algorithm(1957)
18
Algorithm contd.
Step-1: While S*
do {* Find an edge e of minimum weight in [S,
S*].
* Find the end vertices of e say e = (u,v),
where u S and v S*.
* T T {ej}
*S = S {v}
*S* = V-S.
BITS, PILANI K. K. BIRLA GOA
CAMPUS
19
Algorithm contd.
Weight = weight +w(e).
}
Output: T is a minimum spanning tree with
weight = w(T).
Complexity: The complexity of this
algorithm is O(q log p) in the worst case.
Note: This is also a greedy algorithm.
BITS, PILANI K. K. BIRLA GOA
CAMPUS
20
21
22
Cutting-down Method
23
Building-up Method
Select edges of G one at a time in such a
way that no cycles are created.
Repeat this procedure until all vertices are
included.
24
Laplacian Matrix
It is the difference of the Degree Diagonal Matrix
and the Adjacency matrix defined as L = l(i,j),
where the matrix entries are given as
25
26
Algorithm contd.
Complexity: Complexity of this algorithm is
O(q log p) in the worst case.
Theorem: The tree obtained by Kruskals
(Prims) Algorithm is a minimum spanning tree.
27
Thanks
BITS, PILANI K. K. BIRLA GOA CAMPUS
28