SlideShare une entreprise Scribd logo
1  sur  29
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

Contenu connexe

Tendances

Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmAcad
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithmmansab MIRZA
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithmfaisal2204
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra Sahil Kumar
 
Prims Algorithm
Prims AlgorithmPrims Algorithm
Prims AlgorithmSriram Raj
 
KRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitraKRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitraguest1f4fb3
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning treeSTEFFY D
 
Dijkstra algorithm a dynammic programming approach
Dijkstra algorithm   a dynammic programming approachDijkstra algorithm   a dynammic programming approach
Dijkstra algorithm a dynammic programming approachAkash Sethiya
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph TheoryYosuke Mizutani
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentationSubid Biswas
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithmtaimurkhan803
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's AlgorithmArijitDhali
 

Tendances (20)

Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithm
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
PRIM'S ALGORITHM
PRIM'S ALGORITHMPRIM'S ALGORITHM
PRIM'S ALGORITHM
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithm
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
 
Prims Algorithm
Prims AlgorithmPrims Algorithm
Prims Algorithm
 
KRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitraKRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitra
 
Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithm
 
Shortest Path in Graph
Shortest Path in GraphShortest Path in Graph
Shortest Path in Graph
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Graph Theory: Trees
Graph Theory: TreesGraph Theory: Trees
Graph Theory: Trees
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Dijkstra algorithm a dynammic programming approach
Dijkstra algorithm   a dynammic programming approachDijkstra algorithm   a dynammic programming approach
Dijkstra algorithm a dynammic programming approach
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
 
Kruskal’s Algorithm
Kruskal’s AlgorithmKruskal’s Algorithm
Kruskal’s Algorithm
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 

En vedette

My presentation minimum spanning tree
My presentation minimum spanning treeMy presentation minimum spanning tree
My presentation minimum spanning treeAlona Salva
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data StructureAnuj Modi
 
BigDansing presentation slides for SIGMOD 2015
BigDansing presentation slides for SIGMOD 2015BigDansing presentation slides for SIGMOD 2015
BigDansing presentation slides for SIGMOD 2015Zuhair khayyat
 
Graph data structure
Graph data structureGraph data structure
Graph data structureTech_MX
 
BigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTBigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTZuhair khayyat
 
Social network analysis of CMAD2013 Twitter data
Social network analysis of CMAD2013 Twitter dataSocial network analysis of CMAD2013 Twitter data
Social network analysis of CMAD2013 Twitter dataJari Jussila
 
x1 t10 04 maximum & minimum problems (13)
x1 t10 04 maximum & minimum problems (13)x1 t10 04 maximum & minimum problems (13)
x1 t10 04 maximum & minimum problems (13)Nigel Simmons
 
Alg1 8.2 Substitution Method
Alg1 8.2 Substitution MethodAlg1 8.2 Substitution Method
Alg1 8.2 Substitution MethodJaqueline Vallejo
 
Lecture 6-cs648 Randomized Algorithms
Lecture 6-cs648 Randomized AlgorithmsLecture 6-cs648 Randomized Algorithms
Lecture 6-cs648 Randomized AlgorithmsAnshul Yadav
 
Skiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strcturesSkiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strctureszukun
 
01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: Introduction01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: IntroductionAndres Mendez-Vazquez
 
Shortest path problem
Shortest path problemShortest path problem
Shortest path problemIfra Ilyas
 

En vedette (20)

My presentation minimum spanning tree
My presentation minimum spanning treeMy presentation minimum spanning tree
My presentation minimum spanning tree
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
BigDansing presentation slides for SIGMOD 2015
BigDansing presentation slides for SIGMOD 2015BigDansing presentation slides for SIGMOD 2015
BigDansing presentation slides for SIGMOD 2015
 
Graph data structure
Graph data structureGraph data structure
Graph data structure
 
Lecture8 data structure(graph)
Lecture8 data structure(graph)Lecture8 data structure(graph)
Lecture8 data structure(graph)
 
BigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTBigDansing presentation slides for KAUST
BigDansing presentation slides for KAUST
 
Social network analysis of CMAD2013 Twitter data
Social network analysis of CMAD2013 Twitter dataSocial network analysis of CMAD2013 Twitter data
Social network analysis of CMAD2013 Twitter data
 
x1 t10 04 maximum & minimum problems (13)
x1 t10 04 maximum & minimum problems (13)x1 t10 04 maximum & minimum problems (13)
x1 t10 04 maximum & minimum problems (13)
 
Linkers
LinkersLinkers
Linkers
 
Alg1 8.2 Substitution Method
Alg1 8.2 Substitution MethodAlg1 8.2 Substitution Method
Alg1 8.2 Substitution Method
 
Greedy minimum spanning tree- prim's algorithm
Greedy minimum spanning tree- prim's algorithmGreedy minimum spanning tree- prim's algorithm
Greedy minimum spanning tree- prim's algorithm
 
Linkers
LinkersLinkers
Linkers
 
Lecture 6-cs648 Randomized Algorithms
Lecture 6-cs648 Randomized AlgorithmsLecture 6-cs648 Randomized Algorithms
Lecture 6-cs648 Randomized Algorithms
 
Avl trees
Avl treesAvl trees
Avl trees
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Skiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strcturesSkiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strctures
 
01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: Introduction01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: Introduction
 
Shortest path problem
Shortest path problemShortest path problem
Shortest path problem
 

Similaire à Minimum spanning Tree

Math final 2012 form2 paper1
Math final 2012 form2 paper1Math final 2012 form2 paper1
Math final 2012 form2 paper1nurul abdrahman
 
Unit 5 session 2 MinimumSpanningTrees.ppt
Unit 5 session 2 MinimumSpanningTrees.pptUnit 5 session 2 MinimumSpanningTrees.ppt
Unit 5 session 2 MinimumSpanningTrees.pptprithivr1
 
Surface Area
Surface Area Surface Area
Surface Area cadteach
 
Vertex cover problem
Vertex cover problemVertex cover problem
Vertex cover problemGinusaju
 
Metode Kuantitatif MMSI Gunadarma Yudhy Tri Suharno
Metode Kuantitatif MMSI Gunadarma Yudhy Tri SuharnoMetode Kuantitatif MMSI Gunadarma Yudhy Tri Suharno
Metode Kuantitatif MMSI Gunadarma Yudhy Tri SuharnoYudhy Tri Suharno
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theoryArvindBorge
 
Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...appasami
 
Network Information Processing
Network Information ProcessingNetwork Information Processing
Network Information ProcessingReza Rahimi
 
Algorithm chapter 9
Algorithm chapter 9Algorithm chapter 9
Algorithm chapter 9chidabdu
 
Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...
Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...
Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...Steven Duplij (Stepan Douplii)
 

Similaire à Minimum spanning Tree (20)

Math final 2012 form2 paper1
Math final 2012 form2 paper1Math final 2012 form2 paper1
Math final 2012 form2 paper1
 
Unit 5 session 2 MinimumSpanningTrees.ppt
Unit 5 session 2 MinimumSpanningTrees.pptUnit 5 session 2 MinimumSpanningTrees.ppt
Unit 5 session 2 MinimumSpanningTrees.ppt
 
Surface Area
Surface Area Surface Area
Surface Area
 
Question bank
Question bankQuestion bank
Question bank
 
Vertex cover problem
Vertex cover problemVertex cover problem
Vertex cover problem
 
Metode Kuantitatif MMSI Gunadarma Yudhy Tri Suharno
Metode Kuantitatif MMSI Gunadarma Yudhy Tri SuharnoMetode Kuantitatif MMSI Gunadarma Yudhy Tri Suharno
Metode Kuantitatif MMSI Gunadarma Yudhy Tri Suharno
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theory
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
m.tech final
m.tech finalm.tech final
m.tech final
 
Unit 5 Bingo Answe
Unit 5 Bingo AnsweUnit 5 Bingo Answe
Unit 5 Bingo Answe
 
Graphs
GraphsGraphs
Graphs
 
Approximation Algorithms
Approximation AlgorithmsApproximation Algorithms
Approximation Algorithms
 
Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...
 
Gwt sdm public
Gwt sdm publicGwt sdm public
Gwt sdm public
 
Network Information Processing
Network Information ProcessingNetwork Information Processing
Network Information Processing
 
Unit 5 bingo practice test
Unit 5 bingo practice testUnit 5 bingo practice test
Unit 5 bingo practice test
 
Algorithm chapter 9
Algorithm chapter 9Algorithm chapter 9
Algorithm chapter 9
 
Daa q.paper
Daa q.paperDaa q.paper
Daa q.paper
 
Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...
Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...
Steven Duplij, Raimund Vogl, "Polyadic braid operators and higher braiding ga...
 
Pre Alg8.8 A
Pre Alg8.8 APre Alg8.8 A
Pre Alg8.8 A
 

Dernier

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Dernier (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

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