3 April 1992
Information Processing Letters 41 (1992) 271-274 North-Holland
An algorithm for fraternal of graphs
orientation
J. Urrutia Department of Computer Science, University of Ottawa, Ottawa, Ontario, Canada KIN 6N5
F. Gavril Dipartement des Mathkmatiques, Ecole Polytechnique Fid&ale de Lausanne, CH-101.5 Lausanne, Switzerland
Communicated by D. Gries Received 3 July 1991 Revised 6 November 1991
Abstract
Urrutia, J. and F. Gavril, An algorithm for fraternal orientation 211-274.
of graphs, Information
Processing Letters 41 (1992)
A directed graph is fraternally oriented if for every three vertices u, ~1,w the existence of the edges u --) w and L‘+ w implies that II and L’are adjacent. For example, an undirected graph is chordal if and only if there exists an acyclic fraternal orientation of its edges. We describe a polynomial time algorithm for finding a fraternal orientation of an undirected graph, if one exists. We characterize the fraternally orientable graphs by forbidden subgraphs and as intersection graphs. Keywords: Algorithms, fraternally orientable
graphs, chordal graphs, intersection graphs
1. Introduction We consider finite undirected graphs G(V, E) with no parallel edges and no self-loops; I/ denotes the vertex set and E the edge set. When a particular orientation is given to the edges of, G, the resulting directed graph, denoted by G, is called an orientation of G. An undirected edge between vertices u and u is denoted by U-C and a directed edge from u to u by u --) U; if u, c are not adjacent, we denote this by U-U. ‘4 path JJ in G is a sequence of edges e,, e,, . . . , ek such that for every i, 1 < i
Correspondence
to: F. Gavril, CEMA (281, P.O. Box 2250,
Haifa, Israel. 0020-0190/92/$05.00
appear more than once in p but not consecutively, i.e., if e, = e,, then I i -j I # 1. If the first and last edges in p are U-U and x-y, we say that p is a path from u--c to x-y. The subpath of p between vertices w and z is denoted by p(w, z>. The vertex set of p is denoted by F. An edge u-v that does not belong to p but connects two vertices u, v of p is called a chord of p. A chord connecting the end vertices of two consecutive edges of p is called triangular. Let t be an edge subgraph of G with a vertex marked r(t). If t is connected and acyclic, then t is called a rooted subtree of G with root r( t ). The intersection of two subtrees t,(Vl, E,), t2(V2, E2) of G is the subgraph of G whose vertex set is Vi n V, and whose edge set is E, n E,. Two rooted subtrees are called graftable if their intersection is empty or contains one of their roots.
0 1992 - Elsevier Science Publishers B.V. All rights reserved
271
Volume
41. Number
5
INFORMATION
PROCESSING
The orientation G’ of a graph G is called fraternal if for every three vertices ~1, L’, w, the existence of the edges u + w and 11+ w implies that u and L‘are adjacent. A fraternally oriented graph can contain directed cycles. These graphs are discussed in [1,2,6] under the name B,-graphs. An undirected graph G is fraternally orientuble if there exists an orientation of its edges such that the resulting directed graph G is fraternally oriented. A graph G is chordal if and only if there exists an acyclic fraternal orientation G’ of G [5]. We describe a polynomial time algorithm for finding a fraternal orientation of an undirected graph, if one exists. We characterize the fraternally orientable graphs by forbidden subgraphs and as intersection graphs.
LETTERS
3 April 1992
u + I’. If both ITER(u + L:) and ITER(r: --j u) fail, then there exists no fraternal orientation of G. The converse is not immediate, since (x-ty,
y-x}
nITER(u-tr)=@
and {u+~,~‘+u)nITER(x+y)=@ do not imply ITER(u*r)nITER(x-ty)=& But, Lemma 1 and Theorem 2 below imply that if there exists no fraternal orientation of G, then G has an edge U-L’ such that both ITER(u + L’) and ITER(rs -+ u) fail.
If an edge is oriented in opposite directions by two Basic Iterations ITER(u --$c) and ITER(w + s), then s ---)w E ITER(u + I:). Lemma 1.
2. Algorithm for fraternal orientation Let G be an undirected graph for which we have to find a fra_ternal orientation. In any fraternal orientation G of G for every three vertices u, c, w such that u---c, r-w and u-w, if u + c, then L'+ w. The algorithm orients the edges of G using the following Basic Rule derived from this requirement: for any oriented edge u + L‘, it orients every edge c-w for which U-W, as I’ + w. Now, we define the Basic Iteration to be applied to any unoriented edge u----l’ whom the algorithm decides to orient as u + c. Basic Iteration ITER(u -+ u). Orient every edge such that U-W as z$+ w. Subsequently, for every edge x + y oriented during ITER(u + c) orient every y-z such that x-z as y --f z. Continue until no more edges are oriented. If during ITER(u + r> an edge is oriented in opposite directions, we say that ITER(u + I:) fails.
LI-w
Let ITER(u ---)~1) also denote the set of directed edges oriented during the iteration. It is easy to see that x + y E ITER(u * cl if and only if G has a path without triangular chords from u--c to x-y. Thus, x +y E ITER(u + L’) implies ITER(u + U) 2 ITER(x + y). If ITER(U -j c) fails, then there exists no fraternal orientation G’ of G in which u---l’ is oriented as 272
Proof. Assume that x +y E ITER(u + c) and y --tx E ITER(w + s), so G has two paths without triangular chords, one from U---L’ to x-y and the other from w--s to Y-.X. By inverting the second path and linking it to the first one at the edge x-y, we obtain a path without triangular chords from U---L: to s-w, so s + w E ITER(u + c). 0 The algorithm to find a fraternal orientation of an undirected graph G(V, E) works as follows: Let F = F’ = fl, Take an unoriented edge U--L’ E E -F’ and perform both ITER(u + L’) and ITER(rl -+ u) in parallel, using a sequential simulation. If both fail, then stop; there exists no fraternal orientation of G. If one of them, say ITER(u + L’) ends successfully, stop them both. Let S be the set of unoriented edges corresponding to the edges of ITER(u + c). Let F = F U ITER(u+c) and F’=F’US. If F’=E, then G’
Volume
41, Number
5
INFORMATION
PROCESSING
LETTERS
3 April
1992
unoriented edges, without need to backtrack when one of them fails.
an undirected graph if and only if it is fraternally orientable.
Theorem 2. The above algorithm finds a fraternal orientation of an undirected graph G, if one exists.
Proof. Given an intersection
Proof. If the algorithm ends successfully, then, by
the Rasic Iteration and by Lemma 1 the orientation is fraternal. Conversely, assume that G has a fraternal o and perform ITER(u, + cZ). Continuing in this way, we obtain a sequence of Basic Iterations ITER(u, + L’,), . . . , ITER(u, + ck) that ends successfully and orients the edges of G as in G’. Assume that our algorithm, when performed on G, fails, that is, for some edge w--s, both ITER(w - S) and ITER(s + w) fail. The edge w --s is oriented in one of the above ITER(u, + c,); assume that it is oriented as w + S. Therefore ITER(u, + c,> 2 ITER(w + S) and ITER(u, + ci> should have failed. q The algorithm works in time O( ( V 1 1E 1) since the Basic Rule is performed O( ( E I) times: ITER(u + L’) and ITER(u + U> are performed in parallel, so only successful Basic Iterations are counted, and two subsequent Basic Iterations orient disjoint sets of edges.
3. Characterizations
of
fraternally
orientable
graphs
E.very graph G(V, E) is an intersection graph of a family of subtrees of a graph H obtained from G by subdividing each edge with a vertex, the subtree L:’ corresponding to c E I/ being the star centered at L’ in H. Intersection graphs of subtrees in trees are discussed in [3] and [4]. We characterize the fraternally orientable graphs as intersection graphs. Theorem 3. A graph G(V, E) is the intersection graph of a family of mutually graftable subtrees of
graph G of a family S of mutually graftable subtrees, let z” ES denote the subtree corresponding to 1% E V. We orient each edge U--L! of G as u + 1: when r(v’) E u’, r(u’) @ v’, and arbitrarily when ,<,:‘I E u’, r(u’) E 0’. For three vertices u, c’, w of G such that u + w and u + w, we have r(w’) E u’ n u’; therefore u, u are adjacent and the orientation is fraternal. Conversely, given a fraternal orientation G’ of G, let the sul$ree c” corresponding to I’ E V be the star in G rooted at c and consisting of its outgoing edges. If two vertices u, L’ of G are connected by an edge u --) l’, then I,!E ~1’ and u’ n c’ # fl. If two subtrees u’, c’ have a common vertex w, then G contains the edges u + w, c + w and by fraternality it contains u --f L’ or c --f u, thus u E u’ or u E L:‘. q A family of subtrees of a tree T can be transformed into a family of mutually graftable subtrees by taking as root of each subtree its closest vertex to the root of T. Thus, the intersection graphs of subtrees in trees are exactly the undirected graphs for which there exists an acyclic fraternal orientation [3]. A family of arcs on a circle can be transformed into a family of mutually graftable subtrees by taking as root of an arc its first point in clockwise direction; thus, the intersection graphs of arcs on circles are fraternally orientable [6]. We now give a forbidden subgraph characterization of the fraternally orientable graphs, which unfortunately is not by minimal forbidden subgraphs. A monocycle U(u, II, p, x, r, c) is a graph having a cycle c, ICI 2 4, and a path p from u--c to x-r, I jj I a 2, such that: (i) ? Up is the vertex set of U; (ii> r is adjacent to two consecutive vertices s, t of c, or it is in c and its immediate neighbours in c are denoted s, t; (iii) c and p have no triangular chords in U, and x is distinct from and not adjacent to S, t; any other edges are allowed in CJ. 273
Volume
41, Number
INFORMATION
5
PROCESSING
A bicycle is a graph whose vertex and edge sets are the union of the vertex and edge sets of two monocycles U(u, I’, p,, xi, Y,, c,> and u(u, u, p2, x2, r2, c2). A bicycle has no fraternal orientation since ITER(u -+ u> fails on c, and ITER(IJ + U) fails on c2. Lemma 4. Consider two paths without triangular chords in a graph G, one path p, from U-L’ to z -y, the other pz from u-v to y--z. The vertex subgraph generated by j7, Up, contains a vertex induced monocycle. Proof. Consider two such paths p, = WI--w2pz=h,-h,--..
1992
Proof. Consider a graph G that is not fraternally orientable. Then, for some edge u--u, both ITER(u -+ r:) and ITER(c + u> fail, ITER(u + U) by trying to orient both ways an edge z-y and ITER(o + U> by trying to orient both ways an edge a-b. Therefore, there are four paths without triangular chords: q, from U--L’ to z-y, q2 from u--c to y-z, qj from c---u to a-b and q4 from Q--U to b-a. By Lemma 4 the subgraphs defined by the vertex sets 4, U i& and q3 u & contain the monocycles U(u, c, aI, x,, r,, c,) and lJ(v, U, p2, x2, r2, c2) which together form a bicycle. The converse is trivial. 0
-h,,
0
Theorem 5. An undirected graph has a fraternal orientation if and only if it has no vertex induced bicycles.
274
3 April
. . . -wj,
w1 = h, = u, w2 = h, = c’. Let i be the smallest index such that wi # hi; clearly i > 2. Denote r = w.,_,=h;_,, x = w.r-2 = h r-27 s=w,, t=h;. Let p =p,(u, r). If s-t, let c =p,(r, y> U p&r, y> and if s-t, let c = (s-t) Up,(s, y> U p&t, y). In thevertexsubgraph U(u, 11,p, x, r, c) defined by $ u F, p and c have no triangular chords, x is not adjacent to s, t, 1I; 1 > 2 and I Z I a 4. Therefore, U(u, L’, p, x, r, c) is a mono-
cycle.
LETTERS
References [l] H. Galeana-Sanchez, B, and Bz-orientable graphs in kernel theory, to appear. [Z] H. Galeana-Sanchez, Normal E,-orientable graphs satisfy the Strong Perfect Graph Conjecture, to appear. [3] F. Gavril, The intersection graphs of subtrees in trees are exactly the chordal graphs, J. Combin. Theory Ser. B 16 (1974) 47-56. [4] CL. Monma and V.K. Wei, Intersection graphs of paths in trees, J. Combin. Theory Ser. B 41 (1986) 141-181. [5] D.J. Rose, Triangulated graphs and the eliminiation process, J. Math. Anal. Appl. 32 (1970) 597-609. [6] D.J. Skrien, A relationship between triangulated graphs, comparability graphs, proper interval graphs, proper circular-arc graphs and nested interval graphs, J. Graph Theory 6 (1982) 309-316.