P. 1
10.1.1.43.6948

10.1.1.43.6948

|Views: 10|Likes:
Published by Piyush Kapoor

More info:

Published by: Piyush Kapoor on May 06, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/06/2012

pdf

text

original

Determining Single Connectivity in Directed Graphs

Adam L. Buchsbaum1 Martin C. Carlisle2 Research Report CS-TR-390-92 September 1992

Abstract
In this paper, we consider the problem of determining whether or not a directed graph contains a pair of vertices connected by two distinct simple paths; if it does not, we say it is singly connected. A straightforward implementation using n depth

National Science Foundation Grant No. 2 Supported by a National Science Foundation Graduate Fellowship and the Fannie and John Hertz Foundation. and the Center for Discrete Mathematics and Theoretical Computer Science (DIMACS) under NSF-STC88-09648. m-arc digraph. we obtain an O(n2 ) time algorithm by using contraction wherever possible. 1 Supported . by a Fannie and John Hertz Foundation fellowship. CCR-8920505.rst searches requires O(nm) time on an n-vertex.

This paper investigates a di erent sort of connectivity problem: determining if a graph has at most some number of distinct paths between every pair of vertices.e. 21]) or if a directed graph possesses analogous properties (see. 8. there exists at most one simple (no vertex repeated) path connecting them. [5.) Note that the undirected version of this problem is trivial: An undirected graph is singly connected if and only if it is a tree.. A simple algorithm for solving this decision problem is to perform a depth . In particular. 17. e. 16]). 15. the graph is not singly connected. To date.or edge-disjoint paths between every pair of vertices (see..or arc-disjoint) simple paths connecting any two vertices. 14. if there are two distinct (but not necessarily vertex. 12. a graph which is merely one simple cycle is singly connected. Multiple paths via cycles are allowed (in particular. three. 7. or more vertex.1 Introduction Graph connectivity has become a widely studied component of graph theory. most of the work in this area has dealt with determining if an undirected graph contains at least two. 11. i.. This problem originally appears in [4]. The directed problem in some sense is equivalent to checking the graph to see if it contains any redundant paths.g. 20.g. we say a directed graph is singly connected if for any pair of vertices. e. [5.

(We use depth . terminating the DFS after it visits all vertices reachable from the start vertex.rst search (DFS) starting from each vertex.

) If the same vertex is encountered along two di erent simple paths from the initial vertex. we may conclude that the graph is not singly connected. 4] in this paper.rst search terminology from [1. if we do not . Similarly.

The problem is resolving the inter-tree cross arcs to determine if they produce forbidden multiple simple paths. yielding a total cost of O(nm) time. it yields no asymptotic improvement for sparse graphs. This algorithm is optimal for dense graphs as in the worst case we must consider every arc. The running time is therefore O(n2) for sparse graphs and O(n3 ) for dense graphs. (We assume the graphs are connected in the undirected sense. then the graph is singly connected. m-arc directed graph. again this can potentially require O(nm) time. The question thus reduces to determining whether or not there are any forward or cross arcs in any of the DFS trees. In the following sections. we give an O(n2) algorithm for the single connectivity decision problem for directed graphs.nd such a case for any initial vertex. each of which in the worst case requires O(m) operations.) An alternative approach performs one complete DFS starting from any vertex. yielding a DFS forest possibly with multiple tree roots. However. this naive algorithm uses n occurrences of DFS. Given an n-vertex.1 De. 1.

: : : . : : : . 0  i < l. 8i 6= j . Two paths (u0 . A path is a simple path if ui 6= uj . [22].. vl) are distinct if either (1) k 6= l. A) with n = jV j and m = jAj. : : : . 0  i < j < l. uk ) and (v0 .g. ul) such that u0 = ul . Note that this di ers from the standard de. a chord is a path of arcs. e. ui+1 ) 2 A. a path connecting two vertices u. v 2 V is a sequence of nodes (u = u0 . : : : . In particular. Given some cycle. A cycle is a path (u0. ul) such that ui 6= uj . none of which is on the cycle. ul = v ) such that (ui . see.nitions We use standard graph terminology. a simple cycle is a cycle (u0. u1. : : : . given a directed graph (digraph) G = (V. or (2) k = l and ui 6= vi for some 0  i  l. connecting two distinct nodes of the cycle.

13]).g.nition of a chord being an arc connecting two nonadjacent nodes of a cycle (see. e.. for a single arc to be a chord by our de. [2.

nition. however. 1 . it must in fact connect two nonadjacent nodes of the cycle.

De.

We note that cycles are permitted in the graph. For the remainder of this paper. there cannot be two or more distinct (but possibly not vertex. all graphs are assumed to be directed and connected in the undirected sense.or arc-disjoint) simple paths between any pair of vertices. However. there exists at most one simple path connecting u and v . 2 Algorithm for Determining Single Connectivity In this section. A) is singly connected if and only if for any two vertices V . therefore n 0 1  m  n(n 0 1).nition 1. and that there may in fact be more than one path between some pair of vertices in a singly connected digraph. v 2 A digraph G = (V . we .1 u.

since each vertex in the cycle is reachable from every other vertex by a simple path. ideally we would like to contract each cycle (i. and the tree path to w catenated with the arc (w. Then (ui . there are two paths from the root of the DFS tree to x. Let i = max j < l j (uj .rst prove certain aspects of the naive algorithm. : : : . whereas contracting a cycle in a digraph preserves connectivity. tk = x) be the path in T from v to x. it does not always preserve single connectivity. ui+1) is a forward arc if ui = tj for some j and a cross arc otherwise. we show how we can use contraction to improve the performance of the algorithm. a cycle would appear to be equivalent to a single vertex. First. Consider the DFS tree T rooted at v . I.1 If G is not singly connected. Also. x). if there is a cross arc (w. but contracting the cycle leaves only a single vertex which by de. Then. namely the tree path and the forward arc. we show this condition is not only sucient but also necessary: Lemma 2.. However. x) then there are two paths from w to x. This clearly follows since if there is a forward arc (w. : : : . consider the digraph consisting only of a cycle with a chordal arc. x).. (ui+1 . Proof: Since G is not singly connected there exist v. we note that the existence of forward or cross arcs within a DFS tree implies that the graph is not singly connected.e. ul = x) be some o n path in G distinct from P . checking only for forward or cross arcs. Intuitively. ul) 6= (tk0(l0i) . uj +1) 6= (tk0(l0j ). namely the tree path to x.e. Thus. building on these. : : : . In the following lemma. a a a a We now consider the e ect of cycles on single connectivity. tk ). tk0(l0j )+1 ) . x 2 V (G) such that two distinct simple paths connect v to x. then for some v 2 V . tk ). but (ui . Let P = (v = 0 t0 . the DFS tree rooted at v has a forward or cross arc. : : : . and let P = (v = u0 . : : : . ul) = (tk0(l0i)+1 . all the arcs forming each cycle) to a single vertex and run the naive algorithm on the reduced graph. the graph itself is not singly connected. For example. : : : .

i. note that if a graph has a chord. In fact. A multiple arc of G3 is a repeated arc between two distinct vertices in G3 ..) Now consider the strongly connected components of G. Again. Let G3 be the graph formed by contracting each strongly connected component of G into a single vertex and removing loop arcs.e.nition is singly connected. formed by contracting arcs joining two nodes in the same strongly connected component of G. formed if more than one arc connected two strongly connected 2 . arcs from a vertex to itself in G3. chords play a decisive role in determining when cycle contraction is useful. it is not singly connected (the chord from x to y and the cycle path from x to y are two distinct simple paths from x to y .

at most one of Px and Py can be the null path. 3 has no multiple arcs. Let X (rsp. y 00) and the path formed by catenating the arc (x0 . ul1 = y ) and = (x = v0 . y ). : : : . The multiple arcs in G arise from two arcs (x . y 0) with Py demonstrate two distinct simple paths joining x0 to y 00 in G. Y ) be the strongly connected 3 3 component of G (and its respective vertex in G3) containing x (rsp. the strongly connected components of G that contract to x and 3 3 0 0 00 00 y in G . We can assume without loss of generality that P1 and P2 are vertex-disjoint.components in G. Let X and Y be. and let Py be the path in G from y 0 to y 00. : : : . then G is singly connected if a a a a Proof: P2 Suppose G is not singly connected. Let P1 and P2 be 3 from X to Y that result from the contraction applied to P1 and P2. y 00 2 V (Y ).3 If G has no chords and G is singly connected. Lemma 2. the . vl2 = y ) be two distinct simple paths from x to y in G. Proof: 3 and only if G Lemma 2. Since the paths in G 3 G contains no multiple arcs. y ) and (x . respectively. Let x and y be two vertices in G3 connected by multiple arcs (from x to y ). or P2 would yield a chord of the cycle formed by catenating a path from y to x with P1 . It must be that x and y are in di erent strongly connected components of G. It may be the case that either x0 = x00 or y 0 = y 00. y ) in G such that 0 . then G is not singly connected. and let P1 = (x = u0 . x00 2 V (X ) and y 0 . Let Px be the path in G from x0 to x00.2 If G3 has a multiple arc. but x both pairs cannot be equal. The following two lemmas relate the single connectivity of G to that of 3 G . Now the path formed by catenating Px with the arc (x00.

rst arc of P1 must di er from that of P2 .2 and 2. and let P1 and P2 be two simple paths connecting two vertices X and Y in G. By replacing each vertex in the two paths by an appropriate path in the respective strongly connected component in G.3 to reduce the graph G to an acyclic graph G3 and then run a depth . and thus P1 and P2 are distinct simple paths in G3 . We can use Lemmas 2. these give rise to two simple paths connecting some x and y in G. 3 3 Suppose G3 is not singly connected.

rst search from each vertex of G3 to determine single connectivity. If G3 has a multiple arc. Otherwise For every v 2 V (G3) do Compute a depth . Contract the SCC's and throw away loop arcs. this reduces the complexity of the multiple DFS approach by a factor of O(m=n). let G3 be the resulting graph. then G is not singly connected. Otherwise. then G is not strongly connected. As we shall see. our algorithm for testing whether G is singly connected is simply stated: a a a a If G has a chord. Postponing for now discussion of how to determine if G has a chord. compute the strongly connected components (SCC's) of G.

If T has a forward or cross arc. Theorem 2.rst search tree T rooted at v . If no T had a forward or cross arc.4 connected. G is singly connected. G is not singly connected. The algorithm above correctly determines whether or not a digraph is singly 3 .

terminating negatively if G has a chord is correct. then Lemma 2.3 proves that G is singly connected if and only if G is. Finally. if no T had a forward or cross arc. By the discussion at the beginning of Section 2 we know that terminating negatively upon discovery of a forward or cross arc in one of the T 's in the algorithm is correct.Proof: As noted above.2 demonstrates that terminating negatively if G3 has a multiple arc is correct. Lemma 2. Lemma 2. a a a a 3 Chord Testing and Analysis of Running Time We now show how to test whether or not G contains a chord via a simple depth . Similarly. If 3 3 G has no chord and G no multiple arc.1 states that it is correct to terminate positively.

We believe this fact is already known but can .rst search.

nd no mention of it in the literature. [13]). let DF S (v ) be v 0 s DFS number and LOW (v ) its low value in F .1 If F has no forward or intra-tree cross arcs. We therefore include it for completeness. The computation of these values is described in [1. rather we see works on related topics such as testing graphs to see if every cycle contains a chord (see. d0 . By de. otherwise we can derive from C and D a di erent simple cycle and a chord. ()) Let C = (c0 . We assume there are no forward or intra-tree cross arcs in F (or we immediately determine that G is not singly connected).. and for any v 2 V . there exist two distinct simple paths P and P 0 from v to its parent p(v ) in F . dk . ( ) < DF S (v ) and LOW y or two distinct children x and y with LOW x in F . cj ) for some 0  i < j < l be a chord of C . : : : . Let F be a DFS forest rooted at any vertex of G. We can assume that C is a simple cycle. 4].g. a back arc and a child x with LOW x ( ) < DF S (v ) in F . cl) be a cycle and D = (ci. ( ) < DF S (v ) (() Given any of the conditions listed in the lemma. : : : . P yields a chord of the cycle formed by catenating P 0 with the arc (p(v ). then G has a chord if and only if there is some vertex v in F with    two back arcs in F . Lemma 3. e. v ).

D catenated with the path (cj . The same can be said for C . 0 C appears in T as only tree arcs and one back arc. or ci has a child x 2 V (C ) in T with LOW (x) < DF S (ci ). since C and C are distinct. Proof: We now turn to the analysis of the running time of the algorithm. In all cases. Therefore. i. in which case there is a back arc from ci to the highest vertex of C in T . cl. The key to the O(m=n) factor improvement over the naive algorithm is that contracting the strongly connected components in G reduces the cost of performing each of the depth . ci is deeper than cj in T . : : : . : : : . Either ci is the deepest vertex of C in T .1. Let T be the tree in F containing the vertices of C and D. Now note that DF S (ci ) > DF S (cj ). or (2) k = 01 and j > i + 1. This follows from the proof of Lemma 2. Since C is simple and T has no forward or cross arcs. c1. ci has a back arc associated with C 0 or a child in T associated with 0 0 C with low value less than DF S (ci ). By the same reasoning. the back arc(s) and child(ren) rendered satisfy the lemma..nition either (1) k  0 and ds 6= ct for all 0  s  k and 0  t < l.e. ci) forms another simple cycle C 0 .

4 a a a a .rst searches in the last stage of the algorithm from O(m) to O(n).

Proof: Lemma 3. Each step requires linear space. 4]. Note that if we discover a forward or intra-tree cross arc during the DFS. To our knowledge.1 describes how to test to see if G has a chord in O(m) time via one complete DFS of G.2 2 The algorithm of Section 2 takes O n ( ) time and O(m) space. S (y )) to A(G ) if S (x) 6= S (y ) (if S (x) = S (y ). Contracting the strongly connected components can be accomplished in O(m) time as follows. there can be no back arcs in any of the DFS trees rooted at vertices in G3.) The test for multiple arcs is easily done simultaneously with the construction. S 3 3 V (G ) = v2V (G) fS (v )g. For each arc (x. Since G3 is acyclic. the algorithm presented here is the . Therefore. y ) in A(G) add an arc (S (x).Theorem 3. we immediately terminate negatively. this is loop arc and can be ignored. each of the O(n) DFS's requires O(n) time. Let S (v ) denote the SCC containing vertex v in G. The O(n) DFS's in the last stage of the algorithm can reuse the constant space for DFS marks in each vertex. a a a a 4 Conclusion and Open Problems The problem of determining whether or not a digraph is singly connected appears in [4]. Computing the strongly connected components of G also takes O(m) time [1.

i. One can consider a digraph as a network satisfying a set of communication requirements. adding additional edges does not destroy the property. For singly connected digraphs. Viewing the transitive closure of a digraph as a similar set of pairs. pairs of vertices that must be connected by some path. but removing arcs can create single connectivity.and k-edge-connectivity are monotonic in that once a graph is so connected. both actions monotonically so. Still.e. the O(n2 ) time bound achieved leaves much room for improvement. Problems such as k-vertex.rst to better the naive bound. this characteristic is reversed: Adding arcs can destroy the single connectivity of a digraph. We note one aspect of this problem that distinguishes it from more traditional connectivity problems. a digraph satis.

10. [3. we note that the problems of k-connectivity in undirected graphs have their limited connectivity analogues: Given a digraph. it is always possible to create another digraph with transitive closure T 0  T but with the property that it is singly connected (it is not always possible to do this and have T 0 = T . One might also wish to minimize (or minimalize) T nC . 9. then. Finally.. 6.) An open problem.es the communications requirements given as a set C if and only if its transitive closure T is such that C  T . 5 Acknowledgement We thank Bob Tarjan for insightful comments on an earlier draft of this paper which led to an improved presentation of the algorithm. are there at most k distinct simple paths connecting any pair of vertices? Further. e. see. 18. these higher degree problems are no longer trivial in the undirected case. Given a digraph with transitive closure T .g. is to construct eciently a singly connected digraph satisfying some communications requirements. 19. 23]. 5 . This type of problem is akin to traditional connectivity augmentation problems.

E. Cormen.-R. The minimum augmentation of any graph to a k-edgeconnected graph. Eswaran and R. Ullman. N. Reading. 1991. Gabow. Networks. L. Hopcroft. Cambridge. 1991. Berge. 1976. Esfahanian and S. A matroid approach to . Graphs and Hypergraphs Computer .. Hakimi. An algorithm for determining whether the connectivity of a graph is at least k . 32nd IEEE Symp. MA. V.References [1] A. C. Cai and Y. North-Holland Publishing Co. [11] H. pages 708{18. SIAM Journal on Computing. 1973. D. [9] A. 5(4):653{65. 19(1):151{72. on Foundations of Computer Science. Even and R. In IEEE Symp. Networks. N. 1975. Frank. 1990. On computing the connectivities of graphs and digraphs. E. [8] S. [5] A. Rivest. Amsterdam. on Foundations of Computer Science. [3] G. P. 1976. [4] T. SIAM Journal on Computing. E. MIT Press. SIAM Journal on Comput- [7] S. In Proc. 14(2):355{66. Tarjan. Network ow and testing graph connectivity. Augmentation problems. [6] K. Sur. 1989. Augmenting graphs to meet edge-connectivity requirements. J. Proc. 31st [10] H. Tarjan. The MIT Electrical Engineering and Computer Science Series.-G. Gabow. 4(3):393{6. Even. Addison-Wesley Publishing Co. MA. L. The Design and Analysis of Algorithms. 4(4):507{18. H. 1975. Leiserson. ing. Applications of a poset representation to edge connectivity and graph rigidity. 1984. [2] C. Introduction to Algorithms.. and R. E. Aho. H. pages 812{ 21. and J.

1989. 6 . 28th IEEE Symp. 1987. pages 112{22. New York. E. Proc. C. Galil. Academic Press. Schieber. 2(3):135{58. pages 249{51. 23rd ACM Symp. Improved algorithms for graph four-connectivity. [12] Z. Kanevsky and V. Tarjan. [13] M. 1991. Ramachandran. SIAM Journal on Computing . 10(1):76{85. Finding the edge connectivity of directed graphs. Journal on Computing. Golumbic. [16] Y. SIAM [15] A. pages 252{9. In Proc. 1973. In Proc. Algorithmic Graph Theory and Perfect Graphs. 9(1):197{9. Journal of Algorithms. In on Foundations of Computer Science. Hopcroft and R. [17] D.nding edge connectivity and packing arborescences. Matula. on Foundations of Computer Science. Finding the vertex connectivity of graphs. Dividing a graph into triconnected components. Mansour and B. 1980. 1980. 1987. Determining edge connectivity in O(nm). [14] J. W. on Theory of Computing. 28th IEEE Symp.

Naor. D.[18] D. Gus.

Martel. Journal on Computing. and C. E.eld. In Proc. 1979. 1990. on Foundations of Computer Science. P. Schnorr. Goldner. [21] R. Bottlenecks and edge connectivity in unsymmetrical networks. [19] A. A fast algorithm for optimally increasing the edge-connectivity. Journal on Computing. pages 698{707. Rosenthal and A. [20] C. 1977. 6(1):55{66. Tarjan. Depth-. 8(2):265{74. 31st IEEE Symp. Smallest augmentations to biconnect a graph.

rst search and linear graph algorithms. Nakamura. Journal of 7 . E. 35(1):96{144. Computer and System Sciences. CBMS-NSF Regional Conference Series in Applied Mathematics. Data Structures and Network Algorithms. 1983. Edge-connectivity augmentation problems. puting. Society for Industrial and Applied Mathematics. 1(2):146{59. [23] T. Tarjan. PA. Philadelphia. SIAM SIAM SIAM Journal on Com- [22] R. 1972. 1987. Watanbe and A.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->