DFS, Biconnected Components

Total Page:16

File Type:pdf, Size:1020Kb

DFS, Biconnected Components MAL 376: Graph Algorithms I Semester 2014-2015 Lecture 1: July 24 Course Coordinator: Prof. B. S. Panda Scribes: Raghuvansh, Himanshu, Mohit, Abhishek Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications. They may be distributed outside this class only with the permission of the Course Coordinator. This lecture's notes describe the concept of depth first search and biconnectivity in graphs. They start by introducing graphs, their preliminaries and other notations that would be used later on to finally give an algorithm to enumerate all the biconnected components in the graph using depth first search. 1.1 Preliminaries A graph is a set of vertices V and edges E ⊆ V × V . A graph is called simple if it has no multiple edges (multiple edges between the same pair of vertices) and self loops (an edge from a vertex to itself). A graph is considered to be undirected if there is no sense of ordering in the vertices of an edge i.e. an edge from a to b is also an edge from b to a, otherwise it is said to be directed. An edge (u; v) is said to be incident on the vertices u and v. The degree of a vertex is the number of edges incident on it. For directed graphs, there are two degrees, an in-degree and a out-degree for every vertex. Henceforth, unless otherwise specified, a use of the term graph would mean an undirected, simple graph. Pictorially, a graph with V = fr; s; u; v; wg and E = f(r; s); (r; v); (r; w); (s; v); (u; v); (u; w)g would be drawn as shown below: Figure 1.1: A Graph A graph (V 0;E0) is said to be a subgraph of another graph (V; E) if V 0 ⊆ V and E0 ⊆ E. A path is an sequence of edges that connect distinct vertices. A graph is said to be connected if there is a path between any pair of vertices, otherwise it is said to be disconnected. A graph can always be broken down into a set of connected subgraphs that are known as connected components of a graph. We will use the `Big-Oh' \O" in our analysis of algorithms. By saying that an algorithm is O(f(n)) in some 1-1 1-2 Lecture 1: July 24 input parameter n, we mean that as there exist constants c > 0 and n0 > 0 such that 8n > n0, the total units of time the algorithm would take to terminate will never be more than c ∗ f(n). 1.2 Definitions Walk: A walk in the graph G = (V; E) is a finite sequence of the form vi0 ; ej1 ; vi1 ; ej2 ; :::; ejk ; vik ; which consists of alternating vertices and edges of G such that all edges e in the sequence are incident on the vertices just before and just after in the sequence. vi0 is said to be the initial vertex and vik is said to be the terminal vertex. k is called the length of the walk. Trail:Trail is a walk in which there are no repeated edges. Path:Path is a walk in which there are no repeated vertices. Circuit:A circuit is a trail that begins and ends at the same vertex. Cycle: A cycle is a path that begins and ends at the same vertex. Tree: A graph with no cycles is termed a tree. A tree is said to be rooted if one special vertex has been designated the root and unrooted otherwise. Parent: A vertex v is a parent of w in a rooted tree v comes just before w in a path from root to w in the tree. Ancestor: A vertex v is a ancestor of w in a rooted tree if a path from root to w in the tree includes v. Descendant: A vertex v is a descendant of w if w is an ancestor of v in the tree. 1.3 Depth-first Search One of the most basic algorithm to traverse a graph (i.e., to visit all it's vertices and/or edges) is the depth first search(DFS). The basic idea of DFS is, as the name suggests, to search \deeper" in the graph wherever possible. It explores edges out of the most recently discovered vertex v that still has unexplored edges leaving it. After all the edges of v have been explored, the search \backtracks" to explore all the yet unexplored edges leaving the vertex from which v was discovered. When it discovers all the vertices that are reachable from the source vertex, it stops. For example, one of the possible ways in which the vertices of a graph could be explored by DFS is shown in Fig 1.2. The numbers indicate the order in which the vertex is visited. Figure 1.1: A DFS traversal For understanding DFS better let us define the concept of colouring of vertices. If a vertex is coloured white then it means it is not visited before. If it is coloured black then it has already been discovered. Lecture 1: July 24 1-3 Following is the pseudo code for DFS: DFS (G): for each vertex u 2 G:V u:color = WHITE for each vertex u 2 G:V if u:color == WHITE DFS-VISIT (G; u) DFS-VISIT (G , u): for each vertex v 2 G:Adj[u] if v:color == WHITE DFS-VISIT (G; v) u:color = BLACK Any implementation of the above algorithm defines a subset T of edges E. A edge (v; w) is said to be in T if while exploring this edge one of the vertices w was yet to be explored. This subset of edges constitutes a tree called the DFS-tree. The DFS-tree is rooted with its root at the `source' vertex of the DFS. It is proved in the following theorem that any of the non-tree edges of G connect an ancestor to a descendant in the DFS-tree. Theorem 1.1 All non-tree edges of G connect an ancestor to a descendant in the DFS-tree. Proof: Consider an edge (v; w) of the graph G. Without loss of generality, we can assume that v was visited before w during the DFS. That means when the DFS was called on v, the vertex w was still white. Also, DFS at v would not stop until all its neighbours were black. Since, w is a neighbour of v it implies that it would also be black after DFS at v is over and hence be a descendant of v in the DFS-tree. 1.4 Biconnectivity Having had an idea of depth-first search, we will now start with biconnectivity. As the name suggests, biconnectivity is like `connected twice over'. A more formal definition is as follows. A connected graph G is said to be biconnected if for all distinct triples of vertices v, w and a, there exists a path connecting v and w that does not go through a. In other words, the connection between v and w does not solely depend on a. There are other paths as well. Infact, every path has such `another' path to reach from its source to the destination. It directly follows from this that removal of any vertex (along with its incident edges) of G would split G into two connected components. This is true as we can take this vertex as our `a' and for any other pair of vertices there exists a path not containing a. This path would remain even after removal of a and thus the graph would remain connected. If the graph were not biconnected, so that there exist three distinct vertices v, w and a such that all paths from v to w passed through a, then the removal of a would have split the graph into atleast two connected components. The vertex a in this case would have been called an articulation vertex. We can say that a graph is biconnected if and only if it has no articulation points. Just like we defined the connected components of a graph we can similarly define the biconnected components of a graph. First, we define a relation R on the edges of a graph. Under R, edges e and f are related if 1-4 Lecture 1: July 24 either e = f of there exists a cycle that contains both e and f. That the relation is an equivalence relation is easy to see and prove. For each equivalence class Ei of this relation, we can also prove that the subgraph induced by it is biconnected. A subgraph of a graph G is said to be induced by a set E of edges if it's vertex set contains exactly those vertices of G that are incident on atleast one edge in E, and its edge set is the set E. Theorem 1.2 Each equivalence class of R induces a biconnected subgraph of G. Proof: Consider any triple v, w and a of vertices in G. Assume for the sake of contradiction that a is an articulation vertex and that all paths from v to w pass through a. Consider any such path. It would have exactly two edges that are incident on a (one `coming into' and the other `going out'). Since these are in the same biconnected component, there has to be a cycle containing these two edges (due to R). If we travel the other way round this cycle we can clearly `bypass' a and therefore create a path from v to w that does not have a.
Recommended publications
  • 1 Vertex Connectivity 2 Edge Connectivity 3 Biconnectivity
    1 Vertex Connectivity So far we've talked about connectivity for undirected graphs and weak and strong connec- tivity for directed graphs. For undirected graphs, we're going to now somewhat generalize the concept of connectedness in terms of network robustness. Essentially, given a graph, we may want to answer the question of how many vertices or edges must be removed in order to disconnect the graph; i.e., break it up into multiple components. Formally, for a connected graph G, a set of vertices S ⊆ V (G) is a separating set if subgraph G − S has more than one component or is only a single vertex. The set S is also called a vertex separator or a vertex cut. The connectivity of G, κ(G), is the minimum size of any S ⊆ V (G) such that G − S is disconnected or has a single vertex; such an S would be called a minimum separator. We say that G is k-connected if κ(G) ≥ k. 2 Edge Connectivity We have similar concepts for edges. For a connected graph G, a set of edges F ⊆ E(G) is a disconnecting set if G − F has more than one component. If G − F has two components, F is also called an edge cut. The edge-connectivity if G, κ0(G), is the minimum size of any F ⊆ E(G) such that G − F is disconnected; such an F would be called a minimum cut.A bond is a minimal non-empty edge cut; note that a bond is not necessarily a minimum cut.
    [Show full text]
  • CLRS B.4 Graph Theory Definitions Unit 1: DFS Informally, a Graph
    CLRS B.4 Graph Theory Definitions Unit 1: DFS informally, a graph consists of “vertices” joined together by “edges,” e.g.,: example graph G0: 1 ···················•······························· ····························· ····························· ························· ···· ···· ························· ························· ···· ···· ························· ························· ···· ···· ························· ························· ···· ···· ························· ············· ···· ···· ·············· 2•···· ···· ···· ··· •· 3 ···· ···· ···· ···· ···· ··· ···· ···· ···· ···· ···· ···· ···· ···· ···· ···· ······· ······· ······· ······· ···· ···· ···· ··· ···· ···· ···· ···· ···· ··· ···· ···· ···· ···· ···· ···· ···· ···· ···· ···· ··············· ···· ···· ··············· 4•························· ···· ···· ························· • 5 ························· ···· ···· ························· ························· ···· ···· ························· ························· ···· ···· ························· ····························· ····························· ···················•································ 6 formally a graph is a pair (V, E) where V is a finite set of elements, called vertices E is a finite set of pairs of vertices, called edges if H is a graph, we can denote its vertex & edge sets as V (H) & E(H) respectively if the pairs of E are unordered, the graph is undirected if the pairs of E are ordered the graph is directed, or a digraph two vertices joined by an edge
    [Show full text]
  • Efficient Multicore Algorithms for Identifying Biconnected Components
    International Journal of Networking and Computing { www.ijnc.org ISSN 2185-2839 (print) ISSN 2185-2847 (online) Volume 6, Number 1, pages 87{106, January 2016 Efficient Multicore Algorithms For Identifying Biconnected Components1 Meher Chaitanya [email protected] and Kishore Kothapalli [email protected] International Institute of Information Technology Hyderabad, Gachibowli, India 500 032. Received: July 30, 2015 Revised: October 26, 2015 Accepted: December 1, 2015 Communicated by Akihiro Fujiwara Abstract In this paper we design and implement an algorithm for finding the biconnected components of a given graph. Our algorithm is based on experimental evidence that finding the bridges of a graph is usually easier and faster in the parallel setting. We use this property to first decompose the graph into independent and maximal 2-edge-connected subgraphs. To identify the articulation points in these 2-edge connected subgraphs, we again convert this into a problem of finding the bridges on an auxiliary graph. It is interesting to note that during the conversion process, the size of the graph may increase. However, we show that this small increase in size and the run time is offset by the consideration that finding bridges is easier in a parallel setting. We implement our algorithm on an Intel i7 980X CPU running 12 threads. We show that our algorithm is on average 2.45x faster than the best known current algorithms implemented on the same platform. Finally, we extend our approach to dense graphs by applying the sparsification technique suggested by Cong and Bader in [7]. Keywords: Biconnected components, Least common ancestor, 2-edge connected components, Articulation points 1 Introduction The biconnected components of a given graph are its maximal 2-connected subgraphs.
    [Show full text]
  • Strongly Connected Components and Biconnected Components
    Strongly Connected Components and Biconnected Components Daniel Wisdom 27 January 2017 1 2 3 4 5 6 7 8 Figure 1: A directed graph. Credit: Crash Course Coding Companion. 1 Strongly Connected Components A strongly connected component (SCC) is a set of vertices where every vertex can reach every other vertex. In an undirected graph the SCCs are just the groups of connected vertices. We can find them using a simple DFS. This works because, in an undirected graph, u can reach v if and only if v can reach u. This is not true in a directed graph, which makes finding the SCCs harder. More on that later. 2 Kernel graph We can travel between any two nodes in the same strongly connected component. So what if we replaced each strongly connected component with a single node? This would give us what we call the kernel graph, which describes the edges between strongly connected components. Note that the kernel graph is a directed acyclic graph because any cycles would constitute an SCC, so the cycle would be compressed into a kernel. 3 1,2,5,6 4,7 8 Figure 2: Kernel graph of the above directed graph. 3 Tarjan's SCC Algorithm In a DFS traversal of the graph every SCC will be a subtree of the DFS tree. This subtree is not necessarily proper, meaning that it may be missing some branches which are their own SCCs. This means that if we can identify every node that is the root of its SCC in the DFS, we can enumerate all the SCCs.
    [Show full text]
  • Characterizing Simultaneous Embedding with Fixed Edges
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by computer science publication server Characterizing Simultaneous Embedding with Fixed Edges J. Joseph Fowler1, Michael J¨unger2, Stephen G. Kobourov1, and Michael Schulz2 1 University of Arizona, USA {jfowler,kobourov}@cs.arizona.edu ⋆ 2 University of Cologne, Germany {mjuenger,schulz}@informatik.uni-koeln.de ⋆⋆ Abstract. A set of planar graphs share a simultaneous embedding if they can be drawn on the same vertex set V in the plane without crossings between edges of the same graph. Fixed edges are common edges between graphs that share the same Jordan curve in the simultaneous drawings. While any number of planar graphs have a simultaneous embedding without fixed edges, determining which graphs always share a simultaneous embedding with fixed edges (SEFE) has been open. We partially close this problem by giving a necessary condition to determine when pairs of graphs have a SEFE. 1 Introduction In many practical applications including the visualization of large graphs and very-large-scale in- tegration (VLSI) of circuits on the same chip, edge crossings are undesirable. A single vertex set can suffice in which multiple edge sets correspond to different edge colors or circuit layers. While the union of any pair of edge sets may be nonplanar, a planar drawing of each layer may still be possible, as crossings between edges of distinct edge sets is permitted. This corresponds to the problem of simultaneous embedding (SE). Without restrictions on the types of edges used, this problem is trivial since any number of planar graphs can be drawn on the same fixed set of vertex locations [6].
    [Show full text]
  • Near-Linear Time Constant-Factor Approximation Algorithm for Branch-Decomposition of Planar Graphs
    Near-Linear Time Constant-Factor Approximation Algorithm for Branch-Decomposition of Planar Graphs1 Qian-Ping Gu and Gengchun Xu School of Computing Science, Simon Fraser University Burnaby BC Canada V5A1S6 [email protected],[email protected] Abstract: We give an algorithm which for an input planar graph G of n vertices and integer k, in min{O(n log3 n),O(nk2)} time either constructs a branch-decomposition of G k+1 with width at most (2 + δ)k, δ > 0 is a constant, or a (k + 1) × ⌈ 2 ⌉ cylinder minor of G implying bw(G) >k, bw(G) is the branchwidth of G. This is the first O˜(n) time constant- factor approximation for branchwidth/treewidth and largest grid/cylinder minors of planar graphs and improves the previous min{O(n1+ǫ),O(nk2)} (ǫ> 0 is a constant) time constant- factor approximations. For a planar graph G and k = bw(G), a branch-decomposition of g k width at most (2 + δ)k and a g × 2 cylinder/grid minor with g = β , β > 2 is constant, can be computed by our algorithm in min{O(n log3 n log k),O(nk2 log k)} time. Key words: Branch-/tree-decompositions, grid minor, planar graphs, approximation algo- rithm. 1 Introduction The notions of branchwidth and branch-decomposition introduced by Robertson and Sey- mour [31] in relation to the notions of treewidth and tree-decomposition have important algorithmic applications. The branchwidth bw(G) and the treewidth tw(G) of graph G 3 are linearly related: max{bw(G), 2} ≤ tw(G)+1 ≤ max{⌊ 2 bw(G)⌋, 2} for every G with more than one edge, and there are simple translations between branch-decompositions and tree-decompositions that meet the linear relations [31].
    [Show full text]
  • Number One Is in NC
    数理解析研究所講究録 第 790 巻 1992 年 155-161 155 Deciding whether Graph $G$ Has Page Number One is in NC 増山 繁 (豊橋技術科学大学知識情報工学系) Shigeru MASUYAMA Department of Knowledge-Based Information Engineering Toyohashi University of Technology Toyohashi 441, Japan 内藤昭三 (NTT 基礎研究所) Shozo NAITO Basic Research Laboratories NTT Musashino 180, Japan Abstract Based on a forbidden subgraph characterization of a graph to have one page, we develop a polylog time algorithm to tell if page number of given graph $G$ is one with polynomial number of processors, clarifying this problem to be in NC. 1 Introduction is crossing when they are drawn on the same side of the linear arrangement of vertices. Similar problem setting ap- This paper discusses the problem of pears in the formulation of the non- deciding whether the given graph is crossing constraint on word modifica- noncrossing, where graph $G$ is non- tion to sentence generation in natural crossing if there exists a linear arrange- language processing, which motivates ment of vertices so that no pair of edges 156 us to study this problem. are undirected and may have multiple This problem is a specialization of edges. We also assume that a path the book embedding[12] in the sense denotes a simple path throughout this that this problem asks if the given paper. CREW PRAM (see e.g., [5]) graph has page number one, i.e., a is adopted as a parallel computation graph can be embedded in a single model. page. In general, the book embedding is hard: it is NP-complete to tell if a 2 Forbidden Sub- planar graph can be embedded in two graph Characterization of a pages [3].
    [Show full text]
  • DISSERTATION GENERALIZED BOOK EMBEDDINGS Submitted By
    DISSERTATION GENERALIZED BOOK EMBEDDINGS Submitted by Shannon Brod Overbay Department of Mathematics In partial fulfillment of the requirements for the degree of Doctor of Philosophy Colorado State University Fort Collins, Colorado Summer 1998 COLORADO STATE UNIVERSITY May 13, 1998 WE HEREBY RECOMMEND THAT THE DISSERTATION PREPARED UNDER OUR SUPERVISION BY SHANNON BROD OVERBAY ENTITLED GENERALIZED BOOK EMBEDDINGS BE ACCEPTED AS FULFILLING IN PART REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSO- PHY. Committee on Graduate Work Adviser Department Head ii ABSTRACT OF DISSERTATION GENERALIZED BOOK EMBEDDINGS An n-book is formed by joining n distinct half-planes, called pages, together at a line in 3-space, called the spine. The book thickness bt(G) of a graph G is the smallest number of pages needed to embed G in a book so that the vertices lie on the spine and each edge lies on a single page in such a way that no two edges cross each other or the spine. In the first chapter, we provide background material on book embeddings of graphs and preview our results on several related problems. In the second chapter, we use a theorem of Bernhart and Kainen and a result of Whitney to present a large class of two-page embeddable planar graphs. In particular, we prove that a graph G that can be drawn in the plane so that G has no triangles other than faces can be embedded in a two-page book. The discussion of planar graphs continues in the third chapter where we define a book with a tree-spine.
    [Show full text]
  • Schematic Representation of Large Biconnected Graphs?
    Schematic Representation of Large Biconnected Graphs? Giuseppe Di Battista, Fabrizio Frati, Maurizio Patrignani, and Marco Tais Roma Tre University, Rome, Italy fgdb,frati,patrigna,[email protected] Abstract. Suppose that a biconnected graph is given, consisting of a large component plus several other smaller components, each separated from the main component by a separation pair. We investigate the existence and the computation time of schematic representations of the structure of such a graph where the main component is drawn as a disk, the vertices that take part in separation pairs are points on the boundary of the disk, and the small components are placed outside the disk and are represented as non-intersecting lunes connecting their separation pairs. We consider several drawing conventions for such schematic representations, according to different ways to account for the size of the small components. We map the problem of testing for the existence of such representations to the one of testing for the existence of suitably constrained 1-page book-embeddings and propose several polynomial-time algorithms. 1 Introduction Many of today's applications are based on large-scale networks, having billions of vertices and edges. This spurred an intense research activity devoted to finding methods for the visualization of very large graphs. Several recent contributions focus on algorithms that produce drawings where either the graph is only partially represented or it is schematically visualized. Examples of the first type are proxy drawings [6,12], where a graph that is too large to be fully visualized is represented by the drawing of a much smaller proxy graph that preserves the main features of the original graph.
    [Show full text]
  • Planarity Testing and Embedding
    1 Planarity Testing and Embedding 1.1 Introduction................................................. 1 1.2 Properties and Characterizations of Planar Graphs . 2 Basic Definitions • Properties • Characterizations 1.3 Planarity Problems ........................................ 7 Constrained Planarity • Deletion and Partition Problems • Upward Planarity • Outerplanarity 1.4 History of Planarity Algorithms.......................... 10 1.5 Common Algorithmic Techniques and Tools ........... 10 1.6 Cycle-Based Algorithms ................................... 11 Adding Segments: The Auslander-Parter Algorithm • Adding Paths: The Hopcroft-Tarjan Algorithm • Adding Edges: The de Fraysseix-Ossona de Mendez-Rosenstiehl Algorithm 1.7 Vertex Addition Algorithms .............................. 17 The Lempel-Even-Cederbaum Algorithm • The Shih-Hsu Algorithm • The Boyer-Myrvold Algorithm 1.8 Frontiers in Planarity ...................................... 31 Simultaneous Planarity • Clustered Planarity • Maurizio Patrignani Decomposition-Based Planarity Roma Tre University References ................................................... ....... 34 1.1 Introduction Testing the planarity of a graph and possibly drawing it without intersections is one of the most fascinating and intriguing algorithmic problems of the graph drawing and graph theory areas. Although the problem per se can be easily stated, and a complete characterization of planar graphs has been known since 1930, the first linear-time solution to this problem was found only in the 1970s. Planar graphs
    [Show full text]
  • 286 Graphs 6.2.5 Biconnected Components
    l 286 Graphs 6.2.5 Biconnected Components The operations that we have implemented thus far are simple extensions of depth first and breadth first search. The next operation we implement is more complex and requires the introduction of additional terminology. We begin by assuming that G is an undirected connected graph. An articulation point is a vertex v of G such that the deletion of v, together with all edges incident on v, produces a graph, G', that has at least two connected com­ ponents. For example, the connected graph of Figure 6.19 has four articulation points, vertices 1,3,5, and 7. A biconnected graph is a connected graph that has no articulation points. For example, the graph of Figure 6.16 is biconnected, while the graph of Figure 6.19 obvi­ ously is not. In many graph applications, articulation points are undesirable. For instance, suppose that the graph of Figure 6.19(a) represents a communication network. In such graphs, the vertices represent communication stations and the edges represent communication links. Now suppose that one of the stations that is an articulation point fails. The result is a loss of communication not just to and from that single station, but also between certain other pairs of stations. A biconnected component of a connected undirected graph is a maximal bicon­ nected subgraph, H, of G. By maximal, we mean that G contains no other subgraph that is both biconnected and properly contains H. For example, the graph of Figure 6.19(a) contains the six biconnected components shown in Figure 6.19(b).
    [Show full text]
  • Planar Branch Decompositions I: the Ratcatcher
    INFORMS Journal on Computing informs Vol. 17, No. 4, Fall 2005, pp. 402–412 ® issn 1091-9856 eissn 1526-5528 05 1704 0402 doi 10.1287/ijoc.1040.0075 © 2005 INFORMS Planar Branch Decompositions I: The Ratcatcher Illya V. Hicks Department of Industrial Engineering, Texas A&M University, College Station, Texas 77843-3131, USA, [email protected] he notion of branch decompositions and its related connectivity invariant for graphs, branchwidth, were Tintroduced by Robertson and Seymour in their series of papers that proved Wagner’s conjecture. Branch decompositions can be used to solve NP-hard problems modeled on graphs, but finding optimal branch decom- positions of graphs is also NP-hard. This is the first of two papers dealing with the relationship of branchwidth and planar graphs. A practical implementation of an algorithm of Seymour and Thomas for only computing the branchwidth (not optimal branch decomposition) of any planar hypergraph is proposed. This implementation is used in a practical implementation of an algorithm of Seymour and Thomas for computing the optimal branch decompositions for planar hypergraphs that is presented in the second paper. Since memory requirements can become an issue with this algorithm, two other variations of the algorithm to handle larger hypergraphs are also presented. Key words: planar graph; branchwidth; branch decomposition; carvingwidth History: Accepted by Jan Karel Lenstra, former Area Editor for Design and Analysis of Algorithms; received December 2002; revised August 2003, January 2004; accepted February 2004. 1. Introduction Seymour conceived of two new ways to decompose a A planar graph is a graph that canbe drawnona graph that were beneficial toward the proof.
    [Show full text]