数理解析研究所講究録 第 790 巻 1992 年 155-161 155

Deciding whether Graph $G$ Has Page Number One is in NC

増山 繁 (豊橋技術科学大学知識情報工学系) Shigeru MASUYAMA Department of Knowledge-Based Information Engineering Toyohashi University of Technology Toyohashi 441, Japan

内藤昭三 (NTT 基礎研究所) Shozo NAITO Basic Research Laboratories NTT Musashino 180, Japan Abstract Based on a forbidden subgraph characterization of a graph to have one page, we develop a polylog time algorithm to tell if page number of given graph $G$ is one with polynomial number of processors, clarifying this problem to be in NC.

1 Introduction is crossing when they are drawn on the same side of the linear arrangement of vertices. Similar problem setting ap- This paper discusses the problem of pears in the formulation of the non- deciding whether the given graph is crossing constraint on word modifica- noncrossing, where graph $G$ is non- tion to sentence generation in natural crossing if there exists a linear arrange- language processing, which motivates ment of vertices so that no pair of edges 156

us to study this problem. are undirected and may have multiple This problem is a specialization of edges. We also assume that a path the [12] in the sense denotes a simple path throughout this that this problem asks if the given paper. CREW PRAM (see e.g., [5]) graph has page number one, i.e., a is adopted as a parallel computation graph can be embedded in a single model. page. In general, the book embedding is hard: it is NP-complete to tell if a 2 Forbidden Sub- planar graph can be embedded in two graph Characterization of a pages [3]. It is known[2, 3, 12] that non- Graph to have Page Num- crossing graphs on a single page are ex- ber One actly the outerplanar graphs[6]. How- ever, no polylog parallel decision algo- We first introduce a characterization rithm to tell if a graph is outerplanar is of outerplanar graphs[6]. known.

The problem of deciding whether Theorem 1.[6] Given graph $G$ $=$ given graph $G$ has page number one is (V, $E$), $G$ is outerplanar formally defined as follows:

Given graph $G=$ (V, $E$), decide if and only if whether $G$ has page number one, where $G$ has page number one if there ex- ists a linear arrangement of vertices by

which no pair of edges $e,$ $e’\in E$ satis- $G$ no subgraph homeomorphic to fies $s(e)

We first illustrate a characterization Corollary 1. Given biconnected of a graph to have page number one by graph $G=(V, E))G$ is outerplanar two forbidden subgraphs. Based on this characterization we develop a polylog time algorithm with polynomial num- if and only if ber of processors, clarifying this prob- lem to be in NC. Graphs considered in this paper 157

$G$ has no subgraph homeomorphic to if and only if either $K_{4}$ or $K_{2,3}$ . $\square$

As $G$ has page number one if and only if $G$ is outerplanar[2, 3, 12] (, we $G$ has no subgraph homeomorphic to

$\square$ cal1 this Fact 1), and $K_{4}$ is a forbidden either $K_{4}$ or $K_{2,3}$ . subgraph of a series parallel graph[4] we have the following corollaries. No proof of Theorem 1 is provided in [6] and we supplement a construc- Corollary 2. If $G=(V, E, s, t)$ is a tive proof of Theorem 2, which ensures series parallel graph $[4, 10]$ and has no that Steps 2, 3 of the algorithm in the subgraph homeomorphic to $K_{2,3}$ , then next section can be performed for each $G$ has a one page embedding in which biconnected $B;$ . the left terminals ofG has the smallest number. 口 (Proof of Theorem 2) Necessity is ob- vious. To prove the sufficiency, we first Corollary 3. Given series parallel note that the following three observa- graph $G=(V, E),$ $G$ has page num- tions hold when $G$ has no subgraph ber one homeomorphic to $K_{4}$ or $K_{2,3}$ .

Observation 1. Each biconnected if and only if component of $G$ has no subgraph home- omorphic to $K_{4}$ and is a series parallel graph. Observation 2. We can obtain a $G$ has no subgraph homeomorphic to series parallel graph from each bicon- $K_{2,3}$ . 口 nected component of $G$ by choosing any vertex as one of its termina1[7]. We now characterize a graph to have Observation 3. As each biconnected page number one for general graphs. component of $G$ has no subgraph home- omorphic to $K_{2,3)}$ it has a one page em- Combining Theorem 1 to Fact 1, we bedding by which any vertex can be have the following Theorem. arranged first (by $Observation_{1}2$ and Corollary 1 of Theorem 1). Theorem 2. Given graph $G=(V, E)$ , $G$ is noncrossing Based on these observations, we shall prove the sufficiency by induction on 158

the number of biconnected components We now introduce a linear time al- in $G$ . gorithm, by which we can decide, with (1) If $G$ has exactly one biconnected respect to the number of edges, whether component, then the sufficiency holds the given graph $G$ has page number by Corollary 1 of Theorem 1. one. In the algorithm, $a(G)$ is the num- (2) We assume that the sufficiency ber of vertex disjoint paths with length holds when the number of biconnected at least two in $G$ connecting its termi- components is $n-1$ and consider the nals and $b(G)=1$ , if $G$ has a subgraph case when the number of biconnected homeomorphic components of $G$ is $n$ . to $G_{6}$ in Fig. 2. Otherwise, $b(G)=0$ . Let $S(G)$ be a graph each of whose vertex corresponds to either a bicon- Algorithm $PNO$ nected component of $G$ or an articulate vertex of $G$ , where $(B, a)$ is an edge of Step 1. Decompose $G$ into bicon-

$S(G)$ $a$ $B_{1},$ $B_{2},$ $B_{k}$ if and only if articulate vertex nected components $\ldots,$ and belongs to biconnected component $B$ . construct $S(G)$ defined in the proof of Note that $S(G)$ is a . Theorem 2. Let $B$ be one of the leaves of $S(G)()$ $B$ correspond $B_{i)}i=1,$ $k$ $Garrow B$ note that must to a bi- for each $\ldots,$ let ; connected component of $G,$ ) and let $a$ and $do$ Steps 2, 3: be an articulate vertex belonging to $B$ . Let $G-B$ be a graph obtained by re- Step 2. Decide whether $G$ is a series moving $B$ , except $a$ , from G. $G-B$ has parallel graph, and if $G$ is a series paral- $n-1$ biconnected components and has lel graph, then construct the parse tree page number one. On the other hand, of $G$ which describes how to construct

$B$ has a one page embedding where $a$ $G$ from the set of edges of $G[9,10]$ . is arranged first. Thus by embedding Step 3. Construct $G$ in accordance this one page embedding of $B$ in the with the parse tree in a bottom up man- one page embedding of $G-B$ between ner.

$a$ and the vertex next to $a$ in the ar- Step 3.1. $a(e)arrow 0,$ $b(e)arrow 0$ , for

$G$ rangement, we have shown that has each edge $e$ of $G$ . page number one. 口 Step 3.2. When series connection of $G’$ and $G^{u}$ is performed, let $G$ be the 3 Deciding if a Graph has resulting graph. Page Number One is in NC $a(G)arrow 1$ . If either $a(G’)=2$ or $a(G”)=2$ 159

holds, (edges) in G. by applying the recogni- $b(G)arrow 1$ . tion algorithm of series parallel graphs in [7] (note that although the first part Step 3.3. When parallel connection is of the algorithm in [7] may be simplified $G$ performed, let be the resulting graph as $G$ is biconnected, the overall com- obtained from $G’$ and $G”$ . If either plexity is not improved), $b(G’)=1$ or $b(G”)=1$ holds, then print Step 3 can be computed in $O(logl)$ ( $G$ has a page number more than one’) time with $O(l/logl)$ processors, where and stop. $l$ is the number of vertices in the parse tree, by applying tree contraction $al$ go- $a(G)arrow a(G’)+a(G”)$ rithm in [1] (see also [7].) As $l$ is $O(n)$ , this step can be computed in $O(logn)$ If $a(G)\geq 3$ , then print $G$ has page time with $O(n/logn)$ processors, number more than one” and stop. In total, this algorithm Step 3.4. If the root of the parse tree works in $O(log^{2}n+logm)$ time with $visite\prime^{1}$ $G$ is already , then has a page $O(n^{2}/log^{2}n+m)$ processors on CREW number one. 口 PRAM. $\square$ The correctness of the algorithm im- 4 Concluding Remarks mediately follows Corollary 1 of Theo- rem 1 and Theorem 2. An actual one page embedding of To implement the above algorithm in given graph $G$ which consists of more parallel, note that: than one blocks can be obtained, if it exists, by appending the following Step Step 1 can be performed in $O(log^{2}n)$ 4 to Algorithm PNO. time using $O(n^{2}/log^{2}n)$ processors by [11], where $n$ is the number of vertices Step 4. Merge one page embeddings $G$ in . of $B_{i}’ s$ , in a manner described in the “for statement” before Step 2 should proof of Theorem 2, by visiting vertices be replaced by of $S(G)$ in preorder from some arbitrary

articulate vertex $r$ .

$B;,$ $k$ $pa$ for each $i=1,$ $\ldots,$ in rallel $do$ let $Garrow B$; and $do$ Steps 2, 3: Step 4 can be performed in paral- lel by obtaining preorder numbering of Step 2 can be performed $O(log^{2}n+$ vertices of $S(G)$ and constructing lin- $logm)$ time with $O(n+m)$ processors, eary ordered list $L$ of vertices of $S(G)$ where $n(m)$ is the number of vertices where vertices are arranged in ascend- 160

ing order of its preorder numbering. gorithm, J. of Algorithms 10; 287- This can be done by first applying Eu- 302 (1989). ler tour technique[ll, 5] on tree $S(G)$ and doubling technique in a manner [2] F. Bernhart and P. C. Kainen, The described in [5]. This can be done book thickness of a graph, J. Com- $B,$ $27$ in $O(logk)$ time by $O(k)$ processors, bin. Theory, Ser. , pp. 320- where $k$ is the number of biconnected 331 (1979). components of $G$ . As $k\leq n_{)}$ this step [3] F. R. K. Chung, F. T. Leighton, can be performed in $O(logn)$ time by and A. L. Rosenberg, Embedding $O(n)$ processors. graphs in books: A graph lay- we parallel, each $B_{i}$ Then replace, in out problem with applications to by its one page embedding. To do this, VLSI design, SIAM J. Algebraic note that each $B_{i}$ can be replaced in and Discrete Methods, 1986. the following manner as described in the proof of Theorem 2 : [4] R. J. Duffin, Topology of series- parallel networks, J. of Mathemat- for each articulate vertex $j$ in parallel ical Analysis and Applications 10, $do$ 303-318 (1965). Make a one page embedding of each $B_{i}$ beginning at $j$ such that $j$ is the fa- [5] A. Gibbons and W. Rytter, Ef- ther of $B_{i}$ in the rooted tree obtained ficient ParaUel Algorithms, Cam- from $S(G)$ by Euler tour technique [5]. University Press (1988). Then substitute, in parallel, each $B_{i}$ [6] F. Harary, , with list $L$ of vertices of the one page embedding. Finally, remove the articu- Addison-Wesley (1959).

$L$ late vertex $j$ from the list . [7] X. He, Efficient parallel algorithms This can be done in constant time. for series parallel graphs, J. of AI- Thus both the overall gorithms 12, 409-430 (1991). and the number of processors required coincide with those of Algorithm PNO. [8] X. He and Y. Yesha, Parallel recognition and decomposition of two terminal series parallel graphs, References Information and Computation 75, 15-38 (1987). [1] K. Abramson, N. Dadoun, D. G. Kirkpatrick and T. Przytycka, A [9] J. E. Hopcroft and R. E. Tar- simple paralel tree contraction al- jan, Dividing a graph into tri- 161

connencted components, SIAM $J$ . Comput., 2, 135-158 (1973). [10] T. Kikuno, N. Yoshida and Y. Kakuda, A linear algorithm for the domination number of a series- parallel graph, Discrete Applied Mathematics 5, 299-311 (1983). [11] R. E. Tarjan andU. Vishkin, Find- ing biconnected components and computing tree functions in log- arithmic parallel time, SIAM $J$ . Fig. 1. Forbidden subgraph $K$ Comput. 13, 580-599 (1985). 2,3 [12] M. Yannakakis, ’Embedding Pla- nar Graphs in Four Pages, J. of Computer and System Sciences 38; 36-67, 1989.

Fig. 2. $G_{5}$