Strongly Connected Components

Slides:



Advertisements
Similar presentations
Introduction to Algorithms Graph Algorithms
Advertisements

Graphs - II Algorithms G. Miller V. Adamchik CS Spring 2014 Carnegie Mellon University.
Introduction to Algorithms Lecture 12 Prof. Constantinos Daskalakis CLRS
Depth-First Search1 Part-H2 Depth-First Search DB A C E.
Lecture 16: DFS, DAG, and Strongly Connected Components Shang-Hua Teng.
Breadth-First Search Seminar – Networking Algorithms CS and EE Dept. Lulea University of Technology 27 Jan Mohammad Reza Akhavan.
1 Graphs: Traversal Searching/Traversing a graph = visiting the vertices of a graph by following the edges in a systematic way Example: Given a highway.
Data Structures & Algorithms Graph Search Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
1 Data Structures DFS, Topological Sort Dana Shapira.
CS344: Lecture 16 S. Muthu Muthukrishnan. Graph Navigation BFS: DFS: DFS numbering by start time or finish time. –tree, back, forward and cross edges.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
CISC220 Fall 2009 James Atlas Nov 13: Graphs, Line Intersections.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Representing and Using Graphs
Graphs.
Biconnected Components CS 312. Objectives Formulate problems as problems on graphs Implement iterative DFS Describe what a biconnected component is Be.
1 Subgraphs A subgraph S of a graph G is a graph such that The vertices of S are a subset of the vertices of G The edges of S are a subset of the edges.
Properties and Applications of Depth-First Search Trees and Forests
Graphs + Shortest Paths David Kauchak cs302 Spring 2013.
5. Biconnected Components of A Graph If one city’s airport is closed by bad weather, can you still fly between any other pair of cities? If one computer.
Week 11 - Wednesday.  What did we talk about last time?  Exam 2  And before that:  Graph representations  Depth first search.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
Review Graph Directed Graph Undirected Graph Sub-Graph Spanning Sub-Graph Degree of a Vertex Weighted Graph Elementary and Simple Path Link List Representation.
Graph Search Applications, Minimum Spanning Tree
Introduction to Algorithms
Data Structures & Algorithm Analysis lec(8):Graph T. Souad alonazi
Breadth-First Search (BFS)
Graphs A New Data Structure
Directed Graphs Directed Graphs Shortest Path 12/7/2017 7:10 AM BOS
Directed Graphs 12/7/2017 7:15 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Shortest Paths.
Graphs Motivation and Terminology Representations Traversals
Chapter 22 Elementary Graph Algorithms
Tracing An Algorithm for Strongly Connected Components that uses Depth First Search Graph obtained from Text, page a-al: Geetika Tewari.
Graphs Representation, BFS, DFS
Chapter 3. Decompositions of Graphs
May 12th – Minimum Spanning Trees
Graph Algorithms BFS, DFS, Dijkstra’s.
Directed Graphs 9/20/2018 1:45 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Depth-First Search.
Directed Graphs 5/1/15 12:25:22 PM
Graph Algorithms Using Depth First Search
Directed Graphs Directed Graphs 1 Shortest Path Shortest Path
Concurrent Depth-First Search Algorithms
Graph Search Applications
Graph Algorithms – 2 DAGs Topological order
Lecture 10 Algorithm Analysis
Minimum Spanning Tree.
Graph Algorithms – 2.
Advanced Algorithms Analysis and Design
Shortest Paths.
All-pairs Shortest Path
All-pairs shortest path
Search Related Algorithms
Minimum Spanning Tree Section 7.3: Examples {1,2,3,4}
Subgraphs, Connected Components, Spanning Trees
Directed Graphs Directed Graphs Directed Graphs 2/23/ :12 AM BOS
COMP171 Depth-First Search.
Discrete Math 2 Shortest Path Using Matrix
Graph Algorithms "A charlatan makes obscure what is clear; a thinker makes clear what is obscure. " - Hugh Kingsmill CLRS, Sections 22.2 – 22.4.
Copyright © Aiman Hanna All rights reserved
Data Structures & Algorithms Digraphs and DAGs
Chapter 16 1 – Graphs Graph Categories Strong Components
Shortest Paths.
Bridges and Articulation Points
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Graph Traversals Some applications require visiting every vertex in the graph exactly once. The application may require that vertices be visited in some.
Presentation transcript:

Strongly Connected Components

Strongly Connected Components (SCC) Directed Graph A set of nodes, such that every node is reachable from every other node in the SCC The assumption is that the SCC is the maximal set of such nodes – i.e. the largest sets where all nodes are reachable from each other. Typically we want to get a list of the SCCs Notice: if we replace an SCC by a single node, where edges to any node in the SCC are in-edges, and edges from any node in the SCC are out-edges, then we end up with a DAG

Computing Strongly Connected Components Perform DFS like before. SCCs are identified when a back edge creates a cycle (and therefore connects everything in that subtree). Keep track of order visited, and “low” value, similar to bridges/articulation points Update Low only for Exploring (not Visited/Finished) vertices. Add each node to a stack When you finish a node where Num == Low, it marks the root of a SCC Pop nodes off the stack until you get that node off; those nodes are a SCC – can store them separately,

Low is lowest EXPLORING (not yet fully Visited) seen in that subgraph 1 2 d is when visited Low is lowest EXPLORING (not yet fully Visited) seen in that subgraph 6 3 5 8 9 7 4 3 Notice that the Low value is NOT updated to the previously node value, since the node it sees is already finished/visited, not still exploring

Alternative Approach To see if two components are in same SCC, check whether i->j and j->i are both possible Can compute transitive closure of the graph (use Floyd-Warshall, which we discuss in Shortest Path) Then, check for connectivity is trivial. But, pulling into lists of all SCCs takes O(n^2) time