An Experimental Comparison of Parallel Algorithms for Ear Decomposition of Graphs Using Two Leading Paradigms D.A
Total Page:16
File Type:pdf, Size:1020Kb
View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by University of New Mexico University of New Mexico UNM Digital Repository Electrical & Computer Engineering Technical Engineering Publications Reports 5-1-2000 An Experimental Comparison of Parallel Algorithms for Ear Decomposition of Graphs using Two Leading Paradigms D.A. Bader A.K. Illendula Follow this and additional works at: https://digitalrepository.unm.edu/ece_rpts Recommended Citation Bader, D.A. and A.K. Illendula. "An Experimental Comparison of Parallel Algorithms for Ear Decomposition of Graphs using Two Leading Paradigms." (2000). https://digitalrepository.unm.edu/ece_rpts/2 This Technical Report is brought to you for free and open access by the Engineering Publications at UNM Digital Repository. It has been accepted for inclusion in Electrical & Computer Engineering Technical Reports by an authorized administrator of UNM Digital Repository. For more information, please contact [email protected]. DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING SCHOOL OF ENGINEERING UNIVERSITY OF NEW MEXICO An Experimental Comparison of Parallel Algorithms for Ear Decomposition of Graphs using Two Leading Paradigms David A. Bader 1 Ajith K. Illendula2 UNM Technical Report: EECE-TR-00-002 Report Date: May 1, 2000 1Supported in part by NSF Grant DEB 99-10123 and Department of Energy Sandia-University New Assistant Professor- ship Program (SUNAPP) Award # AX-3006. e-mail: [email protected] 2Supported by a UNM Albuquerque High Performance Computing Center Research Assistantship. e-mail: [email protected] Abstract Graph decomposition is an important and necessary operation when solving graph-theoretic problems on parallel computers, for instance, from computational fluid dynamics, mechanics, and astrophysics. In this paper, we design and analyze message-passing and shared-memory parallel algorithms that efficiently decompose a planar graph into a number of ears, known as the Ear Decomposition. This decomposition provides a general framework for solving graph problems efficiently in parallel. Our study includes both theoretical analysis and confirmation of the complexity cost using two leading parallel programming paradigms, namely, message-passing (MPI) and shared-memory (SMP) implementations. A catalog of both regular and irregular input graphs are provided to benchmark these algorithms in our empirical study. Keywords Parallel Algorithms, Symmetric Multiprocessors (SMP), Shared Memory, Message Passing Interface (MPI), Experimental Parallel Algorithmics. UNM Technical Report: EECE-TR-00-002 1 Introduction The efficient parallel solution of many computational problems often requires the invention and use of original, novel approaches radically different from those used to solve the same problem sequentially. Graph-traversal methods are useful mainly because they induce a decomposition of the graph into a structured set of simple components. Depth-first search and breadth-first search are two such methods that have been found to be effective in handling many graph-theoretic problems. However, no efficient parallel implementations of these two methods are known. To compensate for the lack of such methods, the technique of ear decomposition, which does have ; µ an efficient parallel implementation is often used [21]. Let G =´V E be an undirected graph with no cycles or j j j multiple edges, and let n = j V and m = E . Throughout this paper, every path and cycle is simple. We will also assume that the graph G is connected. An ear decomposition of G is a partition of the graph’s edge set into ;::: ; an ordered collection of paths Q0 ; Q1 Qr, called ears, such that following properties hold: ¯ Q0 is a cycle called the root ear. ; ´ > µ < ¯ Each endpoint of Qi i 0 , is contained in any Q j, for j i. ; ´ > µ < ¯ No internal vertex of Qi i 0 , is contained in any Q j, for j i. If the endpoints of the ear do not coincide, then the ear is open; otherwise, the ear is closed.Anopen ear decom- ´ > µ position of a graph G is an ear decomposition of G in which every ear Q i ; i 0 , is open. Some observations, which are true for both open and closed ear decomposition, follow from the definitions: ¯ An edge is contained in exactly one ear. ¯ A vertex is contained in one or more ears. ¯ A vertex is an internal vertex of exactly one ear, where we consider the root ear’s internal vertices to be all its vertices.[18] Whitney first studied open ear decomposition and showed that a graph G has an open ear decomposition if and only if G is biconnected [32]. Lov´asz showed that the problem of computing an open ear decomposition in parallel is in NC [23, 10]. 1 UNM Technical Report: EECE-TR-00-002 The main results in this paper are 1. Practical parallel algorithms for Ear Decomposition on distributed- and shared-memory parallel machines, 2. A fast and scalable shared-memory implementation whose performance is best known to the authors, and 3. A methodology for empirically testing parallel graph algorithms using a collection of regular and irregular planar input graphs. The organization of the paper is as follows.We will first give a sequential algorithm for ear decomposition in Section 2. Section 3 discusses parallel approaches for this problem using the idealistic Parallel Random Access Machine (PRAM) model, and two more realistic paradigms, for message-passing and shared-memory architec- tures. We experimentally test our algorithms on a variety of inputs, described in Section 4, and offer some conclusions on our results. 2 Sequential Algorithm In this section, we give a well-known sequential algorithm for ear decomposition [19, 24, 27, 25]. There are five major steps in this algorithm. First, a spanning tree is found for the graph, a root vertex is arbitrarily chosen, and each vertex is then assigned a level and parent using the spanning tree. Next, the non-tree edges are examined and uniquely labeled. Finally the tree edges are assigned ear labels. Fig. 1 shows an example of ear decomposition ; µ on a graph with eight vertices. For a graph G =´V E , Alg. 1 outlines the sequential approach. 0 e0 e1 7 1 e4 Q 0 1 2 11 e Q 0 6 0 Q 1 Q 0 e3 e10 Q 2 Q 4 3 e2 e5 5 Q 2 5 1 2 3 4 e0 e7 e9 Q 4 Q e3 e6 Q 1 Q 3 e6 e8 4 7 4 e4 e8 4 e2 Q 1 0 e7 e9 6 e1 3 e11 e10 7 6 5 e5 Ear Decomposition of G 2 ; µ The Original Graph G =´V E Spanning Tree of G ; µ Figure 1: On the left, we show the original graph G =´V E , and the spanning tree of the graph G. On the right is the ear decomposition of G.Itisnotopen ear decomposition because Q 4 is a cycle. The spanning tree T of a graph G in Step (1) can be found in O(m · n) time. Step (2) can be done using the Euler tour technique in O(n) time. In Step (3), LCA(e) refers to the least common ancestor of an edge e. Step (3) can be performed within the asymptotic bounds of Step (1). The label of tree edges can be found in O(m) time. · µ Steps (5) and (6) can be done in O(´m n logn) time. Therefore the complexity of the sequential algorithm is · µ j j j j O(´m n logn), where the number of vertices n = V and the number of edges m = E . 3 Parallel Algorithms In Section 3.1 we first discuss a parallel algorithm for ear decomposition using the PRAM model [19]. Because of idealistic assumptions in the PRAM model, we find that the PRAM approach does not readily adapt to real parallel architectures. In Sections 3.2 and 3.3, we design more realistic parallel algorithms for the two leading parallel 2 UNM Technical Report: EECE-TR-00-002 Step (1): Find a spanning tree T of G. = Step (2): Root T at an arbitrary vertex r, and compute level(v) and p(v), for each vertex v6 r, where level(v) and p(v) are the level and parent of v respectively. ; µ ; Step (3): For each nontree edge e=´u v , compute LCA(e) = LCA(u v) and level(e) = level(LCA(e)). Set label(e) = (level(e),s(e)), where s(e) is the serial number of e. Step (4): For each tree edge g, compute label(g). g[f ¾ j g Step (5): For each tree edge e, set Qe=fe g T label(g)=label(e) . Step (6): Sort the Qe’s by label(e). Algorithm 1: Sequential Algorithm for Ear Decomposition. computing paradigms, namely message-passing and shared-memory. In our parallel algorithms, we assume, without loss of generality, that the number of processors is a power of two and that number of processors evenly divides the number n of vertices in the input graph. 3.1 PRAM Algorithm The PRAM algorithm for ear decomposition [24] uses an approach to that of the sequential algorithm but applies concurrent operations whenever possible. We next analyze the complexity bounds of the algorithm using the Concurrent-Read Exclusive-Write (CREW) PRAM Model [19]. Step (1) requires a spanning tree algorithm, which can be found in time O(logn), using O(n · m) processors. The tree can be rooted and levels and parents found in Step (2) by using the Euler-tour technique after the input representation has been modified to support this technique. Step (3) requires the LCA algorithm and can be performed within the same asymptotic bounds of Step (1). µ f ´ ; µ j ´ ; µ g The labels in Step (4) can be found as follows.