• 沒有找到結果。

Recognizing Circle Graphs in Polynomial Time

N/A
N/A
Protected

Academic year: 2022

Share "Recognizing Circle Graphs in Polynomial Time "

Copied!
39
0
0

加載中.... (立即查看全文)

全文

(1)

Recognizing Circle Graphs in Polynomial Time

CSABA P. GABOR AND KENNETH J. SUPOWIT

Princeton University. Princeton, New Jersey

AND

WEN-LIAN HSU

Northwestern University, Evanston, Illinois

Abstract. The main result of this paper is an 0( 1 V 1 x 1 E 1) time algorithm for deciding whether a given graph is a circle graph, that is, the intersection graph of a set of chords on a circle. The algorithm utilizes two new graph-theoretic results, regarding necessary induced subgraphs of graphs having neither articulation points nor similar pairs of vertices. Furthermore, as a substep of the algorithm, it is shown how to find in 0( 1 V 1 x 1 E 1) time a decomposition of a graph into prime graphs, thereby improving on a result of Cunningham.

Categories and Subject Descriptors: F.2.2 [Analysis of Algorithms and Problem Complexity]: Nonnu- merical Algorithms and Problems-computations on discrete structures; G.2. I [Discrete Mathematics]:

Combinatorics-combinatorial algorithms; G.2.2 [Discrete Mathematics]: Graph Theory-graph al- gorithms

General Terms: Algorithms, Theory, Verification

Additional Key Words and Phrases: Circle graph, graph decomposition, induced subgraph, intersection graph, polynomial-time algorithms

1. Introduction

An undirected graph G is called a circle graph if there exists a set of chords C on a circle and a one-to-one correspondence between vertices of G and chords of C such that two distinct vertices are adjacent if and only if their corresponding chords intersect. Such a set C is called a (circle-graph) model for G. Figure 1 shows a circle graph, along with a model for it. Figure 2 shows a graph that is not a circle graph. Our main result is an algorithm that, given a graph G = (V, E), decides in 0( 1 V 1 x 1 E I) time whether G is a circle graph, and if so outputs a model for it.

The work of C. P. Gabor and K. J. Supowit was supported in part by the National Science Foundation under grant DMC 8451214, and by grants from Hewlett-Packard Company and IBM Corporation.

The work of W.-L. Hsu was supported in part by the National Science Foundation under grant DMS 85-0469 1.

Authors’ present addresses: C. P. Gabor, Department of Computer Science, Princeton University, Princeton, NJ 08544; K. J. Supowit, Department of Computer and Information Science, Ohio State University, Columbus, OH 43210; W.-L. Hsu, Department of Industrial Engineering and Management Sciences, Northwestern University, Evanston, IL 60208.

Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission.

0 1989 ACM 0004-541 l/89/0700-0435 $01.50

Journal of the Association for Computing Machmery. Vol. 36. No. 3, July 1989, pp. 435-473

(2)

436 C. P. GABOR ET AL.

FIG. I. A graph along with a model for it.

(4 (b)

FIG. 2. A graph that is not a circle graph.

Our circle-graph recognition algorithm utilizes two graph-theoretic results, which may also be of interest in their own right. Say that a pair of vertices in a graph is similar if each third vertex is adjacent to both of them or neither of them. We show that a graph having no similar pairs must have an induced subgraph isomorphic to a certain graph (Theorem 1); this result was shown previously, by different methods [ 1, 71. We then use Theorem 1 to show that a graph having neither articulation points nor similar pairs must have an induced subgraph isomorphic to some member of a certain family of graphs (Theorem 2).

Another interesting result that we prove and utilize here is that a decomposition of a graph into prime elements, with respect to the join decomposition [6], can be found in 0( ] Iy ] x ] E ] ) time for undirected graphs. This improves on the 0( ] V ] ‘) algorithm of [5].

Circle graphs, also known as overlap graphs, were introduced in [9]. Given a model, the maximum clique and the maximum independent set problems on its corresponding graph can be solved in polynomial time [ 12, 14, 171, but the coloring problem is NP-hard [ 111. The recognition problem for circle graphs was posed as open in [I l] and [13].

Polynomial-time algorithms have been found for recognizing permutation graphs [ 16, IS], as well as for circular-arc graphs [ 193, which are defined as the intersection graphs of the matching diagram of a permutation, and of a set of arcs of a circle, respectively. These and other types of intersection graphs are discussed in [ 131.

Note that the recognition problem for circle graphs is at least as hard as that for permutation graphs. More precisely, given a graph G we can add a new vertex adjacent to each other vertex to get a new graph G’; it is easily seen that G is a permutation graph if and only if G’ is a circle graph.

A preliminary version of this paper appeared in [lo]. Two algorithms for recognizing circle graphs were recently discovered independently: an 0( ] I/ ] ‘) time algorithm by Bouchet [3], and an 0( ] V] ‘) time algorithm by Naji [ 151.

2. Overview of the Algorithm

The idea of the algorithm is to attempt to build up a model C for a given graph G = (V, E) by adding one chord at a time. Thus, after each iteration, C is a model for the subgraph induced by some W c V. At all times, we maintain a placement for each vertex v not yet in IV, but adjacent to at least one member of W. In particular, we associate with v a pair of arcs (4,) &) with the property that the chord for v in any model for G must have one endpoint in 4, and one in & (more precisely, the pair I&, &), which we refer to as ch(v), is a “necessary placement”

(3)

Recognizing Circle Graphs in Polynomial Time 437 for v relative to C, as defined in Section 3 below). Furthermore, at all times, C is essentially the only model for the subgraph induced by W that could be contained by a model for the entire graph G (more precisely, C is a “necessary model” for G/W, as defined in Section 3).

At each iteration, we add to Wa vertex w chosen arbitrarily from among those not in W but adjacent to at least one member of W. We also add a chord to C corresponding to w whose endpoints lie in the two members of ch( w), respectively.

We then must update ch(v) for various vertices v E V - IV, since our model C is now more detailed. In particular, for each vertex v such that ch(v) contained some 4 E ch(w), we now must be more specific about where w must be placed. That is, the arc 4 was split into two subarcs by the new chord for w; we must update ch(v) by replacing 4 by one of these two subarcs. Furthermore, we must compute ch(v) for each vertex v adjacent to w but to no other members of W, since previously such ch(v) were undefined. We must perform the updates to these various ch(v) in such a way that they remain necessary placements relative to C.

The algorithm terminates either when W = V (in which case C is a model for the entire graph G) or when we find that a chord with endpoints in ch( w)-where w is the chosen vertex-does not intersect precisely those chords in Ccorresponding to vertices adjacent to w (in which case G is not a circle graph, since ch(w) is necessary).

To facilitate this process, we first do some preprocessing to remove certain degeneracies from G. In particular, we first find the connected components of G.

It is easily seen that G is a circle graph if and only if each of its connected components are, and that a model for G can be obtained in O( 1 V]) time from models for those connected components. Therefore, we assume in the remainder of this paper that G is connected. Next we decompose G into components that are prime with respect to Cunningham’s join decomposition [5, 61 (defined in Section 3 below). Again, G is a circle graph if and only if each of its prime components are, and a model for G can be obtained quickly from models for those connected components (see Lemma 1).

After decomposing into prime elements, we assume that G is prime. The next major task is to start off the iterative process, that is, to find some initial Wand a necessary model C for it and the necessary placements ch(v) relative to C. It turns out (Theorem 2) that each graph containing neither similar pairs nor articulation points must contain as an induced subgraph at least one member of a certain family 9 of graphs (see Figure 9). This is interesting because prime graphs have neither similar pairs nor articulation points (Lemma 2) and because each member of ST is easily seen to be prime and is a “uniquely representable” circle graph (defined in Section 3), which essentially means that each of these graphs has only one model up to rotations, reflections, and order-preserving mappings of the circle.

Furthermore, this induced member of F can be found quickly.

Section 3 contains much of the definitions and notation used in this paper.

Lemmas 1 and 2 (which pertain to primeness) as well as the improved algorithm for finding a prime decomposition are contained in Section 4. Section 5 contains the algorithm for finding a W that induces a member of F within a graph without similar pairs of articulation points. It also presents another result (used as a substep of that algorithm) for finding a particular graph (see Figure 7) within a graph not containing similar pairs. Section 6 contains the algorithm for computing necessary placements relative to this initial W. Section 7 contains the main, iterative part of the overall algorithm. A subroutine used in Section 6, which we call Algorithm A,

(4)

438 C. P. GABOR ET AL.

is also used in Section 7. An interesting corollary (Section 8) of this work is that primeness and unique representability are equivalent notions for circle graphs.

The complexity analyses of the various steps are given in the sections in which they appear. Performing the prime decomposition takes 0( ] k’] X ] E ] ) time.

Finding a member of 9 takes 0( ] E ] ) time. Algorithm A can be performed in 0( ] E ( ) time. The initial placement (Section 6) consists of ] W ] calls to Algorithm A, and the main iteration (Section 7) consists of at most ] JJ’ ] - ] WI calls to Algorithm A. Hence the total time used by the algorithm is 0( ] I/ ] X ] E I ).

3. Definitions and Notation

All graphs considered in this paper are undirected, with no self-loops. Let G = (I’, E) be a graph and W C I/. Then G/W is the subgraph of G induced by I+‘.

If v E I’, then Nr,(v) = {w E W: (w, v) E EJ, that is, it is the neighborhood of v restricted to W. Vertices a, b E V are said to be W-similar if NH.(a) - (bJ = N,,(b) - (a). Thus, vertices that are I/-similar are what we called similar above.

A path in G is an ordered set of vertices p1 ,p2, . . . , p.\ such that (pi, p,+, ) E E for all i, 1 5 i < s. The path is primitive if in addition (p;, p,) 4 E for all i, j,

lj- il 22.

We consider only sets of chords whose endpoints are all distinct; this is without loss of generality because if G is a circle graph, then it has a model with all endpoints distinct. We also find it convenient to consider only sets of chords on a particular circle, say the unit circle centered at the origin (thus we will refer to “the circle”).

We now give a more precise definition of unique representability. Let C be a set of chords on the circle. Then G(C) denotes the graph for which C is a model, and let {v,, vl, . . . , v,,) be its vertices. Let r(C) denote the sequence of vertices obtained by traversing (starting at some arbitrary point) the 2n endpoints of chords of C clockwise around the circle, and at each such endpoint reporting the vertex of G(C) corresponding to the chord of C that contains it. Thus vi appears exactly twice in this sequence, for each 1 I i 5 n. If 7r = (r,, r2, . . . , z?,,) is such a sequence, then a shift of x results in the sequence (x?,~, xl, r2, . . . , r?,,-,), and a reverse of ?r results in the sequence (x2,,, x2,,-, , . . . , r1 ). If C, and Cz are circle- graph models, then we write C, - Cz if x(C,) can be obtained from r(C,) by a sequence of shift and reverse operations. Note that - is an equivalence relation.

It is easily seen that C, - Cz implies that G(C,) is isomorphic to G(C,). A circle graph G is uniquely representable if each two models C, and C2 for it satisfy C, - C?.

A model D for G/IV is necessary if either G is not a circle graph or each model for G has a subset D ’ corresponding to the vertices of W such that D ’ - D. We say that an arc of the circle is empty (with respect to D) if it is a maximal arc containing no endpoints of chords of D. Thus D defines 2 ] D 1 (=2 ] W( ) empty arcs on the circle. A placement of a vertex v E V - W relative to D is a pair (&, & 1 of these empty arcs. This placement of v is necessary if D U (d) is a neces- sary model for G/( WU Iv)), where d is some chord having one endpoint in 4, and the other in &.

Finally, we review the notion of the join composition, following [5] and [6]. Let G = (V, E) be a graph such that Scan be partitioned into VU, I’, , Vz, and l’, such that

I’, x P’- C E,

(5)

Recognizing Circle Graphs in Polynomial Time 439 and

(see Figure 3). Let G, = G/( V, U V, U (m, )) for some ml E V2. Analogously, let G2=G/({mzJU V2U V3)forsomemzE V,.Thenwesaythat(G,,G2]isaSimple decomposition of G, yielded by the partition { V,, I/,, V2, V, ). A (genera/) decom- position of a graph G is defined inductively to be either (G) or a set of graphs obtained from a decomposition 27 of G by replacing some H E Z by the members of a simple decomposition of H. A graph is prime if it has no simple decomposition.

A decomposition is prime if each of its elements is prime.

4. Decomposition into Prime Elements

The following result enables us to restrict our attention to prime graphs.

LEMMA 1. Let (G,, G2) be a simple decomposition of G. Then G is a circle graph ifand only if G, and G2 both are. Furthermore, given models for G, and G2,

respectively, a model for G can be constructed in 0( I VI ) time.

PROOF. If G is a circle graph, then G, and GZ are as well (since they are induced subgraphs).

To prove the converse, assume that G, and GZ are circle graphs, with models C, and CZ, respectively. Let ml and m2 be the vertices as specified in the definition of decomposition above. Let

be a sequence obtained from C, by starting at one of the endpoints of the chord corresponding to ml. Thus, A, and B, denote the two subsequences of vertices traversed between the two occurrences of m;. Analogously, let

be a sequence for C,.

Then the sequence

can be obtained from a traversal of a set of chords (see Figure 4) that, as is easily verified, is a circle model for G. Q.E.D.

Thus our circle-graph recognition algorithm first finds a prime decomposition 57 of G, then decides whether each of its elements is a circle graph. If so, then it constructs a model for G in a pairwise manner from the models for the elements of 27’; otherwise, it declares that G is not a circle graph. Thus we assume from now on that the input graph G is prime.

The following properties of primeness will be used extensively.

LEMMA 2. If G = (V, E) is a prime graph having at least five vertices, then (1) G has no articulation points, and (2) G has no similar pairs.

PROOF

(1) If G has an articulation point v, then let (A, BJ be a partition of V - iv) sets such that I B I 2 (A I z 1 and the removal of v from G leaves A disconnected

(6)

440 C. P. GABOR ET AL.

vo VI

ALL v2 v3

FIG. 3. A simple decomposition of a graph.

FIG. 4. Illustration for the proof of Lemma 1.

- ml

A2

from B. Then the partition of Pinto V. = A VI = Iv1

v2 = NII

Vj = B - NB(v) is a simple decomposition of G.

(2) If a, b E V are a similar pair, then the partition of V into v, = 0

VI = la, bl V2 = N,,(a) - {b]

V, = V - (N,,(a) U {a, bJ) is a simple decomposition of G. Q.E.D.

We now present an O( ] V ] x ] E ] ) time algorithm to find a prime decomposition of an undirected graph G, thus improving on the O( ] V ] ‘) time algorithm of [5].

As is shown in [5], this problem can be solved by making U( I VI ) calls to a subroutine that solves the following problem:

INPUT. A graph G = (V, E) and an edge (x, y) E E.

OUTPUT. A partition (V,, V,, V,, V,) of V yielding a decomposition, such that x E V, and y E V,, if such a partition exists; otherwise, output “no”.

An O( ] V ( ‘) time algorithm to solve this problem is given in [5]; our algorithm, which runs in O( ] E I) time, is shown in Figure 5. We maintain a partition (S, T) of V, such that x E S and y E T. We try to construct these sets so that there is a partition {V,, I/,, V2, V,) of V yielding a decomposition, where S = V. U V, and T = V, U V, ; if such a decomposition exists, then we refer to the set {S, T} as a split. Initially S contains only x and one other (arbitrarily chosen) vertex w, and T contains all other vertices. Define a violation as a pair (s, t ) such that s E S, and

(7)

Recognizing Circle Graphs in Polynomial Time 441

(1) w c some element of V - {x, y];

(2) s+- Ix. WI;

(3) T+- v-s;

(4) U+- lwl;

(5) while Cl # 0 do (6) begin

(7) s c some member of CJ; U + U - {s);

(8) [[Look for violations of the form (s, f ) where t E r]]

(9) if (s, y) E E

(10) then for each t E NT(s) U NT(x) do (11) if {s, t ) is a violation then

(12) begin

(13) Tt T- (2);

(14) scsu It);

(1% utuu It)

(16) end

(17) else for each t E N,-(s) do

(18) begin

(19) [[ 1s. t } must be a violation]]

(20) Tc T- {t};

(21) StSU {t];

(22) UC uu It)

(23) end;

(24) end;

(25) [[Now there are no violations]]

(26) if 1 TI > 1 (27) then begin

(28) v, +- Is E s: (s, y) E El;

(29) V(, t s - VI ;

(30) v: c (t E T:(t, x) E EJ;

(31) l’3.e T- V>;

(32) output I&, VI, v2, v31 (33) end

(34) else

(35) Interchange x and y and repeat the while loop with s = { y, w ) and T = V - S.

(36) Again, if ] T ] > 1 then output a partition as in steps (28)-(32); otherwise output “no”.

FIG. 5. The algorithm to check for a decomposition splitting a particular edge.

t E T and one of the following four cases is true (see Figure 6) (1) 0, t> E E, 0, Y> @ E, (t, x) E E.

(2) kt)EE, 0, Y> E E, (t, x) (3 E.

(3) (s, t> E E, (s, Y> @ E, (t, x> (3 E.

(4) (S,t)4E, 0, Y> E E, (t, x) E E.

It is easily verified that if there is a violation then (S, T] is not a split. The algorithm iteratively looks for violations, and whenever it finds one, eliminates it by moving the member of T involved in the violation into S. We use a set U to hold all vertices s that have been moved into S, but that we have not yet examined to see whether there is a t E T with which s forms a violation.

PROOF OF CORRECTNESS. If there is a split (S, TJ with x E S, y E T, then either w E S or w E T. Hence it s&ices to check that the algorithm correctly determines whether there is a split (S, T} with (x, w) C S, y E T. We show first that after the termination of the while loop there is no violation. Assume for a contradiction that there were such a violation (s, t ). Since every element of S other than x was removed from U at some point, we can consider the point at which s was removed

(8)

442 C. P. GABOR ET AL.

FIG. 6. The four types of violations. A straight line indicates no (b) edge, a wavy line indicates that an edge may or may not be present.

S T

S T

S t

EWD X

(4

from U. If (s, y) E E, then (since (s, t ) is a violation) we must have that t E N,,(s)

U N&c). But this implies that the violation (s, t ) would have been detected in step (lo), and therefore t would have been included in S, a contradiction. On the other hand, if (s, y) $6 E, then the violation (s, t ) would have been detected in step (17) and therefore t would have been included in S, again a contradiction.

Now if 1 T 1 > 1, then it is easy to verify that the partition ( VO, V,, V2, V3) yields a decomposition. On the other hand, if there is a split {S’, T' 1 with x E S’, y E T', then no element of S’ could constitute a violation with an element of T.

ANALYSISOFTIME COMPLEXITY. For each vertex v E V, we maintain a doubly linked list of its neighbors in T (i.e., the set NT(v)). When an element t is removed from T, it must be deleted from each of the deg(t ) such lists. To facilitate this, we also maintain, for each t E T, a list of the nodes corresponding to it in these lists;

thus, there is one such node (in the list for N,(v)) for each v adjacent to t.

Note that no vertex is removed from U more than once. Furthermore, we claim that whenever an element s is removed from U, the amount of time spent in checking for violations involving s (which is proportional to the number of executions of the for loops in steps (10) and (17)) is

O(deg(s) + # of violations found involving s).

To see this, note that step (10) examines some t E T either when t E N,(s) (which happens for at most deg(s) values oft), or when t E NT(x) - N&s) (which implies

(9)

Recognizing Circle Graphs in Polynomial Time 443 that (s, t ) is a violation, of type 4). To enumerate the elements in the set NT(x) - N?(s) efficiently, we first traverse the list NT(s), marking each element; we then traverse the list N,(x) reporting each unmarked element. These two traversals take O(deg(s) + # of violations found involving s) time. Finally, step (17) executes

] N,(s) ] (5 deg(s)) times.

Thus, the running time of the algorithm is at most C O(deg(s) + # of violations found involving s) .,El’-I.\.).)

= WI VI + IEI) = alEI), since the number of violations found is at most ] V ] - 2 (since each such violation causes an element to be removed from T).

In summary, the running time of algorithm of [5] to find a prime decomposi- tion is dominated by O( ] V] ) calls to this algorithm; thus its total time is WI v/I x IElI.

5. Finding a Member of 9

We assume throughout the remainder of the paper that G is prime and has at least five vertices. Recall (Lemma 2) that this implies that G has neither similar pairs nor articulation points. We begin by showing (Theorem 1) that G contains, as an induced subgraph, the graph pictured in Figure 7 (defined below). This will help us in showing (Theorem 2) that G must contain, as an induced subgraph, one of the graphs pictured in Figure 9 (also defined below). These theorems are construc- tive, and indeed the required induced subgraph can be found in 0( ] E I) time.

Definitions. A graph is called a P4 if it is isomorphic to the graph with vertices (a, 6, c, d] and edges {(a, b), (b, c), (c, d)) (see Figure 7).

THEOREM 1. Let G = ( V, E), I VI > 2, be a graph having no similar pairs. Then some induced subgraph of G is a P4. Furthermore, such a subgraph can be found in 0( I E I ) time. (Note that the absence of similar pairs implies I E I = Q( I VI ).)

PROOF. For all k 2 0, let I?,( denote the graph with vertices [a, : 0 5 i I 2k + 1 ), and edges ((a,, a,) : i # j and j is even and (i is even or i > j)] (see Figure 8).

Our algorithm iteratively finds an induced subgraph of G isomorphic to Hk for k=O, I,... until eventually finding an induced P4.

More precisely, we initially choose some edge (IQ, wl) E E (E cannot be empty since otherwise each vertex of G would be isolated and hence, since ] VI zz 2, G would have a similar pair). Thus G/( wO, wI ) is isomorphic to Ho.

NOW assume that we have found a set W= { Wj: 0 ~j I 2k + 1) C V that induces a subgraph of G isomorphic to Hh, for some k 2 0, where w, corresponds to a, under the isomorphism. Note that since wZk and wzli+, are W-similar there must exist some z0 E V - W adjacent to exactly one of them (otherwise w2h and w2/(+, would be V-similar). Assume that z. is adjacent to wZh but not to wZb+, ; this is without loss of generality by the W-similarity of w21, and wZh+, . Now if z. is adajcent to w?,+, for somej, 0 sj < k, then ( w~,+~, zo, Wan, w?~+, ) induces a P4 (and so we halt and output it). Otherwise, if z. is not adjacent to w2, for some j, 0 I j < k, then (zo, WI,, w,, w?,+, ) induces a P4. So assume that neither of these two cases hold.

At this point we know that z. and w 2A+1 are W U (z,J-similar. Therefore, there must be some zI E V - (W U (zo]) adjacent to exactly one of (zo, wzk+,), for otherwise z. and w 2I,+1 would be similar. Since z. and w2/,+, are W U (zo)-similar,

(10)

444

FIG. 7. A graph that is a P4. b c d

t = = .

C. P. GABOR ET AL.

FIG. 8. The graph HA.

it is without loss of generality to assume that z1 is adjacent to z. but not to wzk+, . Now if zI is not adjacent to wzj for some j, 0 5 j 5 k, then (z,, zo, W2j, w2ktI ) induces a P4. Otherwise, if zI is adjacent to w2,+, for some j, 0 I j < k, then

Iwz,+,, zI , Wan, wZk+, ) induces a P4.

Thus if we have not yet found an induced P4 in G then the set W U (zo, zI )

induces a subgraph isomorphic to H,, , .

By induction, the algorithm must find an induced P4 in G, since otherwise it finds an induced subgraph in G isomorphic to Hk for each k I 0, contradicting the finiteness of G.

We now describe how to implement the algorithm in the specified time bound.

At the kth iteration we must find a vertex z. adjacent to wZk, but not to w~~+, , or vice versa. To do this, we can traverse the adjacency list for w~~, placing a marker in the slots corresponding to its elements in an array representing all the members of I/. Then we traverse the adjacency list for Wan+, ; if we ever find an unmarked vertex in it, we halt and return that as z. (since it is adjacent to w~~+, but not to wZx). Similarly, we can search for a vertex adjacent to w2k but not to w2x-+, . We check whether z. is adjacent to W2j+l for some j, 0 I j < k, by scanning the adjacency list for zo. We check whether z. is not adjacent to W2j for some 0 5 j <

k by scanning the adjacency list for z. and marking off the even-indexed elements of W as they are encountered-thus the work of O(deg(z,,)), unless this is the last iteration, in which case it is O( ] VI). Finding zI and checking its adjacencies is done analogously. Therefore the total time required is O( I E I ). Q.E.D.

Actually, Theorem 1 is not new (although its proof is), because the existence of the induced P4 follows from [7], one can then apply the algorithm of [S] that finds an induced P4 (whenever it exists) in a graph (V, E) in 0( I I/ I + I E I ) time.

Definitions. A graph is a house if it is isomorphic to the graph with vertices (a, b, c, d, el and edges ((a, b), (a, c), (b, d), (c, d), (c, e), (d, e)). A graph is a tepee if it is isomorphic to the graph with vertices {a, b, c, d, e) and edges ((a, b), (b, c), (c, d), (a, e), (b, e), (c, e), (d, e)]. A graph is a figure-8 if it is isomorphic to the graph with vertices (a, b, c, d, e,f) and edges ((a, b), (a, c), (b, d), (c, d), (c, e), (d, f), (e, fl). A graph is a primitive k-cycle if it is isomorphic to the graph with vertices (a,, a2, . . . , ax-) and edges {(al, ad, (a, a~), . . . , hl, ad (a, al>) (see Figure 9). Let

F = (G: G is a house, a tepee, a figure-S, or a primitive k-cycle for some k L 5).

The key fact, as is easily verified, is that each member of 9 has at least 5 vertices, is prime, and is a uniquely representable circle graph. Furthermore, we can efftciently find a member of 9 within G because of the following result.

(11)

Recognizing Circle Graphs in Polynomial Time 445

e C

IeI d

0 b

(4

a4

ab cd

lb) (cl

a4

Cd)

FIG. 9. Graphs in the set F. (a) A house. (b) A tepee. (c) A figure- 8. (d) Primitive cycles of length k 2 5.

THEOREM 2. Let G = (V, E), I VI 2 2, be a graph having neither similar pairs nor articulation points. Then some induced subgraph of G is a member of F.

Furthermore, such a subgraph can be found in 0( I E I ) time.

PROOF. Our algorithm to find such an induced subgraph first finds a P4 (Step 1). Then in each of steps 2 through 9, we test for some condition and, if it is satisfied, then we can find a member of F and halt; otherwise we continue, and utilize the falsity of the condition in subsequent steps. Finally (step lo), if none of the conditions has been met, then we can find a set U C V such that (1) there is a particular vertex w that is adjacent to each member of U, (2) 1 U 1 z 2, and (3) U contains no U-similar pairs. Therefore, we can simply apply Theorem 1 to the subgraph G/U to obtain another P4; this P4 together with w induces a tepee.

More precisely, the algorithm is:

Step 1. Find vertices a, b, c, d E V that induce a P4, where (a, b), (b, c), (c, d) E E, by means of the algorithm in the proof of Theorem 1.

Step 2. If there exists v E V/adjacent to both a and d, then output the subgraph induced by {a, b, c, d, v) (which must be a house, tepee, or primitive 5-cycle) and halt. In the remainder, we therefore assume that dist(a, d) = 3, where dist denotes the length of the shortest path in the graph between the two vertices.

Step 3

B t (b’ E V:(a, b’) E E

and there exists c’ E V/such that (b’, c’), (c’, d) E E);

Cc (c’ E V:(d, c’) E E

and there exists b’ E I/ such that (a, b’), (b’, c’) E E).

If there exist vertices b, E B, cl E C such that (b,, cl) 4 E, then we can find an induced member of F as follows. Since 6, E B, cl E C, there exist vertices b2, c2 such that (a, b2), (b2, cl) E E, and (b,, c2), (c2, d) E E (Figure 10(a)). Note that step 2 ensures that (a, c2), (b2, d) @ E. There are eight cases, depending on which

(12)

446 C. I’. GABOR ET AL.

bz Cl a b c

(4 (b)

(9 (j) (k)

FIG. 10. Illustrations for the proof of Theorem 2. A straight line indicates an edge, an absence of line indicates no edge, a wavy line indicates that an edge may or may not be present.

subset of {(6,, b2), (&, c?), (c,, c?)) are contained in E. The reader may verify that there is an induced member of 5r in each case.

Thus

Fact 1. For all b, E B, cl E C, (b, , c,) E E (see Figure 11).

Step 4. If 1 B ) = 1, then let (a = po, p,, p2, . . . , p,. = c) be the shortest path from a to c not containing b (such a path must exist, otherwise b would be an articulation point). We know that Y > 3, since otherwise B would have at least two elements, namely b and pI. Consider the subgraph induced by {b, a, pI, p?, . . . , prP1, c); it must be of the form shown in Figure IO(b). Let k be the smallest integer greater than 2 such that ph is adjacent to b.

We consider four cases:

Case 1. (P,, b), (~2, b) W.

Then la, pl, PZ, . . . , px, 6) is a primitive cycle of length k + 2 2 5.

Case 2. (p,, b) E E, (~2, b) B E.

If k = 3, then (a, pi, p2, p3, b] induces a house. If k 2 4, then (p,, p2, . . . , pk, 6) is a primitive cycle of length k + 1 > 5.

(13)

Recognizing Circle Graphs in Polynomial Time 447

FIG. I I. Another illustration for the proofof Theo- rem 2.

Case 3. (P,, b) @ E, (~2, 6) E E.

If k = 3, then (a, p,, p2, p3, 6) induces a house. If k = 4, then {a, pI, p2, p3, p4, b) induces a figure-8. If k 2 5, then (pz, p3, . . . , pk, b] is a primitive cycle of length k 2 5.

Case4. (P,, b), (~2, 6) E E.

If k = 3, then (a, pI , p2, p3, b] induces a tepee. If k = 4, then (p, , p2, p3, p4, b]

induces a house. If k 2 5, then (p2, p3, . . . , pk, b) is a primitive cycle of length kz 5.

Step 5

W, t (v E V - B : v is adjacent to at least one element of B.

and at least one element of C U (a, d 1);

w 2 t {v E I/ - B: v is adjacent to at least one element of B but no elements of C U {a, d) 1.

Thus 1 IV,, IV21 is a partition of the vertices outside of B but adjacent to elements of B.

After step 6, each element of IV, will be adjacent to each element of B. After step 7, each element of IV, will be adjacent to at least two elements of B. Steps 8 and 9 will use these two facts to produce a set U G B having at least two elements and no U-similar pairs, which then allows us to find a member of .3 in step 10.

Step 6. If there exists w E IV, such that N,{(w) # B, then we find a member of 9 as follows.

First note that it cannot be that N,(w) # 0 and (w, a) E E; otherwise, we would have w E B. Furthermore, it cannot be that N,(w) = 0 and (w, a) 4 E; otherwise, we would have (w, d) E E and hence (since NB(w) # 0) we would have w E C.

Also note that w # a, since otherwise dist(a, b) zs 2. Since w is adjacent to at least one, but not all elements of B, there exists b,, b2 E B such that w is adjacent to b, but not to bz.

Case 1. N,(w) # 0, (w, a) @ E.

Let cl be an element of C adjacent to w (Figure IO(c)). Then (b,, a, b2, cl, w) induces a tepee if (b, , b2) E E, and a house, otherwise.

Case 2. N<(w) = 0, (w, a) E E (Figure 10(d)).

Then {bl, c, bZ, a, w ] induces a tepee if (bl , b2) E E, and a house, otherwise.

Step 7

Q+ (w E W2:INL((w)I = 1).

If Q is nonempty, then we find a member of s”I as follows: For each q E Q define b,, as the sole element of NIj( q), and define path(q) as a shortest path not containing b, from q to some b’ E B - (6,) (such a path must exist since otherwise 6, would

(14)

448 C. P. GABOR ET AL.

be an articulation point, since 1 B 1 2 2 by step 4). Find some q. E Q such that path(qo) has minimum length; let (qo, pI, p2, . . . , px, b’) be path(qO). Note that for all 1 I i I k, p, is not adjacent to both a and c, since otherwise pi E B (by the definition of B) and therefore path( qo) is not minimum.

We must have k 2 1, since 1 JIB( = 1. Also note that pI @ {a, c), by the definition of Q.

Casel. k= 1.

If (a, pl) E E, then (as shown above) pI is not adjacent to c. We also know that q. is not adjacent to c, since q. E Q implies Nc(qo) = 0 (since Q G Wz). Thus (Figure 10(e)) (b,, qo, pI , b’, c) induces either a tepee (if 6, is adjacent to both p1 and b’), a house (if it is adjacent to exactly one of them), or a primitive 5-cycle (if it is adjacent to neither).

On the other hand, if (a, pl) @ E, then (since ( qo, a) @ E, by the definition of Q) we have that (a, b’, b,, qo, pl) induces either a tepee, house, or primitive 5-cycle in each of the four cases depending on which subset of (b’, pl ) is adjacent to b,, (Figure 10(f)).

The following two facts are used in Cases 2 and 3:

Fact 2. For all i, 1 5 i I k - 2, p, is adjacent to neither a nor c, since otherwise there would be a path from q. to b’ shorter than path( qo) (b’ is adjacent to c by Fact 1).

Fact 3. For all i, 1 5 i I k - 1, pi is not adjacent to 6,. To see this, assume that it is. If p, E IV’,, then (p,, b) E E, contradicting the choice of path( qo). If p, E IV, - Q, then the choice of path( qo) is again violated. Otherwise, the choice of q. is violated.

Case 2. k = 2.

Case 2.1. (b,,, b’) E E (Figure IO(g)).

Then (b,, qo, pl, p2, b’ 1 induces a house if (b,,, p2) E E and a primitive 5-cycle, otherwise.

Case 2.2. (b,,, b’) $ E.

Case 2.2.1. (p,, a) E E.

Then (pl, c) 4 E (Figure 10(h)), since otherwise pI E B, giving a path shorter than path( qo). Then (b,, qo, pl, a, b’, c) induces a figure-8.

Case 2.2.2. (p,, a) 4 E (Figure 10(i)).

Then if (p2, a) E E, then {b,, qo, pl, p2, a) induces a house or a primitive 5- cycle (depending on whether ( p2, bY,,) E E). On the other hand, if ( p2, a) 4 E, then (b,, qo, pI, p2, b’, a] induces a figure-8 or a primitive 6-cycle (depending on whether (p2, bYO) E E).

Case3. kr3.

Case 3.1. (pkml, c) E E (Figure 10(j)).

Then W,, 40, ~1, ~2, . . . , pliwl, c) is a primitive cycle of length k + 2 > 5.

Case 3.2. (px--,, c) 4 E.

Case 3.2.1. (ph, b,,) E E.

(15)

Recognizing Circle Graphs in Polynomial Time

Then (b,, 40, PI, ~2, . . . , pkj is a primitive cycle of length k + 2 2 5.

Case 3.2.2. (p,<, bqJ 4 E (Figure 10(k)).

449

If (oh, cl E E, then W,,, 40, PI, ~2, . . . , pk, c) is a primitive cycle of length k + 3 L 6. Otherwise, either (b,, qo, p,, p2, . . . , pk, b’ ) is a primitive cycle of length k + 3 L 6 (if b’, b,J E E) or (b,, qo, pI, p2, . . . , p/;, b’, c) is a primitive cycle of length k + 4 2 7 (if (b’, bYO) 4 E).

Thus, assume in the remainder 1 NA(w) 1 2 2 for all w E W2.

Step 8

w c an element of W2 having the fewest neighbors in B, that is, 1 N,j(w) 1 5 1 N,(w ’ ) 1 for all w’ E W,

(We know IV2 # 0 since a E W,);

u + Nfi(w).

If there exists v E B - U adjacent to some b, E U but not adjacent to some b2 E U, then (Figure 10(l)) (b,, w, b2, c, v) induces a tepee if (b,, b2) E E and a house, otherwise.

Thus, suppose each vertex in B outside of U is adjacent to either none or all of the vertices in U.

Step 9. If there exist w’ E IV, adjacent to some b, E U but not adjacent to some bZ E U, then we can find a member of 9 as follows. Let b3 be an element of B - U that is adjacent to w ’ (such a vertex must exist, since otherwise 1 N,<(w) 1 =

1 U 1 > 1 U - (6, ] 1 2 1 N,j( w ’ ) 1 contradicting the choice of w).

Case 1. (w, w’) E E (Figure 10(m)).

Then (6,) a, b2, w’, w) induces a tepee, if (b,, bz) E E, and a house, otherwise.

Case 2. (w, w’) 4 E (Figure IO(n)).

Case 2.1. (b2, b3) E E.

Then (b,, w, bZ, bi, w’ ) induces a tepee (if b, is adjacent to both 6, and b3), a primitive 5-cycle (if b, is adjacent to neither b2 nor b3), or a house otherwise.

Case 2.2. (b2, b3) 4 E.

If b, is adjacent to both b? and b3, then (b, , w, b2, a, b3 1 induces a tepee. If b, is adjacent to b2 but not b,, then (b, , w ‘, b3, a, b2 ) induces a house. If 6, is adjacent to b3 but not b2, then (b, , w, b2, a, b, ] induces a house. Finally, if 6, is adjacent to neither b, nor b3, then {b, , w, b?, a, b,, w ’ 1 induces a figure-g.

Fact 4. U has no U-similar pairs.

PROOF. We claim that each vertex v E I/ - U is adjacent to all of U or none of U. Step 6 ensures this for each v E W, (since U G B). Step 8 ensures this for each v E B - U. Step 9 ensures this for each v E W,. Therefore, if there exists u, , uz E U that are U-similar, then uI, uz are also V-similar, a contradiction. Q.E.D.

Step 10. Find vertices u,, u2, u3, u4 E U that induce a P4, by again using the algorithm of the proof of Theorem 1 (Fact 4 allows us to do this).

Thus ( w, uI , u2, u3, u4) induces a tepee.

It is a simple matter to implement Steps l-6 and 8-10 in O( 1 E 1) time. For step 7 it is only slightly more complicated: Recall that there we must find a shortest

(16)

450 C. P. GABOR ET AL.

paWq0,Pl,P2,... ,p~,b’)subjecttoqoEQ,pj#b,,forall 1 ~i~k,andb’~

B - lb,]. To do this, we first find a shortest path P, of this form but subject also to plk B Q. Secondly, we find a shortest path (q, pI, p2, . . . , p,<) subject to q, pl; E Q, b, # b,,A ; and then let Pz be the path (q, pi, p2, . . . , pl,, b,,,). Both P, and P2 can be found in 0( 1 E 1) by means of breadth-first search. We then choose the shorter of P, and P2 as our desired path. This concludes the proof of Theorem 2. Q.E.D.

The existence result in Theorem 2 follows from the independently discovered results of [il. In particular, a graph having neither similar pairs nor articulation points cannot be “distance-hereditary” in their sense, and hence must contain an induced member of 9. Their paper does not seem to provide the appropriate algorithmic result.

6. Initial Placement

Now assume that we have found (using the algorithm of the previous section) some WC V that induces a member of s”I. We then construct a model C for this graph G/W, which is easily done in 0( 1 WI) time (note that 1 W( may be arbitrarily large, in the case in which W is a primitive cycle). The model C is (of course) necessary for G/W since each member of 9 is uniquely representable (the reader may wish to review the definition of “necessary” models and placements from Section 3). Let chord<(w) denote the chord in C corresponding to w, for each w E IV. In this section, our task is to assign a necessary placement relative to C to each v E V- Wadjacent to at least one member of IV. Having made this placement for v, we then pick an arbitrary point within each of these two empty arcs as endpoints of a chord for v. The important decision is which two empty arcs are chosen; the actual points chosen within the arcs are irrelevant.

We first define certain subsets of V - Was follows: Let A0 = (v E v - w: N,(v) = 0).

For each w E IV, let

A,(w) = (v E I/- w: N,,(v) = (w)]

and

Let

M(w) = (v E V - W: v is W-similar to w].

A, = ,$,$4,(W) (= (v E v- w: INH( = 1)) and

A4 = u M(w).

,,EM’

Finally, let

A2 = (a E V - ( W U M): I N,,(a)1 z- 2).

Thus, (Ao, A,, A?, M) is a partition of V - IV’.

Thus our task is to give each v E A, U A2 U A4 a necessary placement ch(v) relative to C. We assign such placements to members of A7 using one method, and then to members of A, U A4 using another.

(17)

Recognizing Circle Graphs in Polynomial Time 451 6.1. PLACING MEMBERS OF AZ. Our algorithm that assigns a necessary place- ment (relative to C) to each v E A2 is straightforward: for each pair (a, 61 of empty arcs defined by C, we consider a chord c,,.~ having one endpoint in LY and the other in p. We then check which chords of C are intersected by c,.~. If we ever find a pair {ol, p) such that ccr.ij intersects precisely those chords corresponding to members of N,,.(v), then we return the pair {a, /3) as the placement for v. Otherwise, we report that G is not a circle graph and halt the entire algorithm. We can do this with confidence that (in the former case) the chord returned for v is necessary or that (in the latter case) G is not a circle graph, because of the following result.

LEMMA 3. For each v E AZ, fG/( W U (v)) is a circle graph, then there exists a unique pair {LY, p) of empty arcs defined by C such that there exists a chord c,. with one endpoint in (Y and one in ,L?, and C U {c,,) is a model for G/( W U (v)).

PROOF. Let c and c’ be chords having endpoints in CY and ,8, and in (Y ’ and p ‘, respectively, such that C U (c) and C U {c’ ) are both models for G/( W U (v)).

Assume for a contradiction that ((Y, p) # (CX ‘, p ’ ). Consider two cases.

Case 1. (Y, p, 01’ and /I’ are not pairwise distinct.

Then there exists some arc y E (a, p) fl {a’, p’). Let q& $,, and & be the three arcs separating the three distinct members of (a, @, 01’, 0 1, such that y does not share a bounding point with & (see Figure 12(a)). We regard $,, i = 0, 1, 2, as being closed (i.e., it includes its bounding points). For each w E W, chord,(w) does not have exactly one endpoint in &,, since otherwise chordJw) would intersect exactly one of (c, c’ 1. Therefore the set

W’ = 1 w E W: chord<(w) has an endpoint in &,I,

is nonempty and is disconnected from W - W’, which is also nonempty (since 4, has at least one bounding point, which is an endpoint of a chord of C). But then G/W is disconnected, a contradiction (since G/W E F).

Case 2. (Y, @, CY’, and p’ are pairwise distinct.

Consider the arcs &, 4,, &, and 43, ‘separating a!, p, a’, and /3’, in clockwise order around the circle, where &, i = 0, 1, 2, 3 is regarded as being closed (i.e., it includes its two bounding points). For example, see Figure 12(b). Note that for i = 0, 1, 2, 3, for all w E W, it is not the case that chordc(w) has one endpoint in 4, and the other in &+, mod4, since otherwise chord<(w) would intersect exactly one of (c, c’ 1. If both $,, and & contain only one point, then these two points must be the endpoints of chordJw) for some w E W. To see how a 4, might contain only one point, note that &, for example, contains only one point precisely when (Y and cy’ abut, that is, share a common bounding point. Therefore, either v and w are W-similar or N,,(v) = (w); either case contradicts the fact that v E AZ. Similarly, it cannot be that both 4, and & contain only one point. There is at least one vertex v, (resp., v2) in W such that one endpoint of chord((v,) lies in do (resp., 4,) and the other in & (resp., &). Hence, v must be adjacent to vI or v2 (or both); without loss of generality, assume that v is adjacent to vI . Therefore, ( VU, V, , 1/2, I”3 1 is a partition of W, where

I’, = {u E W: the endpoints of chord((u) are both in $U or both in &) V, = (U E W: one endpoint of chord<(u) is in & and the other is in &) V2 = {U E W: one endpoint of chordJu) is in 4, and the other is in &) V3 = (U E W: the endpoints of chord<(u) are both in 4, or both in 43)

(18)

452 C. P. GABOR ET AL.

FIG. 12. Illustrations for the proof of Lemma 3.

Y (4

42 (b)

(thus v, E I/, and v2 E V2). This partition gives a simple decomposition of G/W.

To see this, it is easily verified that each member of V, is adjacent to each member of V,, that no member of V, is adjacent to a member of V2 U Vx, and that no member of I/, is adjacent to a member of V,. Furthermore, 1 VO U V, 1 12, because (as noted above) & U & contains at least three endpoints of chords in C. Similarly,

1 V, u V3 1 2 2. But G/W is a member of d and is therefore prime, a contradic- tion. Q.E.D.

6.2. PLACING MEMBERS OF A, U M. We assign a necessary placement, relative to C, to the members of A, U M by calling Algorithm A (described below) once for each w E IV. Algorithm A, given some w E IV, returns a necessary placement relative to C for each member of A, (w) U M(w). (Since (A, (w) U M(w)) II (A I (MI ‘) U M(w’)) = 0 whenever w # w’, this yields a unique necessary placement for each member of A, U M.)

In order to describe the operation of Algorithm A, given w, we need some notation. Let c be the chord in C corresponding to w. Let (Y and p denote the two empty arcs defined by the model C - (c) that contain the endpoints of c. Let a0 and (Y, (resp., PO and /3,) denote the two empty arcs of model C into which c splits (Y (resp., p), in such a way that 01~ and PO are on the same side of c, as is illustrated in Figure 13. We refer to the arcs 01~, al, PO, and /3, as the principal arcs. Let y and

(19)

Recognizing Circle Graphs in Polynomial Time

a

453

FIG. 13. The arcs referenced by Algorithm A.

6 denote the two arcs between (Y and /3 so that the sequence of arcs (Ye, aI, 6, PI, PO, y are encountered during a clockwise traversal of the circle. Thus, there are vertices wl, w2, w3, w4 E W such that LY is bounded by one endpoint of chord&w, ) and one of chord,-(w2), 6 is bounded by one endpoint of chord,(w,) and one of chord(( w3), p is bounded by one endpoint of chordc( w3) and one of chordc( w4), y is bounded by one endpoint of chord(( w4) and one of chord=( w, ). As we shall see in Lemma 4 below, wI , w2, w3, and w4 are pair-wise distinct.

Thus, Algorithm A finds, for each v E A, (w) U M(w), a pair of principal arcs that must contain the endpoints of v’s chord in all models for G. Note that, in each model for G, the placement for each member of A,(w) must have either one endpoint in a0 and the other in aI, or one in PO and the other in /3, ; this follows from the unique representability of G/W. Similarly, there are two possibilities for the placement of each m E M(w). In particular, if (m, w) 4 E, then the chord for m must have either one endpoint in a0 and the other in PO, or one in LY, and the other in PI. Otherwise, ((m, w) E E) the chord for m must have either one endpoint in czo and the other in /3,, or one in LY~ and the other in PO. Thus, for each v E A, (w) U M(w), once Algorithm A has found that some endpoint of v’s chord must (in all models for G) lie in a particular principal arc, then it is a trivial matter to decide which principal arc must contain the other endpoint of v’s chord.

Since the chord for each member of M(w) must have one endpoint in (Y and one in p, we refer to M(w) by the symbol F&w). The reason for this extra notation is that Algorithm A will be called again while iteratively adding chords (Section 7).

The algorithm for adding chords will also identify a set of vertices needing chords with one endpoint in (Y and one in p, but this set will not directly correspond to the notion of W-similarity with some vertex; this will be clarified in Section 7.

Now the information allows Algorithm A to make these binary choices of placements for vertices in A, (w) U F,,,,(w) is provided to it in the form of four sets ofvertices: F,Jw), F,,,(w), F,,,(w), and F,,(w).

6.2.1. Computing F,,(w). We first motivate and describe the computation of F,,,,(w) in detail, and then briefly mention the analogous sets F,,(w), F,,(w), and FO, (w). Recall that C is a necessary model for G/W. Intuitively, F,,(w) is the set of vertices whose chords must have one endpoint in y U 6 and the other might lie in a0 but cannot lie in any of the other three principal arcs. In other words, these vertices’ chords cannot have an endpoint in LY, U 0, but can have (at most) one

(20)

454 C. P. GABOR ET AL.

endpoint in cyo. Identifying these vertices is useful to Algorithm A because if, for example, some vertex p with this property is adjacent to some q E A, (w), then we know that the endpoints of the chord for q must lie in (Ye and 01~) rather than in PO and PI.

We begin by including in F,,,(w) each v E A, for which ch(v) (computed in Section 6.1 above) contains o(~ (note that the other arc in ch(v) must be contained in y U 6, since v E A?). As is shown in Section 6.1, ch(v) is necessary.

We also include each v E A, (w,) in F,,,,(w). We claim that, in each model for G, the chord for v cannot have an endpoint in o(, U p. To show this, we first need the following:

LEMMA 4. wI , wz, w3, and w4 are pairwise distinct.

PROOF. If w1 = w, (see Figure 14(a)), then N,,( wl) = 1 w), which contradicts the fact that no graph in 9 has an articulation point. Analogously, we have w3 f w4. If wI = w3 (Figure 14(b)) or wI = w4, then w and wI are W-similar, contradicting the fact that no graph in 9 has a similar pair. Analogously, we have w2 # w4 and w2 # w3. Q.E.D.

Now let y, denote the endpoint of chord((w,) bounding CY and y, and let y2 denote chord((w,)‘s other endpoint. Then the endpoints of v’s chord must lie either in the two empty arcs defined by C surrounding y, or in those surrounding y2, because v is adjacent to no vertices of W other than w. If (w, , w) B E, then y2 E y and hence the endpoints of v’s chord must either lie both in y or one in y and the other in a0 (see Figure 15(a)). Otherwise ((w, , w) E E), they both lie in 6 or one lies in y and the other in 01~ (Figure 15(b)); this follows easily from Lemma 4. In either case, v’s chord has no endpoint in cyI U ,B, as claimed.

Finally, we include each v E M(w, ) in F,,,(w). There are four possibilities for the placement of v’s chord: two if (w, w,) E E (Figure 16(a)) and two if (w, w, ) 4 E (Figure 16(b)). No two members of 1 wI , ~2, w 3, w4J are W-similar (since no graph in 5” has a similar pair); hence v’s chord cannot have an endpoint in (Y~ U /3.

In summary, we compute

F,,(w) + iv E A2:ao E ch(v)l U Al(w) U ~lw~, F,,(w) + (v E AZ: a, E ch(v)l U AI U Mtwz), F,a(w> + iv E A2:Po E ch(v)l u AI u Mw4), F,,(w) t {v E AZ:@, E ch(v)) U A,(w3) U M(w3).

Observe that these sets are pairwise disjoint. For convenience, we define F,(w) = F,,,(w) u F,q(w) u F,,(w) u F,&(W).

6.2.2. Algorithm A. Throughout the remainder of this section, when we refer to the placement of a vertex, we mean relative to the model C, unless otherwise specified.

Algorithm A is shown in Figure 17, and works as follows. We iteratively place a member of A,(w) u F,(w) u FJw) and in doing so, learn how to place other such members. We traverse this subset of A,(w) U F,(w) U F,,,(w) as a breadth- first search, implemented by means of a first-in-first-out (FIFO) queue. Thus whenever placing a vertex, we put it in the queue. The algorithm iteratively dequeues a vertex v, which then may cause a number of other vertices to be placed and enqueued; in this case we say that v determines these other vertices. We

(21)

Recognizing Circle Graphs in Polynomial Time

a a

w, =w*

~

W

4 w3

455

(b)

FIG. 14. Illustrations for the proof of Lemma 4

(4 (b)

FIG. 15. The possible placements of v E AI are shown in broken line. (a) If (~1, w) B E. (b) If(w,, w) E E.

maintain a set P of all members of A,(w) U E&w) that have ever been in the queue, that is, the members of A, (w) U F,,,,(w) that have been placed so far.

A few definitions are needed to explain Figure 17. If k 1 1, then a chain is apath uI, a2, . . . . al, in G such that a; E A0 for i = 1, 2, . . . , k. Two vertices v, v’ E V are said to be connected by this chain if (v, al), (a~, v’) E E. We refer to the four arcs CQ), o(, , PO, p, as the principal UYCS. Thus, the output of Algorithm A consists of a pair of principal arcs for each member of A, (w) U F&w). We define the x-reflect of a principal arc as the other principal arc on the same side of chord c ’ ; more precisely

x-reflect(a”) = PO, x-reflect(&) = LYE, x-reflect(a!, ) = PI, x-reflect(p, ) = aI.

Analogously, define the y-reflect of a principal arc as the principal arc differing from it only by being on the other side of c’; more precisely

y-reflect(olo) = LY], y-reflect(a,) = LYE, y-reflect(&) = PI, y-reflect@,) = PO.

By “placing” a vertex v, what the algorithm actually does is to pick two arcs to contain the endpoints of a chord for v. We distinguish between these two arcs, calling them arcI (v) and arcI( respectively. If v E F,(w), then arc,(v) is either y

(22)

456 C. P. GABOR ET AL.

(4 (b)

FIG. 16. The possible placements of v E M(w,) are shown in broken line.

(a)If(w,, w)EE.(b)If(w,, w)BE.

or 6, and arc?(v) is a principal arc. On the other hand, if v E A,(w) U F,,,(w), then both arc,(v) and arc,(v) are principal arcs.

The algorithm begins by placing each fE F,,(w) as follows. Note that, in each model for G, no endpoint off’s chord may lie in 01~ U & but there may be an endpoint off’s chord in LYE. We set arcz(f) to (Ye, for the following reason. Iffwill determine some q E A, (w) U FnB( w), then indeedf’s chord must have an endpoint in LY U ,B and hence in ao. On the other hand, iffdoes not determine any vertices, then arc?(f) will never be referenced and hence it does not matter what value it receives here. We let arc,(f) be 6 if fis adjacent to w, otherwise we set it to y.

Notice that arcI will not be referenced in the algorithm, but will appear in the proof of correctness (Lemma 5). We place each member of F,,(w), F,,(w), and Fti, (w) analogously. (Note that each member of F,(w) is placed exactly once on this call to Algorithm A, since the sets F,,(w), F,,(w), F,,(w), and P’,,,(w) are pairwise disjoint.)

In the body of the main loop of Algorithm A, a vertex p is removed from the queue and then each vertex q E A,(w) U F&w) not previously determined but determined by p is placed and enqueued. There are conditions under which p determines q, illustrated in Figure 18(a)-(e):

(a) p and q are connected by a chain,

(b) q E A,(w) and (P, 4) E 6

(4 q E &&+9, P E A(w), and (P, d @ E,

(4 q E f’,dw>, P E F,(w) U Fdw), (P, w> E 4 and (P, 4) 4 4 (e) q E Fdw), a E F,(w) U F&w), (P, w> 4 E, and (P, 4) E E.

The key idea (made more formal in the proof of correctness) of the algorithm is that the first endpoint of q’s chord must lie in the same principal arc x as the second endpoint of p’s arc. The first and second endpoints of the arcs are distinguished by l’s and 2’s in the figure. The second endpoint of q’s arc is then forced to lie in the y-reflect of x if q E A,(w), or in the x-reflect of x if q E FCYp( w) and (q, w) B E, or in the y-reflect of the x-reflect of x if q E Fnp( w) and (a w) E E.

PROOF OF CORRECTNESS OF ALGORITHM A. The proof of correctness of Algo- rithm A follows immediately from Lemmas 5 and 6. Informally, Lemma 6 says that all vertices in A,(w) U F,,,(w) eventually get placed; Lemma 5 says that if G is a circle graph then these placements are correct. Note that if G is not a circle

參考文獻

相關文件

We solve the three-in-a-tree problem on

In this project, we discovered a way to make a triangle similar to a target triangle that can be inscribed in any given triangle. Then we found that every triangle we’ve made in a

Mie–Gr¨uneisen equa- tion of state (1), we want to use an Eulerian formulation of the equations as in the form described in (2), and to employ a state-of-the-art shock capturing

(In Section 7.5 we will be able to use Newton's Law of Cooling to find an equation for T as a function of time.) By measuring the slope of the tangent, estimate the rate of change

In particular, we present a linear-time algorithm for the k-tuple total domination problem for graphs in which each block is a clique, a cycle or a complete bipartite graph,

In part II (“Invariance of quan- tum rings under ordinary flops II”, Algebraic Geometry, 2016), we develop a quantum Leray–Hirsch theorem and use it to show that the big

In order to solve the problems mentioned above, the following chapters intend to make a study of the structure and system of The Significance of Kuangyin Sūtra, then to have

Through a critical examination of some Chinese Christian intellectuals’ discussion on the indigenization of Christianity in China, this paper attempts to show that Chinese