Professional Documents
Culture Documents
NG
LESSER A.
TREES
LOC
MTH 610- GRAPH THEORY
NOT TREE TREE
A spanning tree
is a subset of
graph G which
has all the
vertices covered
with minimum
number of edges. G T
A spanning tree
does not have
cycles and cannot
be disconnected
G T
Theorem 9.3.4
A graph G has a spanning tree if and
only if G is connected.
1. Breadth-first search
b: (b, d)
c: (c, e) ``
g: none
Vertices on level 2
d: (d, f)
e: none
Vertices on level 3
f: (f, h)
MTH 610- GRAPH THEORY
FINDING SPANNING TREES
1. Breadth-first search
Breadth-first search can also be used to
find the minimum-length paths in an un-
weighted graph from a fixed vertex v to
all other vertices. Dijkstra’s shortest path
algorithm for weighted graphs can be
considered as a generalization of the
breadth-first search.
A complete
undirected graph
can have a maximum
of number of
spanning trees,
where n is the
number of nodes.
n− 2 3 −2
n =3 =3
MTH 610- GRAPH THEORY
COUNTING SPANNING TREES
G T 12 spanning
v=13 v=13 trees
e=14 e=12 r=2
3
2
2
-1
3 8
-1 3 16 − 8= 8
-1 -1
18 -1 -1 16
8 𝑆𝑝𝑎𝑛𝑛𝑖𝑛𝑔𝑇𝑟𝑒𝑒𝑠
MTH 610- GRAPH THEORY
Minimum Spanning Tree (MST)
In a weighted graph, a minimum spanning tree is a
spanning tree that has minimum weight than all other
spanning trees of the same graph. In real-world
situations, this weight can be measured as distance,
congestion, traffic load or any arbitrary value denoted
to the edges.
Two famous Algorithms for finding the Minimum
Spanning Tree
•Kruskal's Algorithm
•Prim's Algorithm
KRUSKAL’S ALGORITHM
Kruskal's algorithm to find the minimum
cost spanning tree uses the greedy
approach. This algorithm treats the graph
as a forest and every node it has as an
individual tree. A tree connects to another
only and only if, it has the least cost
among all available options and does not
violate MST properties.
EXAMPLE:
Step 1 − Remove all loops and Parallel
Edges
EXAMPLE:
Step 1 − Remove all loops and Parallel
Edges
EXAMPLE:Step 2 − Arrange all edges in their
increasing order of weight
EDGES WEIGHT
(B,D) 2
(D,T) 2
(A,C) 3
(C,D) 3
(C,B) 4
(B,T) 5
(A,B) 6
(S,A) 7
(S,C) 8
EXAMPLE:
Step 3 − Add the edge which has
the least weightage
EDGES WEIGHT
(B,D) 2
(D,T) 2
(A,C) 3
(C,D) 3
(C,B) 4
(B,T) 5
(A,B) 6
(S,A) 7
(S,C) 8
PRIM’S ALGORITHM
Prim's algorithm to find minimum
cost spanning tree (as Kruskal's
algorithm) uses the greedy approach.
Prim's algorithm shares a similarity
with the shortest path
first algorithms.
EXAMPLE:
Step 1 − Remove all loops and Parallel
Edges
EXAMPLE:
Step 1 − Remove all loops and Parallel
Edges
EXAMPLE:Step 2 - Choose any arbitrary
node as root node
EXAMPLE:Step 3 - Check outgoing edges
and select the one with less cost
References
Book:
Jonsonbaugh, R. (2009). Discrete Mathematics 7th Ed. New Jersey:
Pearson Education, Inc.
Online References
https://www.geeksforgeeks.org/total-number-spanning-trees-graph/
https://www.tutorialspoint.com/data_structures_algorithms/spannin
g_tree.htm
https://www.youtube.com/watch?v=dr8JOxrnBoY&t=305s
https://www.youtube.com/watch?v=dIKaP0Ozvhs&t=6s
https://www.youtube.com/watch?v=xFv_Hl4B83A