SlideShare a Scribd company logo
TOPIC:- Minimum Spanning Tree




 1
PROBLEM: LAYING TELEPHONE WIRE




                    Central office




2
WIRING: NAÏVE APPROACH




                    Central office




                 Expensive!

3
WIRING: BETTER APPROACH




                               Central office




    Minimize the total length of wire connecting the customers

4
Minimum Spanning Trees




5
We are interested in:

Finding a tree T that contains all the
vertices of a graph G       spanning tree
and has the least total weight over all
such trees          minimum-spanning
tree
                                       (MST)
           w(T )           w((v, u))
                   ( v ,u ) T

6
Before discuss about MST (minimum
    spanning tree) lets get familiar with Graphs.




7
• A graph is a finite set of nodes with edges
      between nodes.
    • Formally, a graph G is a structure (V,E) 1             2

      consisting of
      – a finite set V called the set of nodes, and      3   4
      – a set E that is a subset of VxV. That is, E is a
        set of pairs of the form (x,y) where x and y are
        nodes in V




8
Directed vs. Undirected Graphs

    • If the directions of the edges matter, then we
      show the edge directions, and the graph is
      called a directed graph (or a digraph)

    • If the relationships represented by the edges
      are symmetric (such as (x,y) is edge if and
      only if x is a sibling of y), then we don’t show
      the directions of the edges, and the graph is
      called an undirected graph.



9
SPANNING TREES


     Suppose you have a connected undirected
       graph
     Connected: every node is reachable from every
      other node
     Undirected: edges do not have an associated
      direction
     ...then a spanning tree of the graph is a
         connected subgraph in which there are no
         cycles
       A connected,   Four of the spanning trees of the graph
        undirected
          graph
10
Minimum Spanning Tree (MST)
     A minimum spanning tree is a subgraph of an
     undirected weighted graph G, such that

     • it is a tree (i.e., it is acyclic)
     • it covers all the vertices V
         – contains |V| - 1 edges
     • the total cost associated with tree edges is the
       minimum among all possible spanning trees
     • not necessarily unique




11
APPLICATIONS OF MST

Cancer imaging. The BC Cancer Research Ctr. uses minimum
spanning trees to describe the arrangements of nuclei in skin
cells.
•Cosmology at the University of Kentucky. This group works on
large-scale structure formation, using methods including N-body
simulations and minimum spanning trees.
•Detecting actin fibers in cell images. A. E. Johnson and R. E.
Valdes-Perez use minimum spanning trees for biomedical
image analysis.
•The Euclidean minimum spanning tree mixing model. S.
Subramaniam and S. B. Pope use geometric minimum
spanning trees to model locality of particle interactions in
turbulent fluid flows. The tree structure of the MST permits a
linear-time solution of the resulting particle-interaction matrix.
12
•Extracting features from remotely sensed images. Mark Dobie
and co-workers use minimum spanning trees to find road
networks in satellite and aerial imagery.
•Finding quasar superstructures. M. Graham and co-authors use
2d and 3d minimum spanning trees for finding clusters of
quasars and Seyfert galaxies.

•Learning salient features for real-time face verification, K. Jonsson,
J. Matas, and J. Kittler. Includes a minimum-spanning-tree based
algorithm for registering the images in a database of faces.
•Minimal spanning tree analysis of fungal spore spatial patterns, C.
L. Jones, G. T. Lonergan, and D. E. Mainwaring.


13
•A minimal spanning tree analysis of the CfA redshift survey. Dan
Lauer uses minimum spanning trees to understand the large-
scale structure of the universe.

•A mixing model for turbulent reactive flows based on Euclidean
minimum spanning trees, S. Subramaniam and S. B. Pope.

•Sausages, proteins, and rho. In the talk announced here, J.
MacGregor Smith discusses Euclidean Steiner tree theory and
describes potential applications of Steiner trees to protein
conformation and molecular modeling.

•Weather data interpretation. The Insight group at Ohio State is
using geometric techniques such as minimum spanning trees to
extract features from large meteorological data sets
14
What is a Minimum-Cost Spanning Tree

 For an edge-weighted , connected, undirected graph, G, the total
  cost of G is the sum of the weights on all its edges.
 A minimum-cost spanning tree for G is a minimum spanning tree of G
  that has the least total cost.
 Example: The graph
 Has 16 spanning trees. Some are:




 The graph has two minimum-cost spanning trees, each with a cost of 6:
HOW CAN WE
     GENERATE A MST?


16
We have two Ways
     to generate a MST



17
Prim’s Algorithm


Prim’s algorithm finds a minimum cost spanning tree by
selecting edges from the graph one-by-one as follows:
 It starts with a tree, T, consisting of the starting vertex,
  x.
 Then, it adds the shortest edge emanating from x that
  connects T to the rest of the graph.
 It then moves to the added vertex and repeats the
  process.
Prim’s Algorithm
 The edges in set A always form a single tree

 Starts from an arbitrary “root”: VA = {a}

 At each step:
                                                                   8           7
                                                           b               c       d
      Find a light edge crossing (VA, V - VA)        4                                     9
                                                                       2
      Add this edge to A                         a       11       i                   14        e
                                                                               4
      Repeat until the tree spans all vertices                7       6
                                                      8                                     10
                                                           h               g   2
                                                                                   f
                                                                   1




19
Example
                              8                   7
                  b                       c               d                          0
         4                                                             9
                                      2                                         Q = {a, b, c, d, e, f, g, h, i}
     a           11           i                               14            e
                                                  4                             VA =
                          7           6
         8                                                             10       Extract-MIN(Q)        a
                  h                       g       2
                                                          f
                              1


                      4
                                  8                   7                         key [b] = 4       [b] = a
                      b                       c               d
         4                                                              9       key [h] = 8       [h] = a
                                      2
     a           11               i               4               14        e
                          7               6
             8                                                         10            4                8
                      h                       g       2
                                                              f                 Q = {b, c, d, e, f, g, h, i} VA = {a}
                                  1
                      8                                                         Extract-MIN(Q)        b
20
Example
          4                        8                                 key [c] = 8       [c] = b
                       8               7
          b                        c           d                     key [h] = 8       [h] = a - unchanged
     4                                                      9
                               2
                                                                          8             8
a        11            i               4           14            e
                  7            6                                     Q = {c, d, e, f, g, h, i} VA = {a, b}
     8                                                      10
          h                        g           f                     Extract-MIN(Q)        c
                       1               2
          8
                                                                     key [d] = 7       [d] = c
              4                    8           7
                           8               7                         key [f] = 4       [f] = c
              b                    c           d
     4                 2 2                                  9        key [i] = 2        [i] = c
 a       11            i               4               14        e
                   7           6
     8                                                      10           7    4      8 2
               h                   g       2
                                                   f                 Q = {d, e, f, g, h, i} VA = {a, b, c}
                           1
              8                                4
21                                                                   Extract-MIN(Q)        i
Example
          4                   8       7                  key [h] = 7       [h] = i
                      8           7
              b               c       d                  key [g] = 6       [g] = i
     4                                         9
                      2   2                                   7     46 8
 a       11           i           4       14        e
                                                         Q = {d, e, f, g, h} VA = {a, b, c, i}
                  7       6
     8                                         10
                                                         Extract-MIN(Q)        f
          h                   g   2
                                      f
                      1
          8                   6       4
          7
          4                   8       7                   key [g] = 2      [g] = f
                      8           7
          b                   c       d                   key [d] = 7      [d] = c unchanged
     4                                         9
                      2 2                           10    key [e] = 10     [e] = f
 a       11           i                   14        e
                                  4                            7 10 2 8
                  7       6
     8                                         10         Q = {d, e, g, h} VA = {a, b, c, i, f}
          h                   g   2
                                      f
                      1
                              6       4
                                                          Extract-MIN(Q)       g
22        7                   2
Example
          4                   8           7                  key [h] = 1     [h] = g
                      8               7
              b               c           d                       7 10 1
     4                                             9
                      2 2                               10   Q = {d, e, h} VA = {a, b, c, i, f, g}
 a       11           i           4           14        e
                  7       6
                                                             Extract-MIN(Q)      h
     8                                             10
              h               g       2
                                          f
                      1
          7
          1                   2           4                        7 10
          4                   8           7
                      8           7
                                                              Q = {d, e} VA = {a, b, c, i, f, g, h}
          b                   c           d
     4                                             9          Extract-MIN(Q)      d
                      2 2                               10
 a       11           i           4           14        e
                  7       6
     8                                             10
          h                   g   2
                                          f
                      1
23        1                   2           4
Example


          4               8       7
                  8           7
          b               c       d                 key [e] = 9      [e] = f
     4                                     9 9
                  2 2                        10
                                                         9
a        11       i           4       14        e
              7       6                             Q = {e} VA = {a, b, c, i, f, g, h, d}
     8                                     10
          h               g       f                 Extract-MIN(Q)       e
                  1           2
          1               2       4                 Q=      VA = {a, b, c, i, f, g, h, d, e}




24
Prim’s (V, E, w, r)
1.     Q←
                                       Total time: O(VlgV + ElgV) = O(ElgV)
2.     for each u   V
3.        do key[u] ← ∞            O(V) if Q is implemented
                                   as a min-heap
4.           π[u] ← NIL
5.           INSERT(Q, u)
                                                                 O(lgV)
6.     DECREASE-KEY(Q, r, 0)              key[r] ← 0
                                                                 Min-heap
7.     while Q                              Executed |V| times
                                                                 operations:
8.           do u ← EXTRACT-MIN(Q)            Takes O(lgV)       O(VlgV)
                                                Executed O(E) times total
9.               for each v   Adj[u]
                                                           Constant         O(ElgV)
10.                 do if v   Q and w(u, v) < key[v]
                                                           Takes O(lgV)
11.                       then π[v] ← u
12.                            DECREASE-KEY(Q, v, w(u, v))
25
Algorithm
  How is it different from Prim’s algorithm?
      Prim’s algorithm grows one
       tree all the time
      Kruskal’s algorithm grows                tree1
       multiple trees (i.e., a forest)
       at the same time.
      Trees are merged together        u

        using safe edges
      Since an MST has exactly |V| - 1     v
       edges, after |V| - 1 merges,               tree2

       we would have only one component
26
Kruskal’s Algorithm
                                                            8           7
  Start with each vertex being its                 b               c       d
                                               4                                     9
     own component                                              2
                                           a       11       i           4       14        e
  Repeatedly merge two                                         6
                                                        7
                                               8                                     10
     components into one by
                                                    h               g   2
                                                                            f
                                                            1
     choosing the light edge that
                                                                    We would add
     connects them
                                                                    edge (c, f)
  Which components to consider
     at each iteration?
      Scan the set of edges in
       monotonically increasing order by
       weight

27
Example
                                                      1.    Add (h, g)     {g, h}, {a}, {b}, {c}, {d}, {e}, {f}, {i}
                      8           7
              b               c       d               2.    Add (c, i)     {g, h}, {c, i}, {a}, {b}, {d}, {e}, {f}
         4                                     9      3.    Add (g, f)
                          2                                                {g, h, f}, {c, i}, {a}, {b}, {d}, {e}
     a       11       i           4       14        e 4.    Add (a, b)     {g, h, f}, {c, i}, {a, b}, {d}, {e}

         8
                  7       6                           5.    Add (c, f)     {g, h, f, c, i}, {a, b}, {d}, {e}
                                               10
              h               g       f               6.    Ignore (i, g) {g, h, f, c, i}, {a, b}, {d}, {e}
                      1           2
                                                      7.    Add (c, d)     {g, h, f, c, i, d}, {a, b}, {e}
 1: (h, g)                8: (a, h), (b, c)           8.    Ignore (i, h) {g, h, f, c, i, d}, {a, b}, {e}
 2: (c, i), (g, f)        9: (d, e)                   9.    Add (a, h)
                                                                           {g, h, f, c, i, d, a, b}, {e}
 4: (a, b), (c, f)        10: (e, f)                  10.    Ignore (b, c)
                                                                           {g, h, f, c, i, d, a, b}, {e}
                                                      11.    Add (d, e)
 6: (i, g)                11: (b, h)                                       {g, h, f, c, i, d, a, b, e}
                                                      12.    Ignore (e, f)
 7: (c, d), (i, h)        14: (d, f)                                       {g, h, f, c, i, d, a, b, e}
                                                      13.   Ignore (b, h)
                                                                           {g, h, f, c, i, d, a, b, e}
{a}, {b}, {c}, {d}, {e}, {f}, {g}, {h}, {i}           14.   Ignore (d, f)
                                                                               {g, h, f, c, i, d, a, b, e}
28
Thank You

      Bibliography-
      http://www.cs.brown.edu/
      en.wikipedia.org/wiki/




29

More Related Content

What's hot (20)

PPT
Breadth first search and depth first search
Hossain Md Shakhawat
 
PPTX
Bellman ford algorithm
MdSajjadulislamBappi
 
PPT
minimum spanning trees Algorithm
sachin varun
 
PPTX
Bellman ford Algorithm
taimurkhan803
 
PPTX
Dijkstra
jagdeeparora86
 
PPTX
Dijkstra's algorithm
gsp1294
 
PPTX
Minimum spanning tree
STEFFY D
 
PPTX
Prims and kruskal algorithms
Saga Valsalan
 
PPTX
Dijkstra’S Algorithm
ami_01
 
PPTX
DFS and BFS
satya parsana
 
PPT
Minimum spanning tree
Hinal Lunagariya
 
PPTX
Spanning trees & applications
Tech_MX
 
PPT
Dijkstra.ppt
Ruchika Sinha
 
PDF
Dijkstra's Algorithm
ArijitDhali
 
PPT
Spanning trees
Shareb Ismaeel
 
PPTX
Kruskal’s algorithm
Abdul Moiz Lakhani
 
PPTX
Stressen's matrix multiplication
Kumar
 
PPT
5.1 greedy
Krish_ver2
 
PDF
Shortest Path in Graph
Dr Sandeep Kumar Poonia
 
Breadth first search and depth first search
Hossain Md Shakhawat
 
Bellman ford algorithm
MdSajjadulislamBappi
 
minimum spanning trees Algorithm
sachin varun
 
Bellman ford Algorithm
taimurkhan803
 
Dijkstra
jagdeeparora86
 
Dijkstra's algorithm
gsp1294
 
Minimum spanning tree
STEFFY D
 
Prims and kruskal algorithms
Saga Valsalan
 
Dijkstra’S Algorithm
ami_01
 
DFS and BFS
satya parsana
 
Minimum spanning tree
Hinal Lunagariya
 
Spanning trees & applications
Tech_MX
 
Dijkstra.ppt
Ruchika Sinha
 
Dijkstra's Algorithm
ArijitDhali
 
Spanning trees
Shareb Ismaeel
 
Kruskal’s algorithm
Abdul Moiz Lakhani
 
Stressen's matrix multiplication
Kumar
 
5.1 greedy
Krish_ver2
 
Shortest Path in Graph
Dr Sandeep Kumar Poonia
 

Viewers also liked (20)

PPTX
Kruskal Algorithm
Snehasis Panigrahi
 
PPT
Minimum spanning tree
Tanmay Baranwal
 
PPT
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
Sahil Kumar
 
PPT
Graphs In Data Structure
Anuj Modi
 
PDF
BigDansing presentation slides for SIGMOD 2015
Zuhair khayyat
 
PPTX
Graph data structure
Tech_MX
 
PDF
BigDansing presentation slides for KAUST
Zuhair khayyat
 
PDF
Social network analysis of CMAD2013 Twitter data
Jari Jussila
 
PDF
x1 t10 04 maximum & minimum problems (13)
Nigel Simmons
 
PPTX
Linkers
Rahul Dhiman
 
PDF
Alg1 8.2 Substitution Method
Jaqueline Vallejo
 
PDF
Greedy minimum spanning tree- prim's algorithm
Department of Information Management Ming Chuan University, Taiwan
 
PPT
Linkers
Koganti Ravikumar
 
PPTX
Lecture 6-cs648 Randomized Algorithms
Anshul Yadav
 
PPT
Avl trees
Mohd Arif
 
PPTX
AVL Tree
Chhatra Thapa
 
PDF
Skiena algorithm 2007 lecture10 graph data strctures
zukun
 
PDF
Prims Algorithm
Sriram Raj
 
PDF
01 Analysis of Algorithms: Introduction
Andres Mendez-Vazquez
 
Kruskal Algorithm
Snehasis Panigrahi
 
Minimum spanning tree
Tanmay Baranwal
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
Sahil Kumar
 
Graphs In Data Structure
Anuj Modi
 
BigDansing presentation slides for SIGMOD 2015
Zuhair khayyat
 
Graph data structure
Tech_MX
 
BigDansing presentation slides for KAUST
Zuhair khayyat
 
Social network analysis of CMAD2013 Twitter data
Jari Jussila
 
x1 t10 04 maximum & minimum problems (13)
Nigel Simmons
 
Linkers
Rahul Dhiman
 
Alg1 8.2 Substitution Method
Jaqueline Vallejo
 
Greedy minimum spanning tree- prim's algorithm
Department of Information Management Ming Chuan University, Taiwan
 
Lecture 6-cs648 Randomized Algorithms
Anshul Yadav
 
Avl trees
Mohd Arif
 
AVL Tree
Chhatra Thapa
 
Skiena algorithm 2007 lecture10 graph data strctures
zukun
 
Prims Algorithm
Sriram Raj
 
01 Analysis of Algorithms: Introduction
Andres Mendez-Vazquez
 
Ad

Similar to Minimum spanning Tree (20)

DOC
Math final 2012 form2 paper1
nurul abdrahman
 
PPT
Unit 5 session 2 MinimumSpanningTrees.ppt
prithivr1
 
PPT
Surface Area
cadteach
 
PPTX
Algorithm analysis Greedy method in algorithm.pptx
fekadeab34
 
DOC
Question bank
chandrashekardk
 
PPTX
Vertex cover problem
Ginusaju
 
PPTX
Metode Kuantitatif MMSI Gunadarma Yudhy Tri Suharno
Yudhy Tri Suharno
 
PPTX
Ppt of graph theory
ArvindBorge
 
PPT
algorthm analysis from computer scince.ppt
AbrehamHgiorgis
 
PDF
Unit 5 Bingo Answe
Mrs. Hedrick's Class
 
PPT
Graphs
Saurabh Mishra
 
PDF
Approximation Algorithms
Nicolas Bettenburg
 
PDF
Cs6702 graph theory and applications Anna University question paper apr may 2...
appasami
 
PDF
Gwt sdm public
Yasuo Tabei
 
PPT
Network Information Processing
Reza Rahimi
 
PDF
Unit 5 bingo practice test
Mrs. Hedrick's Class
 
PDF
Algorithm chapter 9
chidabdu
 
PDF
Daa q.paper
swapnil shinde
 
Math final 2012 form2 paper1
nurul abdrahman
 
Unit 5 session 2 MinimumSpanningTrees.ppt
prithivr1
 
Surface Area
cadteach
 
Algorithm analysis Greedy method in algorithm.pptx
fekadeab34
 
Question bank
chandrashekardk
 
Vertex cover problem
Ginusaju
 
Metode Kuantitatif MMSI Gunadarma Yudhy Tri Suharno
Yudhy Tri Suharno
 
Ppt of graph theory
ArvindBorge
 
algorthm analysis from computer scince.ppt
AbrehamHgiorgis
 
Unit 5 Bingo Answe
Mrs. Hedrick's Class
 
Approximation Algorithms
Nicolas Bettenburg
 
Cs6702 graph theory and applications Anna University question paper apr may 2...
appasami
 
Gwt sdm public
Yasuo Tabei
 
Network Information Processing
Reza Rahimi
 
Unit 5 bingo practice test
Mrs. Hedrick's Class
 
Algorithm chapter 9
chidabdu
 
Daa q.paper
swapnil shinde
 
Ad

Recently uploaded (20)

PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PDF
My Thoughts On Q&A- A Novel By Vikas Swarup
Niharika
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PDF
John Keats introduction and list of his important works
vatsalacpr
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PDF
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
My Thoughts On Q&A- A Novel By Vikas Swarup
Niharika
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
John Keats introduction and list of his important works
vatsalacpr
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 

Minimum spanning Tree

  • 2. PROBLEM: LAYING TELEPHONE WIRE Central office 2
  • 3. WIRING: NAÏVE APPROACH Central office Expensive! 3
  • 4. WIRING: BETTER APPROACH Central office Minimize the total length of wire connecting the customers 4
  • 6. We are interested in: Finding a tree T that contains all the vertices of a graph G spanning tree and has the least total weight over all such trees minimum-spanning tree (MST) w(T ) w((v, u)) ( v ,u ) T 6
  • 7. Before discuss about MST (minimum spanning tree) lets get familiar with Graphs. 7
  • 8. • A graph is a finite set of nodes with edges between nodes. • Formally, a graph G is a structure (V,E) 1 2 consisting of – a finite set V called the set of nodes, and 3 4 – a set E that is a subset of VxV. That is, E is a set of pairs of the form (x,y) where x and y are nodes in V 8
  • 9. Directed vs. Undirected Graphs • If the directions of the edges matter, then we show the edge directions, and the graph is called a directed graph (or a digraph) • If the relationships represented by the edges are symmetric (such as (x,y) is edge if and only if x is a sibling of y), then we don’t show the directions of the edges, and the graph is called an undirected graph. 9
  • 10. SPANNING TREES Suppose you have a connected undirected graph Connected: every node is reachable from every other node Undirected: edges do not have an associated direction ...then a spanning tree of the graph is a connected subgraph in which there are no cycles A connected, Four of the spanning trees of the graph undirected graph 10
  • 11. Minimum Spanning Tree (MST) A minimum spanning tree is a subgraph of an undirected weighted graph G, such that • it is a tree (i.e., it is acyclic) • it covers all the vertices V – contains |V| - 1 edges • the total cost associated with tree edges is the minimum among all possible spanning trees • not necessarily unique 11
  • 12. APPLICATIONS OF MST Cancer imaging. The BC Cancer Research Ctr. uses minimum spanning trees to describe the arrangements of nuclei in skin cells. •Cosmology at the University of Kentucky. This group works on large-scale structure formation, using methods including N-body simulations and minimum spanning trees. •Detecting actin fibers in cell images. A. E. Johnson and R. E. Valdes-Perez use minimum spanning trees for biomedical image analysis. •The Euclidean minimum spanning tree mixing model. S. Subramaniam and S. B. Pope use geometric minimum spanning trees to model locality of particle interactions in turbulent fluid flows. The tree structure of the MST permits a linear-time solution of the resulting particle-interaction matrix. 12
  • 13. •Extracting features from remotely sensed images. Mark Dobie and co-workers use minimum spanning trees to find road networks in satellite and aerial imagery. •Finding quasar superstructures. M. Graham and co-authors use 2d and 3d minimum spanning trees for finding clusters of quasars and Seyfert galaxies. •Learning salient features for real-time face verification, K. Jonsson, J. Matas, and J. Kittler. Includes a minimum-spanning-tree based algorithm for registering the images in a database of faces. •Minimal spanning tree analysis of fungal spore spatial patterns, C. L. Jones, G. T. Lonergan, and D. E. Mainwaring. 13
  • 14. •A minimal spanning tree analysis of the CfA redshift survey. Dan Lauer uses minimum spanning trees to understand the large- scale structure of the universe. •A mixing model for turbulent reactive flows based on Euclidean minimum spanning trees, S. Subramaniam and S. B. Pope. •Sausages, proteins, and rho. In the talk announced here, J. MacGregor Smith discusses Euclidean Steiner tree theory and describes potential applications of Steiner trees to protein conformation and molecular modeling. •Weather data interpretation. The Insight group at Ohio State is using geometric techniques such as minimum spanning trees to extract features from large meteorological data sets 14
  • 15. What is a Minimum-Cost Spanning Tree  For an edge-weighted , connected, undirected graph, G, the total cost of G is the sum of the weights on all its edges.  A minimum-cost spanning tree for G is a minimum spanning tree of G that has the least total cost.  Example: The graph Has 16 spanning trees. Some are: The graph has two minimum-cost spanning trees, each with a cost of 6:
  • 16. HOW CAN WE GENERATE A MST? 16
  • 17. We have two Ways to generate a MST 17
  • 18. Prim’s Algorithm Prim’s algorithm finds a minimum cost spanning tree by selecting edges from the graph one-by-one as follows:  It starts with a tree, T, consisting of the starting vertex, x.  Then, it adds the shortest edge emanating from x that connects T to the rest of the graph.  It then moves to the added vertex and repeats the process.
  • 19. Prim’s Algorithm  The edges in set A always form a single tree  Starts from an arbitrary “root”: VA = {a}  At each step: 8 7 b c d  Find a light edge crossing (VA, V - VA) 4 9 2  Add this edge to A a 11 i 14 e 4  Repeat until the tree spans all vertices 7 6 8 10 h g 2 f 1 19
  • 20. Example 8 7 b c d 0 4 9 2 Q = {a, b, c, d, e, f, g, h, i} a 11 i 14 e 4 VA = 7 6 8 10 Extract-MIN(Q) a h g 2 f 1 4 8 7 key [b] = 4 [b] = a b c d 4 9 key [h] = 8 [h] = a 2 a 11 i 4 14 e 7 6 8 10 4 8 h g 2 f Q = {b, c, d, e, f, g, h, i} VA = {a} 1 8 Extract-MIN(Q) b 20
  • 21. Example 4 8 key [c] = 8 [c] = b 8 7 b c d key [h] = 8 [h] = a - unchanged 4 9 2 8 8 a 11 i 4 14 e 7 6 Q = {c, d, e, f, g, h, i} VA = {a, b} 8 10 h g f Extract-MIN(Q) c 1 2 8 key [d] = 7 [d] = c 4 8 7 8 7 key [f] = 4 [f] = c b c d 4 2 2 9 key [i] = 2 [i] = c a 11 i 4 14 e 7 6 8 10 7 4 8 2 h g 2 f Q = {d, e, f, g, h, i} VA = {a, b, c} 1 8 4 21 Extract-MIN(Q) i
  • 22. Example 4 8 7 key [h] = 7 [h] = i 8 7 b c d key [g] = 6 [g] = i 4 9 2 2 7 46 8 a 11 i 4 14 e Q = {d, e, f, g, h} VA = {a, b, c, i} 7 6 8 10 Extract-MIN(Q) f h g 2 f 1 8 6 4 7 4 8 7 key [g] = 2 [g] = f 8 7 b c d key [d] = 7 [d] = c unchanged 4 9 2 2 10 key [e] = 10 [e] = f a 11 i 14 e 4 7 10 2 8 7 6 8 10 Q = {d, e, g, h} VA = {a, b, c, i, f} h g 2 f 1 6 4 Extract-MIN(Q) g 22 7 2
  • 23. Example 4 8 7 key [h] = 1 [h] = g 8 7 b c d 7 10 1 4 9 2 2 10 Q = {d, e, h} VA = {a, b, c, i, f, g} a 11 i 4 14 e 7 6 Extract-MIN(Q) h 8 10 h g 2 f 1 7 1 2 4 7 10 4 8 7 8 7 Q = {d, e} VA = {a, b, c, i, f, g, h} b c d 4 9 Extract-MIN(Q) d 2 2 10 a 11 i 4 14 e 7 6 8 10 h g 2 f 1 23 1 2 4
  • 24. Example 4 8 7 8 7 b c d key [e] = 9 [e] = f 4 9 9 2 2 10 9 a 11 i 4 14 e 7 6 Q = {e} VA = {a, b, c, i, f, g, h, d} 8 10 h g f Extract-MIN(Q) e 1 2 1 2 4 Q= VA = {a, b, c, i, f, g, h, d, e} 24
  • 25. Prim’s (V, E, w, r) 1. Q← Total time: O(VlgV + ElgV) = O(ElgV) 2. for each u V 3. do key[u] ← ∞ O(V) if Q is implemented as a min-heap 4. π[u] ← NIL 5. INSERT(Q, u) O(lgV) 6. DECREASE-KEY(Q, r, 0) key[r] ← 0 Min-heap 7. while Q Executed |V| times operations: 8. do u ← EXTRACT-MIN(Q) Takes O(lgV) O(VlgV) Executed O(E) times total 9. for each v Adj[u] Constant O(ElgV) 10. do if v Q and w(u, v) < key[v] Takes O(lgV) 11. then π[v] ← u 12. DECREASE-KEY(Q, v, w(u, v)) 25
  • 26. Algorithm  How is it different from Prim’s algorithm?  Prim’s algorithm grows one tree all the time  Kruskal’s algorithm grows tree1 multiple trees (i.e., a forest) at the same time.  Trees are merged together u using safe edges  Since an MST has exactly |V| - 1 v edges, after |V| - 1 merges, tree2 we would have only one component 26
  • 27. Kruskal’s Algorithm 8 7  Start with each vertex being its b c d 4 9 own component 2 a 11 i 4 14 e  Repeatedly merge two 6 7 8 10 components into one by h g 2 f 1 choosing the light edge that We would add connects them edge (c, f)  Which components to consider at each iteration?  Scan the set of edges in monotonically increasing order by weight 27
  • 28. Example 1. Add (h, g) {g, h}, {a}, {b}, {c}, {d}, {e}, {f}, {i} 8 7 b c d 2. Add (c, i) {g, h}, {c, i}, {a}, {b}, {d}, {e}, {f} 4 9 3. Add (g, f) 2 {g, h, f}, {c, i}, {a}, {b}, {d}, {e} a 11 i 4 14 e 4. Add (a, b) {g, h, f}, {c, i}, {a, b}, {d}, {e} 8 7 6 5. Add (c, f) {g, h, f, c, i}, {a, b}, {d}, {e} 10 h g f 6. Ignore (i, g) {g, h, f, c, i}, {a, b}, {d}, {e} 1 2 7. Add (c, d) {g, h, f, c, i, d}, {a, b}, {e} 1: (h, g) 8: (a, h), (b, c) 8. Ignore (i, h) {g, h, f, c, i, d}, {a, b}, {e} 2: (c, i), (g, f) 9: (d, e) 9. Add (a, h) {g, h, f, c, i, d, a, b}, {e} 4: (a, b), (c, f) 10: (e, f) 10. Ignore (b, c) {g, h, f, c, i, d, a, b}, {e} 11. Add (d, e) 6: (i, g) 11: (b, h) {g, h, f, c, i, d, a, b, e} 12. Ignore (e, f) 7: (c, d), (i, h) 14: (d, f) {g, h, f, c, i, d, a, b, e} 13. Ignore (b, h) {g, h, f, c, i, d, a, b, e} {a}, {b}, {c}, {d}, {e}, {f}, {g}, {h}, {i} 14. Ignore (d, f) {g, h, f, c, i, d, a, b, e} 28
  • 29. Thank You  Bibliography-  http://www.cs.brown.edu/  en.wikipedia.org/wiki/ 29