Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

Similar documents
Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

CS 241 Analysis of Algorithms

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

CS 461, Lecture 17. Today s Outline. Example Run

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

QUESTIONS BEGIN HERE!

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

COMP108 Algorithmic Foundations

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

QUESTIONS BEGIN HERE!

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms

1 Introduction to Modulo 7 Arithmetic

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

Greedy Algorithms, Activity Selection, Minimum Spanning Trees Scribes: Logan Short (2015), Virginia Date: May 18, 2016

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Problem solving by search

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

0.1. Exercise 1: the distances between four points in a graph

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

Garnir Polynomial and their Properties

CS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality:

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Steinberg s Conjecture is false

GREEDY TECHNIQUE. Greedy method vs. Dynamic programming method:

EE1000 Project 4 Digital Volt Meter

Weighted graphs -- reminder. Data Structures LECTURE 15. Shortest paths algorithms. Example: weighted graph. Two basic properties of shortest paths

Planar Upward Drawings

Minimum Spanning Trees

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

Outline. Binary Tree

NP-Completeness. CS3230 (Algorithm) Traveling Salesperson Problem. What s the Big Deal? Given a Problem. What s the Big Deal? What s the Big Deal?

Constructive Geometric Constraint Solving

N=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f

Trees as operads. Lecture A formalism of trees

A 4-state solution to the Firing Squad Synchronization Problem based on hybrid rule 60 and 102 cellular automata

Announcements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk

Present state Next state Q + M N

Section 10.4 Connectivity (up to paths and isomorphism, not including)

Round 7: Graphs (part I)

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am

Chapter 18. Minimum Spanning Trees Minimum Spanning Trees. a d. a d. a d. f c

Multipoint Alternate Marking method for passive and hybrid performance monitoring

COMPLEXITY OF COUNTING PLANAR TILINGS BY TWO BARS

Announcements. These are Graphs. This is not a Graph. Graph Definitions. Applications of Graphs. Graphs & Graph Algorithms

Organization. Dominators. Control-flow graphs 8/30/2010. Dominators, control-dependence. Dominator relation of CFGs

12. Traffic engineering

CMSC 451: Lecture 2 Graph Basics Thursday, Aug 31, 2017

Seven-Segment Display Driver

Walk Like a Mathematician Learning Task:

Depth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong

ECE 407 Computer Aided Design for Electronic Systems. Circuit Modeling and Basic Graph Concepts/Algorithms. Instructor: Maria K. Michael.

Lecture 20: Minimum Spanning Trees (CLRS 23)

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

Construction 11: Book I, Proposition 42

CS September 2018

Designing A Concrete Arch Bridge

Graph Contraction and Connectivity

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation

Computational Biology, Phylogenetic Trees. Consensus methods

Solutions to Homework 5

CSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review

(a) v 1. v a. v i. v s. (b)

Ch 1.2: Solutions of Some Differential Equations

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

1. Determine whether or not the following binary relations are equivalence relations. Be sure to justify your answers.

Numbering Boundary Nodes

Similarity Search. The Binary Branch Distance. Nikolaus Augsten.

Minimum Spanning Trees

Applications: The problem has several applications, for example, to compute periods of maximum net expenses for a design department.

XML and Databases. Outline. Recall: Top-Down Evaluation of Simple Paths. Recall: Top-Down Evaluation of Simple Paths. Sebastian Maneth NICTA and UNSW

Weighted Graphs. Weighted graphs may be either directed or undirected.

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

(Minimum) Spanning Trees

Yehuda Lindell Bar-Ilan University

Formal Concept Analysis

Analysis for Balloon Modeling Structure based on Graph Theory

Research Article On the Genus of the Zero-Divisor Graph of Z n

Graphs and Graph Searches

CS 103 BFS Alorithm. Mark Redekopp

Minimum Spanning Trees

Uniform 2D-Monotone Minimum Spanning Graphs

Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1

Transcription:

Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim's Alorithm Introution Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #33 3 Alorithm Gnrl Constrution Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / Introution Computtion o Costs o Spnnin Trs in Wiht Grphs Motivtion: Givn st o sits (rprsnt y vrtis o rph), onnt ths ll s hply s possil (usin onntions rprsnt y th s o wiht rph). Gols or Toy: prsnttion o th nitions n to ormlly n prolm motivt y th ov prsnttion o n lorithm (Prim's Alorithm) or solvin th prolm Rrn: Introution to Alorithms, Chptr 3 Txt, Stion 3.6 (prolm), 3.6. (Prim's Alorithm) Rll tht i G = (V ; E) is onnt, unirt rph, thn spnnin tr o G is surph G = ( V ; E) suh tht V = V (so G inlus ll th vrtis in G) G is tr Suppos now tht G = (V ; E) is onnt wiht rph with wiht untion w : E 7! N; n tht G = (V ; E ) is spnnin tr o G Th ost o G, w(g ), is th sum o th wihts o th s in G, tht is, w(g ) = X E w(): Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 3 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 /

Suppos G is wiht rph with wihts s shown low. Th ost o th ollowin spnnin tr, G = (V ; E ), is 8. 3 3 Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 6 / Minimum-Cost Spnnin Trs Th ost o th ollowin spnnin tr, G = (V ; E ), is 6. Suppos (G ; w) is wiht rph. A surph G o G is minimum-ost spnnin tr o (G ; w) i th ollowin proprtis r stis. G is spnnin tr o G. 3 w(g ) w(g ) or vry spnnin tr G o G. : In th prvious xmpl, G is lrly not minimum-ost spnnin tr, us G is spnnin tr o G suh tht w(g ) > w(g ). It n shown tht G is minimum-ost spnnin tr o (G ; w). Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 7 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 8 /

Alorithm Gnrl Constrution Existn o Minimum-Cost Spnnin Tr Builin Minimum-Cost Spnnin Tr Lmm Lt G wiht rph with wiht untion w I G is onnt thn G hs minimum-ost spnnin tr (whih is not nssrily uniqu). Proo. G hs t lst on spnnin tr, us: G only hs nit numr o spnnin trs, us: Thus, thr must xist spnnin tr o G whos ost is lss thn or qul to tht o ny othr spnnin tr. To onstrut minimum-ost spnnin tr o G = (V ; E): Strt with G = ( V ; E), whr V V n E = ;. Not: G is surph o som minimum-ost spnnin tr o (G ; w). Rptly vrtis (i nssry) n s nsurin tht G is still surph o minimum-ost spnnin tr s you o so. Continu oin this until V = V n j Ej = jv j (so tht G is spnnin tr o G). Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 9 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 0 / Alorithm Gnrl Constrution Alorithm Builin Minimum-Cost Spnnin Tr Spition o Rquirmnts Aitionl Nots: This n on in svrl irnt wys, n thr r t lst two irnt lorithms tht us this pproh to solv this prolm. Th lorithm to prsnt hr ins with V = s or som vrtx s V, n mks sur tht G is lwys tr. As rsult, this lorithm is struturlly vry similr to Dijkstr's Alorithm to omput minimum-ost pths (whih w hv lry isuss in lss). Pr-Conition G = (V ; E) is onnt rph with wiht untion w Post-Conition: is untion : V! V [ NIL I E = ((v); v) j v V n (v) 6= NIL thn (V ; E) is minimum-ost spnnin tr or G Th rph G = (V ; E) n its wiht untion hv not n hn Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 /

Alorithm Alorithm Dt Struturs Psuoo Th lorithm (to prsnt nxt) will us priority quu to stor inormtion out wihts o s tht r in onsir or inlusion Th priority quu will MinHp: th ntry with th smllst priority will t th top o th hp Eh no in th priority quu will stor vrtx in G n th wiht o n inint to this vrtx Th wiht will us s th vrtx's priority An rry-s rprsnttion o th priority quu will us A son rry will us to lot h ntry o th priority quu or ivn no in onstnt tim Not: Th t struturs will, thror, look vry muh lik th t struturs us y Dijkstr's lorithm. MST-Prim(G ; w ; s) or v V o olour[v] = whit [v] = + [v] = NIL n or Initiliz n mpty priority quu Q olour[s] = ry [s] = 0 s with priority 0 to Q Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 3 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / Alorithm Alorithm Psuoo, Continu Psuoo, Conlu whil (Q is not mpty) o (u; ) = xtrt-min(q) Not: = [u] or h v Aj[u] o i (olour[v] == whit) thn [v] = w((u; v)) olour[v] = ry; [v] = u v with priority [v] to Q ls i (olour[v] == ry) thn Upt inormtion out v (Shown on nxt sli) n i n or olour[u] = lk n whil rturn Uptin Inormtion Aout v i (w((u; v)) < [v]) thn ol = [v] [v] = w((u; v)) [v] = u Us Drs-Priority to rpl (v ; ol) in Q with (v ; [v]) n i Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 6 /

(Stp ) Consir th xution o MST-Prim(G, ): 3 3 3 3 Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 7 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 8 / (Stp ) (Stp 3) 3 3 3 3 Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 9 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 0 /

(Stp ) (Stp ) 3 3 3 3 Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 / (Stp 6) (Stp 7) 3 3 3 3 Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 3 / Mik Joson (Univrsity o Clry) Computr Sin 33 Ltur #33 /