Connectivity1 Connectivity and Biconnectivity connected components cutvertices biconnected components.

Slides:



Advertisements
Similar presentations
© 2004 Goodrich, Tamassia Depth-First Search1 DB A C E.
Advertisements

Graphs - II Algorithms G. Miller V. Adamchik CS Spring 2014 Carnegie Mellon University.
Depth-First Search1 Part-H2 Depth-First Search DB A C E.
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.
CSC401 – Analysis of Algorithms Lecture Notes 14 Graph Biconnectivity
Lecture 16: DFS, DAG, and Strongly Connected Components Shang-Hua Teng.
Applications of graph traversals
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Depth-First Search1 DB A C E. 2 Outline and Reading Definitions (§6.1) Subgraph Connectivity Spanning trees and forests Depth-first search (§6.3.1) Algorithm.
Data Structures & Algorithms Graph Search Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
1 The Graph Abstract Data Type CS 5050 Chapter 6.
Connected Components, Directed Graphs, Topological Sort COMP171.
© 2004 Goodrich, Tamassia Directed Graphs1 JFK BOS MIA ORD LAX DFW SFO.
© 2004 Goodrich, Tamassia Depth-First Search1 DB A C E.
1 Directed Graphs CSC401 – Analysis of Algorithms Lecture Notes 15 Directed Graphs Objectives: Introduce directed graphs and weighted graphs Present algorithms.
Connected Components, Directed Graphs, Topological Sort Lecture 25 COMP171 Fall 2006.
CS344: Lecture 16 S. Muthu Muthukrishnan. Graph Navigation BFS: DFS: DFS numbering by start time or finish time. –tree, back, forward and cross edges.
Applications of Depth-First Search
Directed Graphs1 JFK BOS MIA ORD LAX DFW SFO. Directed Graphs2 Outline and Reading (§6.4) Reachability (§6.4.1) Directed DFS Strong connectivity Transitive.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
Connected Components, Directed graphs, Topological sort COMP171 Fall 2005.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
IS 2610: Data Structures Graph April 5, 2004.
Week -7-8 Topic - Graph Algorithms CSE – 5311 Prepared by:- Sushruth Puttaswamy Lekhendro Lisham.
Information Visualization using graphs algorithms Symeonidis Alkiviadis
CSC 213 – Large Scale Programming. Today’s Goals  Make Britney sad through my color choices  Revisit issue of graph terminology and usage  Subgraphs,
Approximating the Minimum Degree Spanning Tree to within One from the Optimal Degree R 陳建霖 R 宋彥朋 B 楊鈞羽 R 郭慶徵 R
October 22, DFS, BFS, Biconnectivity, Digraphs 1 CS 221 West Virginia University.
Discussion #32 1/13 Discussion #32 Properties and Applications of Depth-First Search Trees.
1 Applications of BFS and DFS CSE 2011 Winter May 2016.
GRAPHS 1. Outline 2  Undirected Graphs and Directed Graphs  Depth-First Search  Breadth-First Search.
Graphs.
Spanning Trees. A spanning tree for a connected, undirected graph G is a graph S consisting of the nodes of G together with enough edges of G such that:
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.
Lecture 11 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Jan Topological Order and SCC Edge classification Topological order Recognition of strongly connected components.
Connectivity and Paths 報告人:林清池. Connectivity A separating set of a graph G is a set such that G-S has more than one component. The connectivity of G,
1 Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting Yang,
Depth-First Search Lecture 21: Graph Traversals
Introduction to Graph Theory Lecture 17: Graph Searching Algorithms.
Minimum Spanning Trees CSE 373 Data Structures Lecture 21.
Properties and Applications of Depth-First Search Trees and Forests
Introduction to Graph Theory
CSC 213 – Large Scale Programming Lecture 31: Graph Traversals.
CS 361 – Chapter 13 Graph Review Purpose Representation Traversal Comparison with tree.
Directed Graphs1 JFK BOS MIA ORD LAX DFW SFO. Directed Graphs2 Outline and Reading (§12.4) Reachability (§12.4.1) Directed DFS Strong connectivity Transitive.
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.
Graphs ORD SFO LAX DFW Graphs 1 Graphs Graphs
Breadth-First Search (BFS)
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,
Spanning Trees.
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,
Directed Graphs 5/1/15 12:25:22 PM
Graph Algorithms Using Depth First Search
Directed Graphs Directed Graphs 1 Shortest Path Shortest Path
Biconnectivity SEA PVD ORD FCO SNA MIA 11/16/2018 2:31 AM
Elementary Graph Algorithms
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Subgraphs, Connected Components, Spanning Trees
Directed Graphs Directed Graphs Directed Graphs 2/23/ :12 AM BOS
Minimum Spanning Trees
Biconnectivity SEA PVD ORD FCO SNA MIA 5/6/2019 5:08 PM Biconnectivity
Biconnectivity SEA PVD ORD FCO SNA MIA 5/23/ :21 PM
Lecture 11 Graph Algorithms
Presentation transcript:

Connectivity1 Connectivity and Biconnectivity connected components cutvertices biconnected components

Connectivity2 Connected Components Connected Graph: any two vertices are connected by a path. Connected Component: maximal connected subgraph of a graph.

3 Equivalence Relations A relation on a set S is a set R of ordered pairs of elements of S defined by some property Example: S = {1,2,3,4} R = {(i,j)  S X S such that i < j} = {(1,2),(1,3),(1,4),(2,3),(2,4),{3,4)}

4 Equivalence Relations An equivalence relation is a relation with the following properties: (x,x)  R,  x  S(reflexive) (x,y)  R  (y,x)  R(symmetric) (x,y), (y,z)  R  (x,z)  R(transitive) The relation C can be defined as follows on the set of vertices of a graph: (u,v)  C  u and v are in the same connected component C is an equivalence relation.

5 DFS on a Disconnected Graph DFS(v) visits all the vertices and edges in the connected component of v. To compute the connected components: k = 0 // component counter for each (vertex v) if unvisited(v) // add to component k the vertices //reached by v DFS(v, k++)

6 DFS on a Disconnected Graph A DFS from vertex a gives us...

Connectivity7 Cutvertices A Cutvertex (separation vertex) is one whose removal disconnects the graph. In the above graph, cutvertices are: ORD, DEN If the Chicago airport (ORD) is closed, then there is no way to get from Providence to cities on the west coast. Similarly for Denver.

Connectivity8 Biconnectivity Biconnected graph: has no cutvertices New flights: LGA-ATL and DFW-LAX make the graph biconnected.

Connectivity9 Properties of Biconnected Graphs There are two disjoint paths between any two vertices. There is a cycle through any two vertices. By convention, two nodes connected by an edge form a biconnected graph, but this does not verify the above properties.

Connectivity10 Biconnected Components A biconnected component (block) is a maximal biconnected subgraph Biconnected components are edge-disjoint but share cutvertices.

Connectivity11 Characterization of the Biconnected Components We define an equivalence relation R on the edges of G: (e', e")  R if there is a cycle containing both e' and e" How do we know this is an equivalence relation? Proof (by pretty picture) of the transitive property:

Connectivity12 Characterization of the Biconnected Components What does our equivalence relation R give us? Each equivalence class corresponds to: –a biconnected component of G –a connected component of a graph H whose vertices are the edges of G and whose edges are the pairs in relation R.

Connectivity13 DFS and Biconnected Components Graph H has O(m 2 ) edges in the worst case. Instead of computing the entire graph H, we use a smaller proxy graph K. The connected components of K are the same as those of H!

Connectivity14 DFS and Biconnected Components Start with an empty graph K whose vertices are the edges of G. Given a DFS on G, consider the (m -n +1) cycles of G induced by the back edges. For each such cycle C = (e 0, e 1,..., e p ) add edges (e 0, e 1 )... (e 0, e p ) to K.

Connectivity15 A Linear Time Algorithm We can further reduce the size of the proxy graph to O(m) –Process the back edges according to a preorder visit of their destination vertex in the DFS tree –Mark the discovery edges forming the cycles –Stop adding edges to the proxy graph after the first marked edge is encountered. –The resulting proxy graph is a forest! –This algorithm runs in O(n+m) time. The size of K is O(mn) in the worst case.

Connectivity16 Example Back edges labeled according to the preorder visit of their destination vertex in the DFS tree Processing e 1 Processing e 2

Connectivity17 Example (contd.) DFS tree final proxy graph (a tree since the graph is biconnected)

Connectivity18 Why Preorder? The order in which the back edges are processed is essential for the correctness of the algorithm Using a different order yields a graph that provides incorrect information

Connectivity19 Try the Algorithm on this Graph!