Applications of DFS: Articulation Points and Biconnected Components

Slides:



Advertisements
Similar presentations
Graph Algorithms Algorithm Design and Analysis Victor AdamchikCS Spring 2014 Lecture 11Feb 07, 2014Carnegie Mellon University.
Advertisements

Graphs - II Algorithms G. Miller V. Adamchik CS Spring 2014 Carnegie Mellon University.
Vertex Cover Dominating Set These slides are based on the Lecture Notes by David Mount for the course CMSC 451 at the University of Maryland. The Copyright.
Comp 122, Fall 2004 Elementary Graph Algorithms. graphs Lin / Devi Comp 122, Fall 2004 Graphs  Graph G = (V, E) »V = set of vertices »E = set of.
1 Graphs Traversals In many graph problems, we need to traverse the vertices of the graph in some order Analogy: Binary tree traversals –Pre-order Traversal.
Elementary Graph Algorithms Depth-first search.Topological Sort. Strongly connected components. Chapter 22 CLRS.
CS 473Lecture 141 CS473-Algorithms I Lecture 15 Graph Searching: Depth-First Search and Topological Sort.
Graph Traversals. For solving most problems on graphs –Need to systematically visit all the vertices and edges of a graph Two major traversals –Breadth-First.
ALGORITHMS THIRD YEAR BANHA UNIVERSITY FACULTY OF COMPUTERS AND INFORMATIC Lecture eight Dr. Hamdy M. Mousa.
More Graphs COL 106 Slides from Naveen. Some Terminology for Graph Search A vertex is white if it is undiscovered A vertex is gray if it has been discovered.
CS 312 – Graph Algorithms1 Graph Algorithms Many problems are naturally represented as graphs – Networks, Maps, Possible paths, Resource Flow, etc. Ch.
TECH Computer Science Graphs and Graph Traversals  // From Tree to Graph  // Many programs can be cast as problems on graph Definitions and Representations.
Graph traversals / cutler1 Graph traversals Breadth first search Depth first search.
Tirgul 11 DFS Properties of DFS Topological sort.
Applications of graph traversals
16a-Graphs-More (More) Graphs Fonts: MTExtra:  (comment) Symbol:  Wingdings: Fonts: MTExtra:  (comment) Symbol:  Wingdings:
CS 473Lecture 151 CS473-Algorithms I Lecture 15 Graph Searching: Depth-First Search and Topological Sort.
David Luebke 1 5/20/2015 CS 332: Algorithms Graph Algorithms.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
1 Data Structures DFS, Topological Sort Dana Shapira.
CSE 780 Algorithms Advanced Algorithms Graph Alg. DFS Topological sort.
Lecture 14: Graph Algorithms Shang-Hua Teng. Undirected Graphs A graph G = (V, E) –V: vertices –E : edges, unordered pairs of vertices from V  V –(u,v)
DAST 2005 Tirgul 11 (and more) sample questions. DAST 2005 Q.Let G = (V,E) be an undirected, connected graph with an edge weight function w : E→R. Let.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 9 Instructor: Paul Beame.
Lecture 10 Graph Algorithms. Definitions Graph is a set of vertices V, with edges connecting some of the vertices (edge set E). An edge can connect two.
Lecture 15: Depth First Search Shang-Hua Teng. Graphs G= (V,E) B E C F D A B E C F D A Directed Graph (digraph) –Degree: in/out Undirected Graph –Adjacency.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Clique Cover Cook’s Theorem 3SAT and Independent Set
Elementary graph algorithms Chapter 22
Tirgul 7 Review of graphs Graph algorithms: – BFS (next tirgul) – DFS – Properties of DFS – Topological sort.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
COSC 3101A - Design and Analysis of Algorithms 10
Spring 2015 Lecture 10: Elementary Graph Algorithms
Sept Elementary Graph Algorithms Graph representation Graph traversal -Breadth-first search -Depth-first search Parenthesis theorem.
1 Depth-First Search Idea: –Starting at a node, follow a path all the way until you cannot move any further –Then backtrack and try another branch –Do.
Elementary Graph Algorithms CLRS Chapter 22. Graph A graph is a structure that consists of a set of vertices and a set of edges between pairs of vertices.
Graphs.
Preview  Graph  Tree Binary Tree Binary Search Tree Binary Search Tree Property Binary Search Tree functions  In-order walk  Pre-order walk  Post-order.
CSC 413/513: Intro to Algorithms Graph Algorithms DFS.
Lecture 11 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
1 Chapter 22 Elementary Graph Algorithms. 2 Introduction G=(V, E) –V = vertex set –E = edge set Graph representation –Adjacency list –Adjacency matrix.
Elementary Graph Algorithms Comp 122, Fall 2004.
1 Chapter 22: Elementary Graph Algorithms II. 2 About this lecture Depth First Search DFS Tree and DFS Forest Properties of DFS Parenthesis theorem (very.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 20.
Topological Sort: Definition
Introduction to Graph Theory Lecture 17: Graph Searching Algorithms.
Greedy Algorithms Interval Scheduling and Fractional Knapsack These slides are based on the Lecture Notes by David Mount for the course CMSC 451 at the.
Shahed University Dr. Shahriar Bijani May  A path is a sequence of vertices P = (v 0, v 1, …, v k ) such that, for 1 ≤ i ≤ k, edge (v i – 1, v.
Tree - in “math speak” An ________ graph is a set of vertices/nodes and a set of edges, each edge connects two vertices. Any undirected graph in which.
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.
G RAPH A LGORITHMS Dr. Tanzima Hashem Assistant Professor CSE, BUET.
Graph Search Applications, Minimum Spanning Tree
Elementary Graph Algorithms
Chapter 22 Elementary Graph Algorithms
Graph Algorithms Using Depth First Search
Graph Search Applications
Binhai Zhu Computer Science Department, Montana State University
Breadth-First Search (BFS)
Graph Representation Adjacency list representation of G = (V, E)
Advanced Algorithms Analysis and Design
Elementary graph algorithms Chapter 22
Bridges and Articulation Points
Bridges and Articulation Points
Elementary graph algorithms Chapter 22
Applications of DFS: Articulation Points and Biconnected Components
Elementary Graph Algorithms
Assignment 03 Algorithms & Examples.
Graph Traversals Some applications require visiting every vertex in the graph exactly once. The application may require that vertices be visited in some.
GRAPH TRAVERSAL.
Presentation transcript:

Applications of DFS: Articulation Points and Biconnected Components These slides are based on the Lecture Notes by David Mount for the course CMSC 451 at the University of Maryland. The Copyright notice is as follows: Copyright, David M. Mount, 2008 Dept. of Computer Science, University of Maryland, College Park, MD, 20742. These lecture notes were prepared by David Mount for the course CMSC 451, Design and Analysis of Computer Algorithms, at the University of Maryland. Permission to use, copy, modify, and distribute these notes for educational purposes and without fee is hereby granted, provided that this copyright notice appear in all copies.

Articulation Point Let G = (V,E) be a connected undirected graph. Articulation Point: is any vertex of G whose removal results in a disconnected graph.

Articulation Point Articulation Point: is any vertex of G whose removal results in a disconnected graph.

Biconnected components A graph is biconnected if it contains no articulation points. Two edges are cocyclic if they are equal or if there is a simple cycle that contains both edges. (Two different ways of getting from one edge to the other) This defines an equivalence relation on the edges of the graph Biconnected components of a graph are the equivalence classes of cocyclicity relation

Biconnected components A graph is biconnected if and only if it consists of a single biconnected component No articulation points

Articulation points and DFS How to find articulation points? Use the tree structure provided by DFS G is undirected: tree edges and back edges (no difference between forward and back edges, no cross edges) Assume G is connected

internal vertex u Consider an internal vertex u Not a leaf, Assume it is not the root Let v1, v2,…, vk denote the children of u Each is the root of a subtree of DFS If for some child, there is no back edge from any node in this subtree going to a proper ancestor of u, then u is an articulation point u Here u is an articulation point

internal vertex u Here u is not an articulation point A back edge from every subtree of u to proper ancestors of u exists u

What if u is a leaf A leaf is never an articulation point A leaf has no subtrees..

What about the root? the root is an articulation point if an only if it has two or more children. Root has no proper ancestor There are no cross edges between its subtrees This root is an articulation point

How to find articulation points? Keep track of all back edges from each subtree? Too expensive Keep track of the back edge that goes highest in the tree (closest to the root) If any back edge goes to an ancestor of u, this one will. What is closest to root? Smallest discovery time

Define Low[u] Low[u]: minimum of d[u] and {d[w] | where (v,w) is a back edge and v is a (nonproper) descendent of u.}

Computing Low[u] Initialization: Low[u] = d[u] When a new back edge (u, v) is detected: Low[u] = min( Low[u], d[v]) Tree edge (u, v): Low[u] = min(Low[u], Low[v])

Once Low[u] is computed for all vertices u, we can test whether a nonroot vertex u is an articulation point u is an articulation point iff it has a child v for which Low[v] >= d[u]

DFS(G) for each (u in V) do color[u] = white pred[u] = NIL time = 0 if (color[u] == white) findArticPts(u)

findArticPts(u) //vertex u is just discovered color[u] = gray Low[u] = d[u] = ++time for each (v in Adj[u]) do { if (color[v] == white) then { //(u, v) is a tree edge pred[v] = u findArticPts(v) Low[u] = min(Low[u], Low[v]) //update Low[u] if (pred[u] == NIL) {//u is root (if v is u’s second child) add u to set of articulation points } else if (Low[v] >= d[u]) // if there is no back edge to an ancestor of u add u to set of articulation points else if (v != pred[u]) //(u, v) is a back edge Low[u] = min(Low[u], d[v]) //this back edge goes closer to the root

d=1 Low = 1 a e i a 2 b 1 8 e 8 b f j 3 c 9 i 8 1 c g 10 j 4 d 7 f 1 8 d h 3 5 h 3 6 g 3