Vous êtes sur la page 1sur 28

BITS, PILANI K. K.

BIRLA GOA CAMPUS

Dr. Tarkeshwar Singh


Department of Mathematics

Topics to be covered

Trees
Equivalent Definitions
Some Results
Spanning Trees
Minimum Spanning Tree
Kruskals Algorithm

BITS, PILANI K. K. BIRLA GOA


CAMPUS

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.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

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.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

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.

A tree with minimum number of pendent vertices is path Pn.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

Equivalent Definitions
Theorem: Let G = (V, E) be a (p, q)-graph. The

following statements are equivalent:


G is a tree.
Every pair of vertices of G are joined by unique
path.
G is connected and q = p-1.
G is acyclic and q = p-1.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

Out line of Proof


1 implies 2: Since G is a connected graph, then there

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.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

Proof Contd.
2 implies 3:

From 2 it is clear that G is connected.


Now, we have to show that q = p -1.
We shall prove this by induction on number of vertices p.
Basis step: for p = 1 or 2, graph is trivial connected graph.
Now, we shall assume that, the result is true for the
connected graph with less than p vertices.
Assume G is graph with p vertices and let e = (u, v) is any
edge of G, then G - e is disconnected graph.(Why?)
Then there will be at least two components say G1 and G2.
Then by induction hypothesis we can prove that q = p - 1.
BITS, PILANI K. K. BIRLA GOA
CAMPUS

Proof Contd.
3 implies 4:

It is clear that G is connected and q = p 1, then we have


prove that G is acyclic.
So assume that G has a cycle of length n.
Now, fix a vertex on the cycle and consider any one of the
remaining p n vertices not lying on the cycle.
Consider the edges in the shortest path so we get q (p - n)
+ n = p. Which is a contradiction.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

10

Proof Contd.
4 implies 1:

Since G is a cyclic and q = p 1. Then we have to show


that G is tree.
So it is sufficient to prove that G is connected.
We shall prove this by contradiction.
Hence, we assume G is disconnected.
Then we shall get contradiction.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

11

Some Results on Trees


Theorem: The size of every connected
graph of order n is at least n-1.
Definition: The spanning subgraph of a
graph G, which is isomorphic to a tree is
called spanning tree of the graph G.
Theorem: Every connected graph contains
a spanning tree.
BITS, PILANI K. K. BIRLA GOA
CAMPUS

12

Minimum Spanning Trees


MST Problem: Suppose (G , w) is a connected
non trivial, weighted graph of order p and size q.
Where w is the weight function assigned to an edge
a positive real number. For each subgraph H we
define a weight of H by
w(H) = w(e), where e E(H).
We wish to minimize the w(H).
If H does not contain a cycle then the w(H) will be
always minimum.
BITS, PILANI K. K. BIRLA GOA
CAMPUS

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.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

17

Prims Algorithm(1957)

Input: A connected weighted graph G=(V,E, w).


Step-1:Initialization:
T .
Weight w(T) = 0.
S {u}
S* V- S.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

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

Other types of Trees


Rooted Tree: A tree is called a rooted tree if one of
its vertex is identified as a root.
Binary Tree: A tree is called binary if every vertex
has at most two predecessor vertices.
Complete Binary Tree: A binary tree is said to be
complete if every vertex has exactly two
predecessor vertices.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

21

Enumeration of Spanning Trees


A spanning tree in G is a subgraph of G that
includes all the vertices of G and is also a tree. The
edges of the trees are called branches.
We can find a spanning tree systematically by
using either of two methods.
Cutting down method
Building up Method

BITS, PILANI K. K. BIRLA GOA


CAMPUS

22

Cutting-down Method

Start choosing any cycle in G.


Remove one of cyclic edge.
Repeat this procedure until no cycles are
left.
BITS, PILANI K. K. BIRLA GOA
CAMPUS

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.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

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

BITS, PILANI K. K. BIRLA GOA


CAMPUS

25

Matrix Tree Theorem


We can calculate the number of labeled spanning
trees of a graph from the Laplacian matrix through
Matrix Tree Theorem
Theorem: Number of labelled spanning trees in
any connected graph is actually the cofactor of
any of the entry in the laplacian matrix.
The Laplacian matrix is also known as Kirchhoff
matrix.
BITS, PILANI K. K. BIRLA GOA
CAMPUS

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.

BITS, PILANI K. K. BIRLA GOA


CAMPUS

27

Thanks
BITS, PILANI K. K. BIRLA GOA CAMPUS

28

Vous aimerez peut-être aussi