A Random NC Algorithm for Depth First Search

A Random NC Algorithm for Depth First Search

A Random NC Algorithm for Depth First Search Alok Aggarwal * IBM T. J. Watson Center, P. 0. Box 218 Yorktown Heights, New York 10598, USA Richard J. Anderson Department of Computer Science, FR-35 University of Washington, Seattle, WA 98195, USA Abstract ing depth first search in parallel has been con- sidered by a number of authors [RC78], [EA77], In this paper we present a fast parallel algorithm [Rei85], [And871 and has been conjectured to for constructing a depth first search tree for an be inherently sequential. The question as to undirected graph. The algorithm is an Rn/C al- whether depth first search could be performed gorithm, meaning that it is a probabilistic al- by a fast parallel algorithm was raised by Wyllie gorithm that runs in polylog time using a poly- [WY1791 in his ground breaking thesis. nomial number of processors on a P-RAM. The run time of the algorithm is O(Z’~~(n)log~n), Depth first search is a very important tech- and the number of processors used is PM&~) nique for sequential computation. It has been where TMM(~) and PMM(~) are the time and used in the construction of a large number of number of processors needed to find a minimum efficient sequential algorithms [Tar72]. How- weight perfect matching on an 12 vertex graph ever, depth first search seems to be sequential with maximum edge weight n. in nature. It is known that computing the lex- icographicaJly first depth first search tree is P- complete [Rei85]. This is the depth first search 1 Introduction tree found by the “natural” greedy algorithm. However, there are a number of problems, such In this paper we present a fast parallel algorithm as maximal independent set [KW85], [Coo85], for constructing a depth first search tree of an where computing the lexicographically minimal undirected graph. This is the first 7w/C algor- solution is P-complete, while a solution can be ithm for the problem. The problem of perform- found in h/C or RNC. The main question that ‘This work was was done while the authors were visit- we investigate in this paper is whether the pro- ing the Mathematical Sciences Research Institute, Berke- cess of depth first search is inherently sequential ley, California. Aggarwal was supported in part by NSF or is it possible to perform a depth first search grant 8120790 and Anderson was supported by Air Force with a fast parallel algorithm. Grant AFOSR-85-0203A. The only cases where n/C algorithms are known for depth first search are for restricted classes of graphs. For example, depth first search Permission to copy without fee all or part of this material is granted can be done in planar graphs [Smi86] and di- provided that the copies are not made or distributed for direct rected acyclic graphs [Ram85], [GB84] with NC commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying algorithms. A problem that is related to depth is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or speck permission. 0 1987 ACM O-89791-221-7/87/0006-0325 75G 325 first search that has investigated previously by 2 Notational Conventions the second author is t.he probl.em of finding a branch of a depth first search tree. This prob- In our algorithm we work extensively with paths lem is known as the maximal path problem.. The and vertices. We often use a set of vertices to de- maximal path problem can be solved by a rather note an induced subgraph wherein the edges are complicated RNC algorithm [And87]. This is inherited from the graph G = (V, E). .A path is another example of a problem where computing an ordered set of distinct vertices p = pr, . , pk the lexicographically first solution is P-Complete with edges (pi,pi+r) E E for 1 < 2: < k. Pa.ths [AM84], but a different approach gives a fast par- are sometimes viewed as being directed. A lower allel algorithm. segment of p is a subpath pl, . , pj and au upper segment is a subpath pj,. ,pk. The algorithm maintains several sets of vertex disjoi:nt paths. The algorithm presented in th.is paper is a sub- For a set of paths Q = {ql,. ,qm}, we use IQ] stantial improvement over previously known par- to denote the number of paths. We occasionally allel algorithms for depth first search. The best mix notation and refer to sets of vertices and previously published result was an O(n1j2) algor- paths in the same expression. In particular, if p ithm [And87]. That result had bleen improved to is a path and Q is a set of paths, V - p denotes W ‘*) [And861 p rior to this result. Similar the induced subgraph after all vertices on p have techniques are used in all three of these algo- been removed, and V - Q denotes the induced rithms. In particular, an important step in the subgraph after all vertices contained in paths in algorithms is to construct sets of disjoint paths. Q have been removed. The paths are constructed by using network flow techniques which in turn use matching. T:he re- sult that made these algorithms possible was the 3 Overview of the Algorithm RNC algorithm for matching ,[KUW86]. The only use of randomness in the algorithms has Our depth first search algorithm is a divide and been the reliance on probabilistic subroutines for conquer algorithm. A portion of a depth first matching. If matching could be solved in NC, search tree is constructed which allows the prob- then depth first search could also be solved in lem to be reduced to finding depth first search NC. trees in graphs of less than half the original size. The depth of recursion is log n. An Initial Segment is a rooted subtree T’ t.hat The depth first search problem is: given a can be extend.ed to some depth first search tree graph G = (V, E) and a vertex T, construct a T. We give an algorithm which constructs a.n ini- tree T that corresponds to a depth first search tial segment T’ with the property that the largest of the graph starting from the vertex T. There connected component of V - T’ has size at most are a number of different ways to characterize a f. The initial segment has root r. depth first search tree. One of them is: 2’ is a An initial segment T’ can be extended to a depth first search tree if and only if for all non- depth first search tree in the following manner. tree edges (u, VJ),u and v lie on the same branch Let C be a connected component of V - T’. of the tree. There is a unique vertex z E T’ of greatest depth that is adjacent to some vertex of C. Let y E C In this paper, we only address the problem be adjacent to 2. Construct a depth first search of depth first search for undirected graphs. It tree for C rooted at y and then connect it to T’ is unclear whether or not our lmethods can be by an edge from x to y. This construction can generalized to directed graphs. be performed independently for each connected 326 component of V - T’. the initial segment, is performed. It would have Since the problem size is reduced by at least been desirable to reduce the separator to just a half at each stage, the depth of recursion is at single path, and then use it as a branch of the most logn. The time for a stage is dominated depth first search tree, but that has difficulties by the time to construct an initial segment. The for a couple of reasons. First, the routine Reduce run time for the full algorithm is thus log n times only guarantees a reduction if it is sufficiently the time to construct an initial segment. big. Second, in order to use a single path in the The algorithm that constructs an initial seg- depth first search tree, it would be necessary to ment consists of two parts. A set Q of vertex dis- have the vertex r as one of the endpoints of the joint paths is said to be a sepamtor if the largest path. It is possibie to change the endpoint of a connected component of V - Q has size at most single path that is a separator, but the method is 3. This follows the standard graph theoretic use essentially the same as the routine to construct of the term [LT79]. The first part of the algor- the initial segment. ithm is to construct a separator Q, where the number of paths in Q is bounded by a fixed con- stant. The second part is to construct an initial 5 Reducing the number of segment from the separator Q. The first part, paths constructing a small separator is the most sig- nificant part. The second part arises primarily We now describe the main routine Reduce. The from technical considerations, and is an adap- basic idea is to join the paths of Q by finding tation of a routine from the earlier depth first vertex disjoint paths between them. This allows search algorithm [And87]. The next three sec- paths of Q to be combined in pairs so that their tions cover the construction of the small separa- number is reduced. The disjoint paths are found tor and then the following section describes how by using a parallel subroutine for matching.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us