1 Pertemuan 13 Minimum Spanning Tree (MST) Matakuliah: T0534/Struktur Data Tahun: 2005 Versi: September 2005.

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

Minimum Spanning Tree Sarah Brubaker Tuesday 4/22/8.
1 Pertemuan 12 Binary Search Tree Matakuliah: T0026/Struktur Data Tahun: 2005 Versi: 1/1.
1 Pertemuan 22 Radix Sort Matakuliah: T0016/Algoritma dan Pemrograman Tahun: 2005 Versi: versi 2.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture10.
Minimum cost spanning tree and activity networks Data structure 2002/12/2.
1 Pertemuan 19 Leftist Tree Heap Matakuliah: T0026/Struktur Data Tahun: 2005 Versi: 1/1.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Spanning Trees.
Spanning Trees. 2 Spanning trees Suppose you have a connected undirected graph Connected: every node is reachable from every other node Undirected: edges.
1 Pertemuan 20 Binomial Heap Matakuliah: T0026/Struktur Data Tahun: 2005 Versi: 1/1.
Minimum-Cost Spanning Tree weighted connected undirected graph spanning tree cost of spanning tree is sum of edge costs find spanning tree that has minimum.
Lecture 12 Minimum Spanning Tree. Motivating Example: Point to Multipoint Communication Single source, Multiple Destinations Broadcast – All nodes in.
1 Pertemuan 20 Time & Condition Clauses with Future reference Matakuliah: G0134 – Grammar III Tahun: 2005 Versi: revisi 1.
1 Pertemuan 24 Shortest Path Matakuliah: T0026/Struktur Data Tahun: 2005 Versi: 1/1.
Design and Analysis of Algorithms Minimum Spanning trees
Spanning Trees. Spanning trees Suppose you have a connected undirected graph –Connected: every node is reachable from every other node –Undirected: edges.
1 Minimum Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Minimum Spanning Tree Algorithms. What is A Spanning Tree? u v b a c d e f Given a connected, undirected graph G=(V,E), a spanning tree of that graph.
Minimum Spanning Tree Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Copyright Networking Laboratory Chapter 6. GRAPHS Horowitz, Sahni, and Anderson-Freed Fundamentals of Data Structures in C, 2nd Edition Computer.
Graph Dr. Bernard Chen Ph.D. University of Central Arkansas.
0 Course Outline n Introduction and Algorithm Analysis (Ch. 2) n Hash Tables: dictionary data structure (Ch. 5) n Heaps: priority queue data structures.
COSC 2007 Data Structures II Chapter 14 Graphs III.
UNC Chapel Hill Lin/Foskey/Manocha Minimum Spanning Trees Problem: Connect a set of nodes by a network of minimal total length Some applications: –Communication.
Algorithm Course Dr. Aref Rashad February Algorithms Course..... Dr. Aref Rashad Part: 5 Graph Algorithms.
© 2015 JW Ryder CSCI 203 Data Structures1. © 2015 JW Ryder CSCI 203 Data Structures2.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
Introduction to Graph Theory
1 Minimum Spanning Trees (some material adapted from slides by Peter Lee, Ananda Guna, Bettina Speckmann)
Minimum Spanning Trees CS 146 Prof. Sin-Min Lee Regina Wang.
Lecture19: Graph III Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
Trees Dr. Yasir Ali. A graph is called a tree if, and only if, it is circuit-free and connected. A graph is called a forest if, and only if, it is circuit-free.
Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees
1 22c:31 Algorithms Minimum-cost Spanning Tree (MST)
Prims Algorithm for finding a minimum spanning tree
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Minimum Spanning Trees
Pertemuan 22 The Business Views of the Technology Architecture
Minimum Spanning Tree Chapter 13.6.
CISC 235: Topic 10 Graph Algorithms.
Short paths and spanning trees
Spanning Tree A spanning tree is any tree that consists solely of edges in G and that includes all the vertices in G. Example.
Data Structures & Algorithms Graphs
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Graph Algorithm.
Minimum-Cost Spanning Tree
Minimum Spanning Trees
EMIS 8373: Integer Programming
Connected Components Minimum Spanning Tree
Minimum Spanning Tree.
Chapter 7: Greedy Algorithms
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
MST - Prim’s Algorithm Greedy algorithm that “grows” an MST by repeatedly finding the lowest cost edge that will connect a new vertex to MST For every.
Minimum-Cost Spanning Tree
Kruskal’s Algorithm for finding a minimum spanning tree
Minimum-Cost Spanning Tree
Kruskal’s Minimum Spanning Tree Algorithm
Minimum Spanning Trees
Richard Anderson Lecture 10 Minimum Spanning Trees
Minimum Spanning Tree.
CSE 373: Data Structures and Algorithms
Kruskal’s Idea Adding one edge at a time Non-decreasing order No cycle
Weighted Graphs & Shortest Paths
Minimum Spanning Trees (MSTs)
CSE 373: Data Structures and Algorithms
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Presentation transcript:

1 Pertemuan 13 Minimum Spanning Tree (MST) Matakuliah: T0534/Struktur Data Tahun: 2005 Versi: September 2005

2 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : menerangkan algoritma untuk MST (TIK-11)..

3 Outline Materi Spanning Tree. Algoritma untuk MST : –Prim –Kruskal –Sollin

4 Spanning Trees Spanning (ST) Tree is any tree that consist solely of edges in Graph (G). DFS and BFS can be used to create ST : DFS : depth first spanning tree. BFS : breadth first spanning tree.

5 MST MST is spanning tree of least cost (weight). Three different algorithms (greedy method) can be used to obtain a minimum spanning tree of connected undirected graph. Prim Kruskal Sollin

6 T = 0 TV={1} {start with vertex 1 and no edges } done = false While T contains less than n-1 edges and not done Do Begin Let (u,v) be a least-cost edge such that u is element of TV and v is not element of TV If there is no such edge Then done = true ElseAdd v to TV and (u,v) to T End If T contains fewer than n-1 edges Then “No Spanning Tree” Prim’s Algorithm

7 uvTVTNotesFigure --{1}{}Initial 16{1,6}{(1,6)}add 6 to TV, add (1,6) to Tb 65{1,6,5}{(1,6),(6,5)}add 5 to TV, add (6,5) to Tc 54(1,6,5,4}{(1,6),(6,5),(5,4)}add 4 to TV, add (5,4) to Td 43(1,6,5,4,3}{(1,6),(6,5),(5,4),(4,3)}add 3 to TV, add (4,3) to Te 32(1,6,5,4,3,2}{(1,6),(6,5),(5,4),(4,3),(3,2)}add 2 to TV, add (3,2) to Tf 27(1,6,5,4,3,2,7}{(1,6),(6,5),(5,4),(4,3),(3,2),(2,7)}add 7 to TV, add (2,7) to Tg T e r m i n a t e n=7 Summary of Prim’s Algorithm

8 Example of Prim’s Algorithm (a)(b)(c)(d) (e) (g) (f)

9 T = 0 While T contains less than n-1 edges and E not empty Do Begin Choose an edge(v,w) from E If (v,w) does not create a cycle in T Then Add (v,w) to T ElseDiscard(v,w) End If T contains fewer than n-1 edges Then “No Spanning Tree” Kruskal’s Algorithm

10 Summary of Kruskal’s Algorithm EdgeWeightTNotesFigure --{}Initialb (1,6)10{(1,6)}add (1,6) to Tc (3,4)12{(1,6),(3,4)}add (3,4) to Td (2,7)14{(1,6),(3,4),(2,7)}add (2,7) to Te (2,3)16{(1,6),(3,4),(2,7),(2,3)}add (2,3) to Tf (4,7)18{(1,6),(3,4),(2,7),(2,3)}discard (4,7) (4,5)22{(1,6),(3,4),(2,7),(2,3),(4,5)}add (4,5) to Tg (5,7)24{(1,6),(3,4),(2,7),(2,3),(4,5)}discard (5,7) (5,6)25{(1,6),(3,4),(2,7),(2,3),(4,5),(5,6)}add (5,6) to Th T e r m i n a t e

11 Example of Kruskal’s Algorithm (b) (c) (d) 1012 (a) (e) (f) (g) (h)

12 Sollin’s Algorithm Selects several edges at each stage. At the start of stage, the selected edges, together with all n graph vertices, from spanning forest. This edge is minimum-cost edge that has exactly one vertex is the tree. The selected edges are added to the spanning tree being constructed. It is possible for two trees in the forest to select the same edge. So, multiple copies of the same edges are to be eliminated. Also when a graph has several edges with the same cost, it is possible for two tress to select two different edges that connect them together. These edges will, of course, have the same cost; only one of these should be retained. At the start of the first stage, the set of selected edges is empty. The algorithm terminates when there is only one tree at the end of a stage or when no edges remain to be selected.

13 Summary of Sollin’s Algorithm NotesSelected EdgesFigure Initial{} Select edge for each of the vertices{(1,6),(2,7),(3,4),(4,3),(5,4),(6,1),(7,2)} Eliminate the duplicate edges{(1,6),(2,7),(3,4),(5,4)}b Select least cost for joining the forest into tree{(1,6),(2,7),(3,4),(5,4),(6,5),(2,3)}c T e r m i n a t e

(a) (b) (c) Example of Sollin’s Algorithm

15 Selesai