Strongly Connected Components

Similar documents
Week 3: Connected Subgraphs

Analysis of Algorithms - Elementary graphs algorithms -

Analysis of Algorithms - Elementary graphs algorithms -

Outlines: Graphs Part-4. Applications of Depth-First Search. Directed Acyclic Graph (DAG) Generic scheduling problem.

Combinatorial Networks Week 1, March 11-12

The Equitable Dominating Graph

11/13/17. directed graphs. CS 220: Discrete Structures and their Applications. relations and directed graphs; transitive closure zybooks

Searching Linked Lists. Perfect Skip List. Building a Skip List. Skip List Analysis (1) Assume the list is sorted, but is stored in a linked list.

Section 6.1. Question: 2. Let H be a subgroup of a group G. Then H operates on G by left multiplication. Describe the orbits for this operation.

cycle that does not cross any edges (including its own), then it has at least

u 3 = u 3 (x 1, x 2, x 3 )

Basic Polyhedral theory

Addition of angular momentum

UNTYPED LAMBDA CALCULUS (II)

Abstract Interpretation: concrete and abstract semantics

Recall that by Theorems 10.3 and 10.4 together provide us the estimate o(n2 ), S(q) q 9, q=1

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018

Chapter 6 Folding. Folding

Linear Non-Gaussian Structural Equation Models

SCHUR S THEOREM REU SUMMER 2005

Network Congestion Games

Roadmap. XML Indexing. DataGuide example. DataGuides. Strong DataGuides. Multiple DataGuides for same data. CPS Topics in Database Systems

Supplementary Materials

1 Minimum Cut Problem

First derivative analysis

CS 361 Meeting 12 10/3/18

From Elimination to Belief Propagation

Figure 1: Closed surface, surface with boundary, or not a surface?

Higher order derivatives

[ ] 1+ lim G( s) 1+ s + s G s s G s Kacc SYSTEM PERFORMANCE. Since. Lecture 10: Steady-state Errors. Steady-state Errors. Then

Final Exam Solutions

Derangements and Applications

Addition of angular momentum

u r du = ur+1 r + 1 du = ln u + C u sin u du = cos u + C cos u du = sin u + C sec u tan u du = sec u + C e u du = e u + C

EXST Regression Techniques Page 1

Finding low cost TSP and 2-matching solutions using certain half integer subtour vertices

SOME PARAMETERS ON EQUITABLE COLORING OF PRISM AND CIRCULANT GRAPH.

Examples and applications on SSSP and MST

Bifurcation Theory. , a stationary point, depends on the value of α. At certain values

Approximation and Inapproximation for The Influence Maximization Problem in Social Networks under Deterministic Linear Threshold Model

ON RIGHT(LEFT) DUO PO-SEMIGROUPS. S. K. Lee and K. Y. Park

Mutually Independent Hamiltonian Cycles of Pancake Networks

On spanning trees and cycles of multicolored point sets with few intersections

10. The Discrete-Time Fourier Transform (DTFT)

Construction of asymmetric orthogonal arrays of strength three via a replacement method

International Journal of Scientific & Engineering Research, Volume 6, Issue 7, July ISSN

Minimum Spanning Trees

Computing and Communications -- Network Coding

That is, we start with a general matrix: And end with a simpler matrix:

Chapter 10. The singular integral Introducing S(n) and J(n)

CLONES IN 3-CONNECTED FRAME MATROIDS

CPSC 665 : An Algorithmist s Toolkit Lecture 4 : 21 Jan Linear Programming

u x v x dx u x v x v x u x dx d u x v x u x v x dx u x v x dx Integration by Parts Formula

Quasi-Classical States of the Simple Harmonic Oscillator

Square of Hamilton cycle in a random graph

4 x 4, and. where x is Town Square

ANALYSIS IN THE FREQUENCY DOMAIN

Solution: APPM 1360 Final (150 pts) Spring (60 pts total) The following parts are not related, justify your answers:

Lecture 4: Parsing. Administrivia

International Journal of Foundations of Computer Science c World Scientic Publishing Company Searching a Pseudo 3-Sided Solid Orthoconvex Grid ANTONIO

Engineering 323 Beautiful HW #13 Page 1 of 6 Brown Problem 5-12

MATH 319, WEEK 15: The Fundamental Matrix, Non-Homogeneous Systems of Differential Equations

In the previous two chapters, we clarified what it means for a problem to be decidable or undecidable.

CS 6353 Compiler Construction, Homework #1. 1. Write regular expressions for the following informally described languages:

Introduction to Arithmetic Geometry Fall 2013 Lecture #20 11/14/2013

priority queue ADT heaps 1

Superposition. Thinning

Slide 1. Slide 2. Slide 3 DIGITAL SIGNAL PROCESSING CLASSIFICATION OF SIGNALS

Hydrogen Atom and One Electron Ions

Optimizing Product Launches in the Presence of Strategic Consumers Appendix

NEW APPLICATIONS OF THE ABEL-LIOUVILLE FORMULA

MIT Sloan School of Management

Source code. where each α ij is a terminal or nonterminal symbol. We say that. α 1 α m 1 Bα m+1 α n α 1 α m 1 β 1 β p α m+1 α n

COMPUTER GENERATED HOLOGRAMS Optical Sciences 627 W.J. Dallas (Monday, April 04, 2005, 8:35 AM) PART I: CHAPTER TWO COMB MATH.

(Upside-Down o Direct Rotation) β - Numbers

MEMORIAL UNIVERSITY OF NEWFOUNDLAND

ECE 407 Computer Aided Design for Electronic Systems. Instructor: Maria K. Michael. Overview. CAD tools for multi-level logic synthesis:

CPS 616 W2017 MIDTERM SOLUTIONS 1

Fourier Transforms and the Wave Equation. Key Mathematics: More Fourier transform theory, especially as applied to solving the wave equation.

Probability and Stochastic Processes: A Friendly Introduction for Electrical and Computer Engineers Roy D. Yates and David J.

A Polynomial-Time Approximation Scheme for the Minimum-Connected Dominating Set in Ad Hoc Wireless Networks

Direct Approach for Discrete Systems One-Dimensional Elements

EEO 401 Digital Signal Processing Prof. Mark Fowler

Economics 201b Spring 2010 Solutions to Problem Set 3 John Zhu

Lie Groups HW7. Wang Shuai. November 2015

Chapter 13 GMM for Linear Factor Models in Discount Factor form. GMM on the pricing errors gives a crosssectional

Vishnu V. Narayan. January

INTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x)

Differential Equations

DIFFERENTIAL EQUATION

4. Money cannot be neutral in the short-run the neutrality of money is exclusively a medium run phenomenon.

10. EXTENDING TRACTABILITY

Dealing with quantitative data and problem solving life is a story problem! Attacking Quantitative Problems


Self-Adjointness and Its Relationship to Quantum Mechanics. Ronald I. Frank 2016

nd the particular orthogonal trajectory from the family of orthogonal trajectories passing through point (0; 1).

ECE 2210 / 00 Phasor Examples

4.5 Minimum Spanning Tree. Chapter 4. Greedy Algorithms. Minimum Spanning Tree. Motivating application

Approximate Maximum Flow in Undirected Networks by Christiano, Kelner, Madry, Spielmann, Teng (STOC 2011)

Solution of Assignment #2

Transcription:

Strongly Connctd Componnts Lt G = (V, E) b a dirctd graph Writ if thr is a path from to in G Writ if and is an quivalnc rlation: implis and implis s quivalnc classs ar calld th strongly connctd componnts (SCC s) of G For V, C( ) := s SCC 1

a b c d a b c d f g h f g h a b c d a b c d f g h f g h 2

Th componnt graph Ida: collaps ach SCC s into a singl nod Formally: componnt graph G scc = (V scc, E scc ) V scc = th SCC s C 1,..., C k of G E scc = {(C, C j ) : = j, (, ) E for som C, C j } G : G scc : a b c d a b c d f g h f g h 3

Lmma 1. in G C( ) C( ) in G scc 4

Lmma 2. G scc is acyclic. Suppos thr is a cycl. By dfinition, no slf loops in G scc, so th cycl must contain two distinct nods, say C( ) and C( ) Thn w hav C( ) C( ) and C( ) C( ) in G scc By Lmma 1, and in G Thus, C( ) = C( ) QED 5

An application Considr th gathring coins problm for a gnral dirctd graph Givn a dirctd graph G = (V, E) On ach nod thr ar N[ ] coins Goal: find th max numbr of coins that can b gathrd on any on path through G Th path nd not b simpl, but onc you pick up th coins on a nod, thy ar gon 6

W alrady know how to solv this for a DAG For a gnral graph, w start by computing G scc For ach SCC C, w assign to it C N[ ] coins Now run th DAG algorithm on G scc Exampl: G : G scc : 1 1 4 1 4 1 1 1 2 1 2 2 2 1 2 2 Gnral principl: Try to rduc qustions about graphs to qustions about DAG s 7

Anothr application Problm: A graph G = (V, E) is calld smi-connctd if for all, V, or. Show how to tst if G is smi-connctd 8

First considr th problm for DAG s Lt 1,..., n b a topological sort of G Claim: G is smi-connctd thr is an dg +1 for ach = 1.. n 1 1 2 3 4 5 6 7 9

Now considr a gnral graph Claim: G is smi-connctd G scc is smi-connctd (follows dirctly from Lmma 1) Algorithm: 1. Run algorithm SCC to gt G scc (which is a DAG) 2. Tst if G scc is smi-connctd (as abov) 10

Computing SCC s: th Kosaraju/Sharir Algorithm Th ida G : G scc : a b c d a b c d f g h G scc : f g h a b c f g h d a b G scc : c d Somhow (by magic) find a nod in a sink componnt and prform DFS from thr G scc : f g h G scc : a b c d a b c d f g h f g h 11

Computing SCC s: th Kosaraju/Sharir Algorithm For a graph G, lt G T dnot its transpos or rvrs sam as G but with all dgs rvrsd G and G T hav th sam SCC s in fact, (G T ) scc = (G scc ) T Algorithm SCC(G): 1. call DFS(G), and ordr th nods 1,..., n in ordr of dcrasing finishing tim (as in DFSTopSort) 2. comput G T 3. call DFS(G T ) but in th top-lvl loop, procss in th ordr 1,..., n th trs in th DFS forst ar th SCC s of G Running tim: O( V + E ) 12

Exampl: G : 13/14 11/16 1/10 8/9 12/15 3/4 2/7 5/6 G T : 13/14 11/16 1/10 8/9 12/15 3/4 2/7 5/6 G T : 13/14 11/16 1/10 8/9 12/15 3/4 2/7 5/6 G T : 13/14 11/16 1/10 8/9 12/15 3/4 2/7 5/6 G T : 13/14 11/16 1/10 8/9 G T : 13/14 11/16 1/10 8/9 12/15 3/4 2/7 5/6 12/15 3/4 2/7 5/6 G scc : 13/14 11/16 1/10 8/9 12/15 3/4 2/7 5/6 13

Notation: lt ƒ [ ] b th finish tim in th first DFS, and lt ƒ (U) := m x{ƒ [ ] : U} Lmma 3. Suppos (C, C ) E scc. Thn ƒ (C) > ƒ (C ) Proof. In th first DFS, lt b th first nod discovrd in C C Cas 1: C C C By th Whit Path Thorm, all nods in C C ar dscndnts of in th DFS forst By th Parnthsis Thorm, ƒ [ ] = ƒ (C) > ƒ (C ) 14

Cas 2: C C C By th Whit Path Thorm, all nods in C ar dscndnts of in th DFS forst By Lmma 2, thr is no path from C to C in G scc, and so no nod in C is rachabl from so at tim ƒ [ ], all nods in C ar still whit ƒ (C) > ƒ [ ] = ƒ (C ). QED 15

Thorm. Algorithm SCC is corrct. Proof. Lt T 1,..., T l b th trs of th DFS forst cratd in stp 3 Lt C 1,..., C k b th SCC s, with ƒ (C ) > ƒ (C +1 ) G scc : C 1 C 2 C3 C 4 (G scc ) T : C 1 C 2 C3 C 4 16

(G scc ) T : C 1 C 2 C3 C 4 At stp 3, w start with a vrtx 1 in C 1 By Whit Path Thorm, all nods in C 1 will b in T 1 By Lmma 3, in G T, thr ar no dgs laving C 1 th nods of C 1 ar xactly th nods of T 1 17

(G scc ) T : C 1 C 2 C3 C 4 Nxt, w pick a nod in C 2, and at this tim, all nods in C 1 ar black, and all nods in C 2,..., C k ar whit By Whit Path Thorm, T 2 contains all nods in C 2, and by Lmma 3, T 2 contains no othr nods th nods of C 2 ar xactly th nods of T 2 Procding by induction, w gt T = C for = 1,..., l, and so k = l. QED 18

Rprsntation of G scc Lt C 1,..., C k b th SCC s Numbr th nods 1.. k Standard adjacncy list rprsntation of G scc Also: An array mapping V to j {1,..., k}, whr C j An array mapping j {1..., k} to a list rprsntation of C j This can all b don in tim O( V + E ), and w may assum that C 1,..., C k ar alrady in topological ordr in fact Algorithm SCC outputs C 1,..., C k in topological ordr 19

Connctivity in undirctd graphs Suppos G is undirctd (, ) E (, ) E SCC s ar just calld connctd componnts Th componnt graph consists of isolatd nods no dgs btwn componnts Easy to comput: th trs in th DFS forst ar th connctd componnts 20