Minimum cost spanning tree and activity networks Data structure 2002/12/2.

Slides:



Advertisements
Similar presentations
Spanning Trees. Prims MST Algorithm Algorithm ( this is also greedy) Select an arbitrary vertex to start the tree, while there are fringe vertices: 1)select.
Advertisements

Lecture 15. Graph Algorithms
CHAPTER 6 GRAPHS All the programs in this file are selected from
Minimum Spanning Tree CSE 331 Section 2 James Daly.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Chapter 6 張啟中. Kongsberg Bridge Problem (1736) A Kneiphof a b c d g C D B f e a b c d g e f A B C D Euler’s graph.
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.
1 Pertemuan 13 Minimum Spanning Tree (MST) Matakuliah: T0534/Struktur Data Tahun: 2005 Versi: September 2005.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
More Graph Algorithms Weiss ch Exercise: MST idea from yesterday Alternative minimum spanning tree algorithm idea Idea: Look at smallest edge not.
Design and Analysis of Algorithms Minimum Spanning trees
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.
Minimum spanning tree Prof Amir Geva Eitan Netzer.
Minimum Spanning Tree Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Graph Algorithms: Minimum.
The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each decision is locally optimal. These.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
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.
Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University.
Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University.
© 2015 JW Ryder CSCI 203 Data Structures1. © 2015 JW Ryder CSCI 203 Data Structures2.
7.1 and 7.2: Spanning Trees. A network is a graph that is connected –The network must be a sub-graph of the original graph (its edges must come from the.
Introduction to Graphs. Introduction Graphs are a generalization of trees –Nodes or verticies –Edges or arcs Two kinds of graphs –Directed –Undirected.
Minimum spanning trees Aims: To know the terms: tree, spanning tree, minimum spanning tree. To understand that a minimum spanning tree connects a network.
EMIS 8374 Optimal Trees updated 25 April slide 1 Minimum Spanning Tree (MST) Input –A (simple) graph G = (V,E) –Edge cost c ij for each edge e 
Minimum-Cost Spanning Tree CS 110: Data Structures and Algorithms First Semester,
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
Introduction to Graph Theory
Lecture19: Graph III Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
Graph Theory Trees. WHAT YOU WILL LEARN Trees, spanning trees, and minimum-cost spanning trees.
CSC2100B Tutorial 10 Graph Jianye Hao.
CSCI2100 Data Structures Tutorial 12
1 22c:31 Algorithms Minimum-cost Spanning Tree (MST)
Graphs 2015, Fall Pusan National University Ki-Joune Li.
Prims Algorithm for finding a minimum spanning tree
Design and Analysis of Algorithms - Chapter 91 Greedy algorithms Optimization problems solved through a sequence of choices that are: b feasible b locally.
Graph Revisited Fei Chen CSCI2100B Data Structures Tutorial 12 1.
Tree Diagrams A tree is a connected graph in which every edge is a bridge. There can NEVER be a circuit in a tree diagram!
November 22, Algorithms and Data Structures Lecture XII Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Minimum Spanning Trees
Chapter 9 : Graphs Part II (Minimum Spanning Trees)
Introduction to Algorithms
Minimum Spanning Tree Chapter 13.6.
C.Eng 213 Data Structures Graphs Fall Section 3.
CISC 235: Topic 10 Graph Algorithms.
Short paths and spanning trees
More Graph Algorithms.
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
Graph Algorithm.
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Connected Components Minimum Spanning Tree
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
4-4 Graph Theory Trees.
2018, Fall Pusan National University Ki-Joune Li
Minimum-Cost Spanning Tree
CS 583 Analysis of Algorithms
2017, Fall Pusan National University Ki-Joune Li
CSCI2100 Data Structures Tutorial
Kruskal’s Idea Adding one edge at a time Non-decreasing order No cycle
Autumn 2016 Lecture 10 Minimum Spanning Trees
CSC 380: Design and Analysis of Algorithms
Minimum Spanning Trees (MSTs)
Algorithms CSCI 235, Spring 2019 Lecture 35 Graphs IV
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Presentation transcript:

Minimum cost spanning tree and activity networks Data structure 2002/12/2

Minimum-cost spanning trees (MST) in a given graph (6.3) A minimum-cost spanning tree is a spanning tree of least cost A minimum-cost spanning tree is a spanning tree of least cost Design strategy – greedy method Design strategy – greedy method –Kruskal ’ s algorithm Edge by edge Edge by edge –Prim ’ s algorithm Span out from one vertex Span out from one vertex –Sollin ’ s algorithm Hint: Construct from connected components Hint: Construct from connected components Leave as a homework Leave as a homework

An MST example

Kruskal ’ s algorithm Edge by edge Edge by edge O(e log e) O(e log e) Algorithm: Algorithm: T={}; While ((T contains less than n-1 edges) &&(E not empty)){ choose an edge (v,w) from E of lowest cost; delete (v,w) from E; if((v,w) does not create a cycle in T) add(v,w) to T; else discard(v,w); } If(T contains fewer than n – 1 edges) printf( “ No spanning tree\n ” );

Prim ’ s algorithm Begins from a vertex Begins from a vertex O(n 2 ) O(n 2 ) Algorithm: Algorithm: T={}; TV = {0}; /* start with vertex 0 and no edges */ While (T contains fewer than n-1 edges){ let(u,v) be a least cost edge s.t. u in TV and v not in TV; if (there is no such edge) break; add v to TV; add (u,v) to T; } If (T contains fewer than n-1 edges) printf( “ No spanning tree\n ” );

Activity networks (6.5) Definition: Definition: –Vertex i is a predecessor of j Iff there is a directed path from i to j Iff there is a directed path from i to j –Vertex i is an immediate predecessor of j Iff is an edge in G Iff is an edge in G –Successor, immediate successor –Precedence relation, is a partial order relation Transitive Transitive Irreflexive Irreflexive Can be represented by a Directed Acyclic Graph (DAG)? Can be represented by a Directed Acyclic Graph (DAG)? –Topological order is a linear ordering of the vertices of a graph s.t. if i is a predecessor of j, then i precedes j in the linear ordering is a linear ordering of the vertices of a graph s.t. if i is a predecessor of j, then i precedes j in the linear ordering

An example of activity network Activity on Vertex networks Activity on Edge networks 計概 資結 邏設 組語計結 OS1 A topological order: 計概, 邏設, 組語, 計結, 資結,OS start finish Earliest time Latest time Critical activites