Hw. 6: Algorithm for finding strongly connected components. Original digraph as drawn in our book and in class: Preorder label : Postorder label Nodes:

Slides:



Advertisements
Similar presentations
What is a graph ? G=(V,E) V = a set of vertices E = a set of edges edge = unordered pair of vertices
Advertisements

Depth-First Search1 Part-H2 Depth-First Search DB A C E.
Minimum Spanning Tree Sarah Brubaker Tuesday 4/22/8.
1 Strongly connected components. 2 Definition: the strongly connected components (SCC) C 1, …, C k of a directed graph G = (V,E) are the largest disjoint.
Lecture 16: DFS, DAG, and Strongly Connected Components Shang-Hua Teng.
CS 312 – Graph Algorithms1 Graph Algorithms Many problems are naturally represented as graphs – Networks, Maps, Possible paths, Resource Flow, etc. Ch.
Breadth-First Search Seminar – Networking Algorithms CS and EE Dept. Lulea University of Technology 27 Jan Mohammad Reza Akhavan.
TECH Computer Science Graphs and Graph Traversals  // From Tree to Graph  // Many programs can be cast as problems on graph Definitions and Representations.
Chapter 5 Decrease and Conquer. Homework 7 hw7 (due 3/17) hw7 (due 3/17) –page 127 question 5 –page 132 questions 5 and 6 –page 137 questions 5 and 6.
Graph Search Methods Spring 2007 CSE, POSTECH. Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u. A search method.
Edited by Malak Abdullah Jordan University of Science and Technology Data Structures Using C++ 2E Chapter 12 Graphs.
MCA 202: Discrete Structures Instructor Neelima Gupta
Graphs By JJ Shepherd. Introduction Graphs are simply trees with looser restrictions – You can have cycles Historically hard to deal with in computers.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Implementation of Graph Decomposition and Recursive Closures Graph Decomposition and Recursive Closures was published in 2003 by Professor Chen. The project.
Graphs CS-240/341. Graphs Used for representing many-to-many relationships –can take two forms directed (digraph) - a finite set of elements called vertices.
Graph Traversals Reading Material: Chapter 9. Graph Traversals Some applications require visiting every vertex in the graph exactly once. The application.
Testing for Connectedness and Cycles
Lecture 13 CSE 331 Oct 2, Announcements Please turn in your HW 3 Graded HW2, solutions to HW 3, HW 4 at the END of the class Maybe extra lectures.
Graphs CS-240/341. Uses for Graphs computer networks and routing airline flights geographic maps course prerequisite structures tasks for completing a.
Lecture 10 Topics Application of DFS Topological Sort
CSE 780 Algorithms Advanced Algorithms Graph Alg. DFS Topological sort.
Lecture 12 CSE 331 Sep 30, Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2 solutions at the end of the lecture Mid term: Oct 16,
CS344: Lecture 16 S. Muthu Muthukrishnan. Graph Navigation BFS: DFS: DFS numbering by start time or finish time. –tree, back, forward and cross edges.
Lecture 13 CSE 331 Oct 2, Announcements Mid term in < 2 weeks Graded HW2 at the END of the class.
CS 312: Algorithm Analysis Lecture #16: Strongly Connected Components This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
Trees and Tree Traversals Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
A Fast Algorithm To Determine Minimality of Strongly Connected Digraphs Under the direction of Dr. Robinson By Jianping Zhu.
Information Visualization using graphs algorithms Symeonidis Alkiviadis
ساختمانهای گسسته دانشگاه صنعتی شاهرود – اردیبهشت 1392.
CS 312: Algorithm Design & Analysis Lecture #17: Connectedness in Graphs This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
The Shape of the Web So, the Web is a directed graph, but what does it look like?
CSC 213 – Large Scale Programming. Today’s Goals  Make Britney sad through my color choices  Revisit issue of graph terminology and usage  Subgraphs,
Discussion #32 1/13 Discussion #32 Properties and Applications of Depth-First Search Trees.
Graph Traversal BFS & DFS. Review of tree traversal methods Pre-order traversal In-order traversal Post-order traversal Level traversal a bc d e f g hi.
Discrete Structures Trees (Ch. 11)
Algorithm for obtaining the connected components of a graph Samia Qader 252a-az HW # 6 all examples obtained from LEDA software in directory: 252a/handout/demo/graphwin/graphwin.
Jan Topological Order and SCC Edge classification Topological order Recognition of strongly connected components.
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
Homework #5 Due: October 31, 2000 Christine Kang Graph Concepts and Algorithms.
Depth-First Search Lecture 21: Graph Traversals
Breadth First Search and Depth First Search. Greatest problem in Computer Science Has lead to a lot of new ideas and data structures Search engines before.
Properties and Applications of Depth-First Search Trees and Forests
Hello Everyone!!! 1. Tree And Graphs 2 Features of Trees  Tree Nodes Each node have 0 or more children A node have must one parent  Binary tree Tree.
Strongly Connected Components for Directed Graphs Kelley Louie Credits: graphs by /demo/graphwin/graphwin.
Now, Chapter 5: Decrease and Conquer Reduce problem instance to smaller instance of the same problem and extend solution Solve smaller instance Extend.
Graph Concepts and Algorithms Using LEDA By Caroline Moore and Carmen Frerichs (252a-at and 252a-ao) each graph in the presentation was created using gw_basic_graph_algorithms.
Graph Concepts Elif Tosun 252a-aa (All graphics created by using demo/graphwin/gw*)
CMSC 341 Graphs – DFS Expanded. 2 Depth First Traversal with Finish Times dfs(Graph G) { for (each v  V) d[v] = 0// d = discovery “time” time = 0// “global”
Graph Concepts Illustrated Using The Leda Library Amanuel Lemma CS252 Algorithms.
Graph Representations And Traversals. Graphs Graph : – Set of Vertices (Nodes) – Set of Edges connecting vertices (u, v) : edge connecting Origin: u Destination:
CSC 252: Algorithms October 28, 2000 Homework #5: Graphs Victoria Manfredi (252a-ad) notes: -Definitions for each of the graph concepts are those presented.
1 3/21/2016 MATH 224 – Discrete Mathematics First we determine if a graph is connected.
Graph Terms By Susan Ott. Vertices Here are 7 vertices without any edges Each Vertex is labeled a different color and number.
CSC 213 – Large Scale Programming Lecture 31: Graph Traversals.
Code: BCA302 Data Structures with C Prof. (Dr.) Monalisa Banerjee By.
Breadth-First Search (BFS)
Tracing An Algorithm for Strongly Connected Components that uses Depth First Search Graph obtained from Text, page a-al: Geetika Tewari.
Depth First Search Neil Tang 4/1/2010
Undirected versus Directed Graphs
Main algorithm with recursion: We’ll have a function DFS that initializes, and then calls DFS-Visit, which is a recursive function and does the depth first.
Graph Algorithms Using Depth First Search
Spanning Trees Discrete Mathematics.
Lecture 13 CSE 331 Oct 1, 2012.
Depth-First Search D B A C E Depth-First Search Depth-First Search
Lecture 12 CSE 331 Sep 26, 2011.
Depth First Search Neil Tang 4/10/2008
GRAPHS G=<V,E> Adjacent vertices Undirected graph
Lecture 15 CSE 331 Oct 4, 2010.
Presentation transcript:

Hw. 6: Algorithm for finding strongly connected components. Original digraph as drawn in our book and in class: Preorder label : Postorder label Nodes: Solid: tree edge Blue: back edge Green: cross edge Edges:

Reverse arrows on original digraph: Note: This is the same digraph with all of the arrows reversed. To find the connected components in this digraph we must now do a Depth First Search, beginning at the vertices with the highest Postorder value.

Depth First Search beginning at vertices with the highest Postorder value: If we take a close look at our new edges, we see that the tree edges of the DFS beginning at vertices with the highest Postorder value form trees. This graph is in fact a forest.

The last depth first search, drawn with only the tree edges: Strongly Connected Component Strongly Connected Component Strongly Connected Component Strongly Connected Component When the last graph is redrawn using only the tree edges from the last depth first search, the resulting graph is a forest. The trees that make up this forest are the strongly connected components of the original graph.

An algorithm to find the strongly connected components of a digraph. 1. Do a Depth First Search on graph, label vertices in Post Order. 2. Compute reverse directed graph (switch direction of all arrows). 3. Do a DFS on the reversed graph, starting at vertices with highest Post Order label. Continue until all of the reversed graph has been searched. 4. The results of the DFS on the reversed graph results in a forest. The trees of this forest are the strongly connected components of the original graph. To review:

Hw. 6>> Carmen Frerichs (252a-ao) I used gw_dfs* and gw_basic_graph_algorithms* to create the graphs that I used in my presentation.