Lecture II: Minimium Spanning Tree Algorithms

Similar documents
Lecture 20: Minimum Spanning Trees (CLRS 23)

Spanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1

Minimum Spanning Trees (CLRS 23)

(Minimum) Spanning Trees

Minimum Spanning Trees (CLRS 23)

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

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

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling.

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

CMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk

23 Minimum Spanning Trees

Strongly connected components. Finding strongly-connected components

Graph Search (6A) Young Won Lim 5/18/18

CMSC 451: Lecture 4 Bridges and 2-Edge Connectivity Thursday, Sep 7, 2017

The University of Sydney MATH 2009

Theorem 1. An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices.

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano

23 Minimum Spanning Trees

Exam 2 Solutions. Jonathan Turner 4/2/2012. CS 542 Advanced Data Structures and Algorithms

Minimum Spanning Trees

2 Trees and Their Applications

COMP 250. Lecture 29. graph traversal. Nov. 15/16, 2017

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

CSE 332. Data Structures and Parallelism

CSE 332. Graphs 1: What is a Graph? DFS and BFS. Data Abstractions. CSE 332: Data Abstractions. A Graph is a Thingy... 2

In which direction do compass needles always align? Why?

Applications of trees

CSE 332. Graphs 1: What is a Graph? DFS and BFS. Data Abstractions. CSE 332: Data Abstractions. A Graph is a Thingy... 2

Single Source Shortest Paths (with Positive Weights)

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

Having a glimpse of some of the possibilities for solutions of linear systems, we move to methods of finding these solutions. The basic idea we shall

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

CS 103 BFS Alorithm. Mark Redekopp

The R-Tree. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland

Minimum Spanning Trees

Platform Controls. 1-1 Joystick Controllers. Boom Up/Down Controller Adjustments

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

MATERIAL SEE BOM ANGLES = 2 FINISH N/A

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

Constructive Geometric Constraint Solving

Graph Search Algorithms

The Constrained Longest Common Subsequence Problem. Rotem.R and Rotem.H

Closed Monochromatic Bishops Tours

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

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

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

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk

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

Graphs Depth First Search

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

SAMPLE CSc 340 EXAM QUESTIONS WITH SOLUTIONS: part 2

Multipoint Alternate Marking method for passive and hybrid performance monitoring

Data-Parallel Primitives for Spatial Operations Using PM. Quadtrees* primitives that are used to construct the data. concluding remarks.

Problem solving by search

DOCUMENT STATUS: RELEASE

Planar convex hulls (I)

Dental PBRN Study: Reasons for replacement or repair of dental restorations

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

Tangram Fractions Overview: Students will analyze standard and nonstandard

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

(4, 2)-choosability of planar graphs with forbidden structures

Spanning Tree. Preview. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree 10/17/2017.

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

d e c b a d c b a d e c b a a c a d c c e b

17 Basic Graph Properties

MINI POST SERIES BALUSTRADE SYSTEM INSTALLATION GUIDE PRODUCT CODE: MPS-RP

Preview. Graph. Graph. Graph. Graph Representation. Graph Representation 12/3/2018. Graph Graph Representation Graph Search Algorithms

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

18 Basic Graph Properties

b.) v d =? Example 2 l = 50 m, D = 1.0 mm, E = 6 V, " = 1.72 #10 $8 % & m, and r = 0.5 % a.) R =? c.) V ab =? a.) R eq =?

ELECTRONIC SUPPLEMENTARY INFORMATION

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

Isomorphism In Kinematic Chains

COMP108 Algorithmic Foundations

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

1 Introduction to Modulo 7 Arithmetic

MATERIAL SEE BOM ANGLES = 2 > 2000 DATE MEDIUM FINISH

Math 166 Week in Review 2 Sections 1.1b, 1.2, 1.3, & 1.4

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

Appendix. In the absence of default risk, the benefit of the tax shield due to debt financing by the firm is 1 C E C

Copyright 2000, Kevin Wayne 1

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

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

OpenMx Matrices and Operators

CS September 2018

QUESTIONS BEGIN HERE!

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

QUESTIONS BEGIN HERE!

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

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

Face Detection and Recognition. Linear Algebra and Face Recognition. Face Recognition. Face Recognition. Dimension reduction

Priority Search Trees - Part I

EE1000 Project 4 Digital Volt Meter

Minimum Spanning Trees

An action with positive kinetic energy term for general relativity. T. Mei

Designing A Concrete Arch Bridge

An Introduction to Clique Minimal Separator Decomposition

Phylogenetic Tree Inferences Using Quartet Splits. Kevin Michael Hathcock. Bachelor of Science Lenoir-Rhyne University 2010

L.3922 M.C. L.3922 M.C. L.2996 M.C. L.3909 M.C. L.5632 M.C. L M.C. L.5632 M.C. L M.C. DRIVE STAR NORTH STAR NORTH NORTH DRIVE

Transcription:

Ltur II: Mnmum Spnnn Tr Alortms Dr Krn T. Hrly Dprtmnt o Computr Sn Unvrsty Coll Cork Aprl 0 KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Mnmum Spnnn Trs Mnmum Spnnn Trs Spnnn Tr tr orm rom rp s tt tous vry no (.. vy s ov) Mnmum Spnnn Tr (MST) spnnn tr wt mnmum totl wt tr wt = sum o wts MST n not unqu KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Mnmum Spnnn Trs Som Trmnoloy A ut prtton o V nto two sts S n V S E (u, v) rosss ut on npont s n S, t otr n V S Cut rspts st A E no n A rosss t ut KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Mnmum Spnnn Trs An I St A E s xtnl A s sust o som MST. E (u, v) A s s or A A {(u, v)} s lso xtnl. Crt MST y rown t y : Alortm GnrMST(G): Crt mpty st A wl A os not spn ll nos o n (u, v) s or A (u, v) to A rturn A KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Mnmum Spnnn Trs Fnn S Es Lt Nos(A) = nos spnn y A. Clm Cpst rp s s or A =. Clm For xtnl A, t pst (u, v) rossn ut (Nos(A), V Nos(A)) s s or A. KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 5 / 5

Mnmum Spnnn Trs Proo o Clm Clm For xtnl A, t pst (u, v) rossn ut (Nos(A), V Nos(A)) s s or A. Suppos S ontnn A s n MST tt os not nlu (u, v). S (u, v) ontns yl. Som (x, y) S lso rosss ut. wt(u, v) wt(u, v) y o o (u, v). Tus, S mnus (x, y) plus (u, v) ontns A spns V s mn. wt KH (/0/) Ltur II: Mnmum Spnnn Tr.. Alortms (u, v) s s oraprl A. 0 / 5

Kruskl s Alortm Kruskl s lortm: t s Strt wt orst o n on-no trs Sort s n non-nrsn orr. Tk n turn: rs two rnt trs, mrk (n mr trs); otrws, nor t n mov on, T mrk nos onsttut MST. KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm K s lortm 0 Fur 3. rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm Dsjont st t strutur (s CLRS C. ) Wt Collton o sjont ynm susts ovr som st o lmnts; Hr susts r t trs wtn orst Oprtons mk st(x) rt nw snlton st ontnn x n st(x) nty t sust to w x lons unon(x, y) omn t two susts to w x n y lon. Implmntton Lnk strutur; s CLRS.3; O(mα(n)) or ny m oprtons (α vry slowly rown unton lmost onstnt ). KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Kruskl s Alortm Kruskl Alortm MST Kruskl(G, w): A mpty st or v n G.V o mk st(v) sort s n G.E n nonrsn orr y wt or (u, v) n G.E n orr o n st (u) n st (v) tn A A unon {(u, v)} unon(u, v) rturn A KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 0 / 5

Kruskl s Alortm Runnn tm n, m = num. nos, s Intlzton (n mk sts): O(n) Sortn s: O(m lo n) Loop (m trtons): m n sts m unons.. mα(n) n ll Totl: O(m lo m) α(n) lo(n) KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Prm s Alortm Prm s t s Grow (snl) tr T rom som strtn pont At stp: Consr t rn o T.. s wt on no ns tr n on outs Coos t pst su (u, v) n norport t (n no v) nto t tr. (Not ts s s o so w lwys xpn t tr sly.) KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm P s lortm n ton 0 3 3 Fur 3.5 rom CLRS KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

Prm s Alortm Prm s Alortm Lt Q prorty quu ontnn t nos. E no ntlly s ky xpt or r w s ky 0. Alortm Prm(G, r): Crt Q s ov. Crt mpty tr T. wl Q s not mpty o u Q.rmov\ mn() or v n G.nours(u) o v n Q n wt(u, v) < ky(v) mk v l o u n T ky(v) wt(u, v) rturn T KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Prm s Alortm Prm s Alortm o Alortm Prm(G, r): Crt Q s ov; Crt mpty tr T. wl Q s not mpty o u Q.rmov\ mn() or v n G.nours(u) o v n Q n wt(u, v) < ky(v) mk v l o u n T ky(v) wt(u, v) rturn T Prorty quu Q: Q ols nos not yt n mryon MST non-q nos onsttut tr-so-r KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 5 / 5

Prm s Alortm Invrnt Invrnt: T (Q) s sust o n MST or v Q, n T toun v s t ltst jonn v to ny no n Q ky(v) s t wt o tt KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Prm s Alortm Clm 3 Clm: Lt Q = nos not n Q; T (Q) = s rom T jonn nos n Q, tn nvrnt ols t t nnn (n n) o trton. Prm T (Q) Gnr MST A KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Prm s Alortm Proo o Clm 3 (Skt) Alortm Prm(G, r): Crt Q s ov. Crt mpty tr T. wl Q s not mpty o u Q.rmov\ mn() or v n G.nours(u) o v n Q n wt(u, v) < ky(v) mk v l o u n T ky(v) wt(u, v) Invrnt tru ntlly: T (Q) mpty E trton prsrvs t nvrnt: No u osn y rmov mn Impltly, () u lvs Q n jons Q n () (u, prnt T (u)) jons T (Q) E (u, prnt T (u)) s y o o u For loop upts ky(v) or nours o u to mntn loop nvrnt only s toun u n r-onsr KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

Prm s Alortm Runnn Tm Alortm Prm(G, r): Crt Q s ov. Crt mpty tr T. wl Q s not mpty o u Q.rmov\ mn\ lmnt() or v n G.nours(u) o v n Q n wt(u, v) < ky(v) mk v l o u n T ky(v) wt(u, v) Crton o Q: O(n) No. o wl loop trtons: n Prorty quu ops rmov mn lmnt O(lo n) n rpl ky O(lo n) ( Contruton o or loop: For u = x, #trtons = #nours o x; Ovrll, #trtons = m. Totl runnn tm: O(m lo n). KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

MST Appltons Applton Gnr prolm ow to lnk totr ollton o ojts ply wr lnk ost s proportonl to stn twn ojts. Exmpls Ol-ollton pplns: ojts = wlls; lnks = pplns twn wlls; (lnk ost prop. to lnt) Computr ntworks: ojts = nvul sts; lnks = t lns; (lnk ost = montly rntl ) KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 0 / 5

MST Appltons Ptur KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

MST Appltons Mol s rp wt G = (V, E) V = wll postons; E = ll possl wll-to-wll pplns; wt quls stn quls ost. MST vs st o pplns (s) tt onnt vry wll-; v mnml totl lnt. (Mor sopstt ppro mt tk onsr Non-unorm ppln osts; Lnks otr tn wll-to-wll lnks.) KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5

MST Appltons Applton Lt unrt G rprsnt omputr ntwork wr wts not rprol o lnk nwts. T vlu o pt π s ts mxmum wt. How to trmn or pr u, v t mnmum vlu pt jonn tos nos? KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 3 / 5

MST Appltons Clm: E n G rom S to V S ws t lst wt(u, v). Evry pt π rom u to v ontns on su n must v vlu KH (/0/) t lst wt(u, Ltur II: v). Mnmum Spnnn Tr Alortms Aprl 0 / 5 Lt T n MST or G. Lt (u, v) not mx. n unqu pt π n T rom u to v. Pt π s vlu wt(u, v). Dltn (u, v) prttons nos nto sjont sts.

MST Appltons Applton 3 Clustr Anlyss Prtton xprmntl t nto lustrs; Clustr mmrs mor losly rlt to on notr tn non-lustr mmrs. Applton Plrsm tton: Dt prorms sumtt Clustrs suspously smlr sumssons? Ml tstn: Dt ptnt msurmnts or vrous symptoms; Clustrs roups o smlrly t ptnts. KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 5 / 5

MST Appltons Ptur KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5