An efficient parallel algorithm for planarity

Philip N. Klein, John H. Reif
1986 27th Annual Symposium on Foundations of Computer Science (sfcs 1986)  
We describe a parallel algorithm for testing a graph for planarity, and for finding an embedding of a planar graph. For a graph on n vertices, the algorithm runs in 0(log2 n) steps on n processors of a parallel RAM. The previous best parallel algorithm for planarity testing also ran in 0(log2 n) time (J. Ja'Ja ' and J. Simon, J Comput. 11, No. 2 (1982), 313-328), but used a reduction to solving linear systems, and hence required Q(M(n)/log2 n) processors, where M(n) is the sequential time for n
more » ... quential time for n x n matrix multiplication, whereas our processor bounds are within a polylog factor of optimal. The most significant aspect of our parallel algorithms is the use of a sophisticated data structure for representing sets of embeddings, the PQ-tree of K. Booth and G. Lueker, J. Compur. System Sci. 13, No. 3 (1976). 335-379). Previously no parallel algorithms for PQ-trees were known. We have efficient parallel algorithms for manipulating PQ-trees, which we use in our planarity algorithm. 0 1988 Academic Press. Inc. EFFICIENT ALGORITHM FOR PLANARITY 191 In contrast, the previous best parallel algorithm for testing planarity, due to Ja'Ja' and Simon [9] , reduced the problem to solving linear systems, and hence required at least M(n) total operations (time x number of processors), where M(n) is the number of operations required to multiply two n x n matrices. Ja'Ja' and Simon's algorithm was important because it showed that planarity could be decided quickly in parallel. However, such a large processor bound makes their algorithm infeasible. Moreover, their algorithm found a planar embedding for triconnected graphs but not for arbitrary graphs. In [17] , Miller and Reif showed how embeddings found by Ja'Ja' and Simon's algorithm could be combined to find an embedding for an arbitrary graph. However, the processor bound for Miller and ReiPs algorithm was no better than that of Ja'Ja' and Simon?. The inspiration for our parallel algorithm is an efficient sequential algorithm resulting from the combined work of Lempel, Even, and Cederbaum [13], Even and Tarjan [6] , and Booth and Lueker [3] . One essential ingredient we use from the work of Lempel, Even, and Cederbaum is that in building an embedding for a graph, premature commitment to a particular embedding of a subgraph should be avoided. Instead, we use a data structure called a PQ-tree, due to Booth and Lueker, to represent all embeddings of each subgraph. We introduce some new operations for the parallel manipulation of PQ-trees and use the parallel tree contraction technique of [ 173 to help implement these operations. Our parallel algorithm differs significantly from the sequential algorithm that inspired it. The sequential algorithm extended an embedding node by node. In contrast, we use a divide-and-conquer strategy, computing embeddings for subgraphs and combining them to form embeddings of larger subgraphs. To handle the numerous complications that arise in carrying out this approach, we are forced to generalize the approach of Lempel, Even, and Cederbaum. Our parallel planarity algorithm is rare among parallel algorithms in that it uses a sophisticated data structure. We have parallelized the PQ-tree data structure, due to Booth and Lueker [3], giving efficient parallel algorithms for manipulating PQ-trees. No parallel algorithms for PQ-trees existed previously. We define three operations on PQ-trees, multiple-disjoint-reduction, join, and intersection, and give linear-processor parallel algorithms for these operations. We use PQ-trees for representing sets of graph embeddings. However, PQ-trees are generally useful for representing large sets of orderings subject to adjacency constraints. Booth and Lueker use PQ-trees in efficient sequential algorithms for recognizing sparse (0, 1)-matrices with the consecutive one's property, and in recognizing and testing isomorphism of interval graphs. Using our parallel algorithms for PQ-trees, one can recognize n x n (0, 1)-matrices with the consecutive one's property in 0(log3 n) time using n* processors. In Section 2, we discuss the PQ-tree data structure. In Subsection 2.1, we give definitions of PQ-trees and the new operations on them: multiple disjoint reduction, intersection, and join. We show how these operations may be implemented in parallel in Subsections 2.2, 2.3, and 2.5. In Subsection 2.4, we prove some lemmas concerning the use of PQ-trees for representing sets of cycles. In Section 3, we KLEIN AND REIF discuss the problem of planarity. In Subsection 3.1, we give some definitions and results concerning embeddings of graphs. In Subsection 3.2, we describe our parallel planarity algorithm. 2. PARALLEL PQ-TREE ALGORITHMS PQ-Tree Definitions In our planarity algorithm, we will need to represent large sets of sequences of sets of edges. These sets are too large to represent explicitly, so we make use of an efficient data structure, the PQ-tree, due to Booth and Lueker [3] . In this section, we define the PQ-tree and some operations on it, and show how these operations may be carried out effciently in parallel. We freely adapt the terminology of [3] to suit our needs. A PQ-tree over the ground set S is a tree with two kinds of internal nodes, P-nodes and Q-nodes. Every internal node has at least two children, so the number of internal nodes is no more than the number of leaves. The children of each internal node are ordered. The leaves are just the elements of S. For example, in Fig. 1 is depicted a PQ-tree T over the ground set {a, h, c, d, e,f}. Here, as henceforth, Q-nodes are depicted by rectangles and P-nodes are depicted by circles. Throughout this section, n will denote the cardinality of S. For concreteness, we will assume that a PQ-tree is represented by a pointer structure as follows: each node has a pointer to its parent, its left sibling, its right sibling, its leftmost child, and its rightmost child (using null pointer where necessary). This representation permits constant time insertion and deletion of consecutive sequences of children by a single processor, and also O(log n) time tree contraction [ 171 on an exclusive-write P-RAM. A PQ-tree is used to represent certain classes of linear orderings of its ground set S. Let T be a PQ-tree over S. We will denote by L(T) the set of linear orders represented by T, and say that T generates L(T). One element of L(T) is obtained by reading off the leaves left to right in the order in which they appear in T. This is called the frontier of T, and written fr(T). (The frontier of the tree in Fig. 1 is bafdce.) The other elements are those linear orders obtained in the same way from LI f d FIG. 1. A PQ-tree over the ground set {u, h, c, d, t-f}.
doi:10.1109/sfcs.1986.6 dblp:conf/focs/KleinR86 fatcat:w4zcr3ajwnfmzk3yijxhj5qj2u