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

Similar documents
(Minimum) Spanning Trees

Lecture 20: Minimum Spanning Trees (CLRS 23)

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

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

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

Minimum Spanning Trees (CLRS 23)

Lecture II: Minimium Spanning Tree Algorithms

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

The University of Sydney MATH 2009

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

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

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

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

Minimum Spanning Trees (CLRS 23)

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

Strongly connected components. Finding strongly-connected components

2 Trees and Their Applications

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

23 Minimum Spanning Trees

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

Single Source Shortest Paths (with Positive Weights)

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

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

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

In which direction do compass needles always align? Why?

CS 103 BFS Alorithm. Mark Redekopp

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

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

Applications of trees

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

23 Minimum Spanning Trees

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

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

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

17 Basic Graph Properties

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

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

Graph Search Algorithms

Minimum Spanning Trees

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

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

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

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

18 Basic Graph Properties

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

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

Planar convex hulls (I)

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

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

COMP108 Algorithmic Foundations

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

Closed Monochromatic Bishops Tours

MATERIAL SEE BOM ANGLES = 2 FINISH N/A

Graphs Depth First Search

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

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

An Introduction to Clique Minimal Separator Decomposition

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

CS 241 Analysis of Algorithms

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

DOCUMENT STATUS: RELEASE

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

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

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

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

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

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

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

PRECAST APPROACH SLAB NOTES

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

OpenMx Matrices and Operators

Graphs Breadth First Search

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

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

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

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

DOCUMENT STATUS: LA-S5302-XXXXS LA, SSS, TRICEPS EXTENSION VERY

CSCI 104 Graph Representation and Traversals. Mark Redekopp David Kempe

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

Constructive Geometric Constraint Solving

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

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

SAMPLE CSc 340 EXAM QUESTIONS WITH SOLUTIONS: part 2

DOCUMENT STATUS: CORE HEALTH & FITNESS, LLC IL-D2002-XXAAX IP,DUAL ADJUSTIBLE PULLEY MATERIAL SEE BOM FINISH N/A N/A SHEET SIZE: B SCALE: 1:33.

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

Instruction Scheduling, Register Allocation, Partial Redundancy Removal

MATERIAL SEE BOM ANGLES = 2 > 2000 DATE MEDIUM FINISH

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 =?

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

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

Tangram Fractions Overview: Students will analyze standard and nonstandard

Instruction Scheduling

Problem solving by search

Graph Search Algorithms CSE

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

On Hamiltonian Tetrahedralizations Of Convex Polyhedra

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

Copyright 2000, Kevin Wayne 1

Transcription:

Spnnn Trs BFS, DFS spnnn tr Mnmum spnnn tr Mr 28, 2018 Cn Hrn / Gory Tn 1

Dpt-rst sr Vsts vrts lon snl pt s r s t n o, n tn ktrks to t rst junton n rsums own notr pt Mr 28, 2018 Cn Hrn / Gory Tn 2

Dpt-rst sr Alortm Alortm DFS G, v { mrk v s vst or ll vrts u jnt to v, o { (u s not n vst) { DFS G, u } } mrk v s ns output v to ns orr lst } Mr 28, 2018 Cn Hrn / Gory Tn 3

Dpt-rst sr 0 3 1 2 9 8 5 0 1, 3 1 0, 2, 4, 6, 7 4 2 1, 3, 8, 9 3 0, 2 7 4 1, 5, 6, 7 5 4 6 6 1, 4, 7 Vst: T T T T T T T T T T 7 1, 4, 6 0 1 2 3 4 5 6 7 8 9 8 2 9 2 Vst orr: 0 1 2 3 8 9 4 5 6 7 Fns orr: 3 8 9 2 5 7 6 4 1 0 Runnn tm? Cn lso mplmnt lk BFS usn stk Mr 28, 2018 Cn Hrn / Gory Tn 4

Appltons o rp trvrsl? Otr ppltons: Topolol sort (DFS) Moln tr low Cyl tton Sortst pt n mz (BFS) Mr 28, 2018 Cn Hrn / Gory Tn 5

Spnnn trs Gvn G = V, E, spnnn tr o G s onnt surp o G wt xtly V 1 s mnml sust o s tt onnts ll t vrts o G G = Spnnn trs Mr 28, 2018 Cn Hrn / Gory Tn 6

Spnnn tr proprts A spnnn tr G = V, E must: ontn ll t vrts o G onnt not ontn yls A tr, ut not spnnn tr G = Contns ll t vrts n s t orrt numr o s, ut s yl n s not onnt Mr 28, 2018 Cn Hrn / Gory Tn 7

Construtn spnnn trs Bk to trvrsls Spnnn trs n onstrut y prormn trvrsl strtn rom ny vrtx, mrkn trvl s n vst vrts.. Brt-rst sr, Dpt-rst sr Mr 28, 2018 Cn Hrn / Gory Tn 8

DFS spnnn tr Root t DFS spnnn tr t ny vrtx,.. Mrk vrts n s us n DFS trvrsl,,,,,,,, E,,,, Rturn G = V, E Mr 28, 2018 Cn Hrn / Gory Tn 9

BFS spnnn tr Root t BFS spnnn tr t ny vrtx,.. Mrk vrts n s us n BFS trvrsl,,,,,,,, E,,,, Rturn G = V, E Mr 28, 2018 Cn Hrn / Gory Tn 10

Mnmum spnnn trs T suprm rulr o Boolsvll s pskt Prolm: nstlln powr lns n Boolsvll to supply ll t rsntl/ommrl/t. strts ut t osts $5 pr unt stn to onstrut t powr ln Fn onurton o mnml ost tt onnts ll t strts Ts s mnml spnnn tr Mr 28, 2018 Cn Hrn / Gory Tn 11

Mnml spnnn tr Gvn onnt rp G = V, E wt unonstrn wts Output rp G = V, E wt t ollown rtrsts G s spnnn surp o G Alortm rqurmnts G s onnt n yl (.. tr) T sum o t wts o E s mnml mon ll su spnnn trs A A A 8 2 4 4 2 B 7 C 1 D B C 1 D B C 1 D 2 3 9 5 2 3 5 2 3 5 E F E F E F Wt = 15 Wt = 13 Mr 28, 2018 Cn Hrn / Gory Tn 12

Kruskl's lortm or mnmum spnnn trs Gry lortm, puls n 1956 Buls spnnn tr rom svrl onnt omponnts Rptly ooss t mnmum-wt jonn two onnt omponnts, w os not orm yl, untl st s V 1 s KrusklsAlortm() { st E = ø wl ( E V 1) { Fn mnmum wt E su tt E A to E } } os not ontn yls Mr 28, 2018 Cn Hrn / Gory Tn 13

Kruskl's lortm Dt typs or mplmntton KrusklsAlortm() { st E = ø wl ( E V 1) { Fn mnmum wt E su tt E A to E } } os not ontn yls W n ADTs tt support our rqur oprtons ntly How o w n t mnmum wt? Prorty quu! How n w k or yls n prorm unon? Dsjont sts! Mr 28, 2018 Cn Hrn / Gory Tn 14

Kruskl's lortm Exmpl D 16 9 A 8 12 G 6 10 2 C 13 F 4 B 3 17 5 11 H 7 16 E MST wt: 38 13 A prq A, B 2 B, C 3 G, H 4 E, F 5 F, G 10 F, H 11 D, F 12 B, G 13 E B C D G A, C 6 C, F 13 F H B, E 7 A, D 16 prq ost p orr rry ul rmovmn Not tt no nsrtons prorm tr ul C, D 8 E, H 16 Ovrll ost? D, G 9 C, E 17 Not: only on rton lst n prq or omptnss n ts sl Mr 28, 2018 Cn Hrn / Gory Tn 15

A slt tnnt mz onstruton Wt mks oo mz? A un o jnt rooms E room s vrtx Opn wll twn rooms orm n Unprtl, not sly solv Hly rnn, mny ns Just nou wlls to t rom ny room to ny otr room Esplly strt n ns out Mr 28, 2018 Cn Hrn / Gory Tn 16

Mz unr onstruton So r, numr o wlls v n knok own, wl otrs rmn Now w onsr t wll twn rooms A n B Soul w knok t own? I A n B r otrws onnt I A n B r not otrws onnt A B Alortm: Wl s rmn n E Rmov rnom = u, v rom E I u n v v not n onnt A to E Mrk u n v s onnt Ts s lot lk Kruskl's lortm! Solv t usn sjont sts n rnom slton Mr 28, 2018 Cn Hrn / Gory Tn 17

Rns or ts lsson Crrno & Hnry Cptrs 20.4.2 20.4.3 (Spnnn trs, mnmum spnnn trs) Nxt lss: Crrno & Hnry, Cptr 20.4.3 20.4.4 (Sortst pts) Mr 28, 2018 Cn Hrn / Gory Tn 18