Strongly connected components. Finding strongly-connected components

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

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

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

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

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

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

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

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

(Minimum) Spanning Trees

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

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

Applications of trees

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

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

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

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

Lecture II: Minimium Spanning Tree Algorithms

Graphs Depth First Search

The University of Sydney MATH 2009

Minimum Spanning Trees (CLRS 23)

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

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

Planar convex hulls (I)

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

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

In which direction do compass needles always align? Why?

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

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

Minimum Spanning Trees (CLRS 23)

CS 103 BFS Alorithm. Mark Redekopp

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

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

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

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

2 Trees and Their Applications

Constructive Geometric Constraint Solving

DOCUMENT STATUS: RELEASE

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

Closed Monochromatic Bishops Tours

Functions and Graphs 1. (a) (b) (c) (f) (e) (d) 2. (a) (b) (c) (d)

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

On Hamiltonian Tetrahedralizations Of Convex Polyhedra

MATERIAL SEE BOM ANGLES = 2 FINISH N/A

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

Single Source Shortest Paths (with Positive Weights)

Graphs Breadth First Search

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

17 Basic Graph Properties

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued...

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

MATERIAL SEE BOM ANGLES = 2 > 2000 DATE MEDIUM FINISH

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

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

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

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

Self-Adjusting Top Trees

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

THE MIDWAY & GAMES GRADE 6 STEM STEP BY STEP POTENTIAL & KINETIC ENERGY MOVE THE CROWDS

Round 7: Graphs (part I)

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

Graph Search Algorithms

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

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

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

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

Housing Market Monitor

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

Years. Marketing without a plan is like navigating a maze; the solution is unclear.

18 Basic Graph Properties


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

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

Jonathan Turner Exam 2-10/28/03

Multipoint Alternate Marking method for passive and hybrid performance monitoring

QUESTIONS BEGIN HERE!

Minimum Spanning Trees

Vr Vr

c A c c vlr) (o (9 cci rj c4 c c t(f, e, rf) c.i c..i sc! ct J i J iut d(o (o cf) (f) cf) lr, o) e, t- I c c) (o (f) J) r) OJ -i sf N o) o) :!

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

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

EE1000 Project 4 Digital Volt Meter

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

COMP108 Algorithmic Foundations

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

Scientific Programming. Graphs

EEO 401 Digital Signal Processing Prof. Mark Fowler

Nefertiti. Echoes of. Regal components evoke visions of the past MULTIPLE STITCHES. designed by Helena Tang-Lim

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

priority queue ADT heaps 1

Copyright 2000, Kevin Wayne 1

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

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

23 Minimum Spanning Trees

N V R T F L F RN P BL T N B ll t n f th D p rt nt f l V l., N., pp NDR. L N, d t r T N P F F L T RTL FR R N. B. P. H. Th t t d n t r n h r d r

FL/VAL ~RA1::1. Professor INTERVI of. Professor It Fr recru. sor Social,, first of all, was. Sys SDC? Yes, as a. was a. assumee.

ADORO TE DEVOTE (Godhead Here in Hiding) te, stus bat mas, la te. in so non mor Je nunc. la in. tis. ne, su a. tum. tas: tur: tas: or: ni, ne, o:

Transcription:

Stronly onnt omponnts Fnn stronly-onnt omponnts Tylr Moor stronly onnt omponnt s t mxml sust o rp wt rt pt twn ny two vrts SE 3353, SMU, Dlls, TX Ltur 9 Som sls rt y or pt rom Dr. Kvn Wyn. For mor normton s ttp://www.s.prnton.u/~wyn/klnr-tros. Som o rus or pt rom Pyton lortms y Mnus L Htln. 2 / 15 D. Nos n r mutully rl tr s ot pt rom to n lso pt rom to. D. rp s stronly onnt vry pr o nos s mutully rl. Lmm. Lt ny no. s stronly onnt vry no s rl rom, n s rl rom vry no. Torm. n trmn s stronly onnt n tm. P. Pk ny no. Run FS rom n. rvrs orntton o vry n G Run FS rom n. Rturn tru ll nos r n ot FS xutons. orrtnss ollows mmtly rom prvous lmm. P. Follows rom nton. P. Pt rom to : ontnt pt wt pt. Pt rom to : ontnt pt wt pt. s u ok pts ovrlp v 41 3 / 15 42 4 / 15

Is Wkp stronly onnt rp? D. stron omponnt s mxml sust o mutully rl nos. Torm. [Trjn 1972] n n ll stron omponnts n tm. 43 5 / 15 6 / 15 Stronly onnt omponnts Stronly onnt omponnts stronly onnt omponnt s t mxml sust o rp wt rt pt twn ny two vrts r suprnos n DG? 7 / 15 8 / 15

Stronly onnt omponnts Kosrju s lortm or nn Ss Wt w trnspos ll s? 1 Gt topolol sort o ll vrts 2 Trnspos t rp (rvrs ll s) 3 Trvrs t rp n topololly sort orr, n n S tm n s r. Suprnos stll n DG Ss on t n 8 / 15 9 / 15 Kosrju s lortm or Fnn Stronly onnt omponnts 1. Gt topolol sort o ll vrts Kosrju s lortm or Fnn Stronly onnt omponnts 2. Rvrs ll s topsort: [,,,,,,,, ] topsort: [,,,,,,,, ] sn: {} sn: {} ss: [] ss: []

Kosrju s lortm or Fnn Stronly onnt omponnts 3. Trvrs t rp n topololly sort orr, n n S tm n s r. Kosrju s lortm or Fnn Stronly onnt omponnts 3. Trvrs t rp n topololly sort orr, n n S tm n s r. 2n S topsort: [,,,,,,,, ] sn: {,,,} ss: [{,,,}] topsort: [,,,,,,,, ] sn: {,,,,,,} ss: [{,,,},{,,}] 1st S 1st S Kosrju s lortm or Fnn Stronly onnt omponnts 3. Trvrs t rp n topololly sort orr, n n S tm n s r. 1st S 2n S 3r S topsort: [,,,,,,,, ] sn: {,,,,,,,,} ss: [{,,,},{,,},{,}] o or Kosrju s S lortm t r (G ) : # Trnspos ( r v. s o ) G GT = {} o r u n G : GT[ u ] = st ( ) # Gt l l t nos n t r o r u n G : o r v n G[ u ] : GT[ v ]. ( u ) # l l r v r s s rturn GT s (G ) : GT = t r (G) # Gt t t r n s p o s rp ss, sn = [ ], st ( ) o r u n t r s t o p s o r t (G ) : # DFS s t r t n p o n t s u n sn : ontnu # I n o r o v r nos = wlk (GT, u, sn ) # Don t o kwr ( sn ) sn. upt () # W v now sn s s. ppn () # notr S oun p r n t s s 11 / 15

o or Kosruju s S lortm (topolol sort) o or Kosruju s S lortm (rp trvrsl) t r s t o p s o r t (G ) : S, Q, r s = st ( ), [ ], [ ] # V s t s t n quu o r u n G : #ovr n t r rp Q. ppn ( u ) wl Q: # Plnn nos l t? v = Q. pop ( ) # Gt on u n S : ontnu S. ( v ) # W v v s t t now Q. xtn (G[ v ] ) r s. ppn ( u ) # P o s t o r r p r o s s : no wn n s r s. r v r s ( ) rturn r s wlk (G, s, S=st ( ) ) :#Wlk t rp rom no s P, Q = t ( ), st ( )#P r s s o r s + to o quu P [ s ] = Non #s s no p r s s o r Q. ( s ) #W p l n on s t r t n wt s wl Q: #S t l l nos to v s t u = Q. pop ( ) #Pk on, r t r r l y o r v n G[ u ]. r n (P, S ) : # Nw nos? Q. ( v ) #W p l n to v s t tm! P [ v ] = u #Rmmr wr w m rom rturn P #T t r v r s l t r 12 / 15 13 / 15 Exrs 1: pply Kosrju s S lortm Exrs 2: pply Kosrju s S lortm Grp G Trnspos(G) Grp G Trnspos(G) Wt s t topolol sort o G? Lt s mk t DFS tr strtn rom Wt r t stronly onnt omponnts? Wt s t topolol sort o G? Lt s mk t DFS tr strtn rom Wt r t stronly onnt omponnts? 14 / 15 15 / 15