\NewDocumentCommand\merge

mmOℓ #1#3#2subscripttensor-product#3#1#2{#1}\otimes_{#3}{#2}# 1 ⊗ start_POSTSUBSCRIPT # 3 end_POSTSUBSCRIPT # 2 \NewDocumentCommand\updatemm #1+#2#1#2{#1}+{#2}# 1 + # 2 \NewDocumentCommand\settommOℓ #1[#2#3]#1delimited-[]#2#3{#1}[{#2}\to{#3}]# 1 [ # 2 → # 3 ] \NewDocumentCommand\usplitmmO#2Oℓ (#1+#2)[#3#4]#1#2delimited-[]#3#4({#1}+{#2})[{#3}\to{#4}]( # 1 + # 2 ) [ # 3 → # 4 ] \NewDocumentCommand\namedlabelomm\IfNoValueTF#1 #1]#2 \newtogglelong\toggletruelong \newtogglemyapx\togglefalsemyapx \NewDocumentEnvironmentprooflaterm +b \NewDocumentEnvironmentproofsketchOProof sketch.

#1.

\NewDocumentEnvironment

statelaterm +b \pretocmd\thmt@rst@storecounters\Hy@SaveLastskip \apptocmd\thmt@rst@storecounters\Hy@RestoreLastskip \hideLIPIcs \fundingFunded by the Deutsche Forschungsgemeinschaft (German Research Foundation, DFG) grant RU-1903/3-1 and by the Vienna Science and Technology Fund (WWTF) [10.47379/ICT22029]. Algorithms and Complexity Group, Technische Universität Wien, [email protected]://orcid.org/0000-0002-2754-1195 Faculty of Informatics and Mathematics, University of Passau, [email protected]://orcid.org/0000-0002-3794-4406 Stockholm University, Department of Mathematics, [email protected]://orcid.org/0000-0002-7745-3935 \CopyrightSimon D. Fink, Ignaz Rutter, and Sandhya T. P. \ccsdesc[100]Replace ccsdesc macro with valid one

A Simple Partially Embedded Planarity Test Based on Vertex-Addition

Simon D. Fink    Ignaz Rutter    Sandhya T. P
keywords:
Partially Embedded Planarity, PC-Trees, Constrained Planarity, Vertex-Addition, Linear-Time Algorithm

Abstract

In the Partially Embedded Planarity problem, we are given a graph G𝐺Gitalic_G together with a topological drawing of a subgraph H𝐻Hitalic_H of G𝐺Gitalic_G. The task is to decide whether the drawing can be extended to a drawing of the whole graph such that no two edges cross. Angelini et al. gave a linear-time algorithm for solving this problem in 2010 [abf-tpo-10, abf-tpo-15]. While their paper constitutes a significant result, the algorithm described therein is highly complex: it uses several layers of decompositions according to connectivity of both G𝐺Gitalic_G and H𝐻Hitalic_H, its description spans more than 30 pages, and can hardly be considered implementable. We give an independent linear-time algorithm that works along the well-known vertex-addition planarity test by Booth and Lueker [boo-pta-75, bl-tft-76]. We modify the PC-tree as underlying data structure used for representing all planar drawing possibilities in a natural way to also respect the restrictions given by the prescribed drawing of the subgraph H𝐻Hitalic_H. The testing algorithm and its proof of correctness only require small adaptations from the comparatively much simpler generic planarity test, of which several implementations exist. If the test succeeds, an embedding can be constructed using the same approaches that are used for the generic planarity test.

1 Introduction

In the partial representation extension problem, the input consists of a graph G𝐺Gitalic_G and a representation \mathcal{H}caligraphic_H of a subgraph HG𝐻𝐺H\subseteq Gitalic_H ⊆ italic_G. The question is whether there exists a representation 𝒢𝒢\mathcal{G}caligraphic_G of G𝐺Gitalic_G whose restriction to H𝐻Hitalic_H coincides with \mathcal{H}caligraphic_H. The complexity of the problem strongly varies with the type of representation that is considered. For planar straight-line drawings, the problem was shown to be NP-hard [pat-oea-06], and in fact recently turned out to be \exists\mathbb{R}∃ blackboard_R-complete [lmm-tco-18]. On the other hand, in recent years a plethora of algorithmic and complexity results have been established for various classes of representations. For example, Klavík et al., who coined the term partial representation extension, solved the problem for interval representations [kkv-epr-11] in quadratic time, which they later improved to linear [kko-epr-16]. Shortly afterwards, Angelini et al. [abf-tpo-10, abf-tpo-15] gave a linear-time algorithm for extending planar topological drawings. Since then, the problem has been studied for a variety of different types of intersection representations, e.g., proper and unit interval graphs [kko-epr-17], permutation graphs [kkkw-epr-12], circle graphs [cfk-epr-19], contact representations of geometric objects [cdk-cro-14], trapezoid graphs [kw-epr-17] and rectangular duals [ckk-epr-21]. In the context of drawings, the problem has also been studied for orthogonal drawings [ars-epo-21]. In this work we focus on the case of planar topological drawings, for which Angelini et al. [abf-tpo-15] gave a linear-time algorithm.

Prior Work.

In their paper, Angelini et al. [abf-tpo-15] first give a combinatorial characterization for yes-instances of Partially Embedded Planarity. They show that it is necessary and sufficient for a yes-instance to respect both the cyclic edge orders around vertices and the relative positions of different connected components defined by \mathcal{H}caligraphic_H. In particular, for a biconnected graph G𝐺Gitalic_G, these “compatibility constraints” set out by \mathcal{H}caligraphic_H can be individually verified on the nodes of the so-called SPQR-tree of G𝐺Gitalic_G [pat-pta-13, bt-olp-96], which models the triconnected components as well as all planar embeddings of G𝐺Gitalic_G. This procedure can also be used to individually test each biconnected component of a connected graph. However, it is also necessary to verify certain compatibility constraints between the different blocks. Similarly, the authors show that in the disconnected case, Partially Embedded Planarity can be solved by testing each connected component and verifying the compatibility of the relative positions for the different components. This characterization leads to a polynomial-time algorithm by progressively decomposing the input graph into its connected, biconnected, and triconnected components, while also verifying the compatibility constraints at each step.

In order to improve the running time to linear, Angelini et al. first give a dynamic programming algorithm that solves Partially Embedded Planarity for biconnected graphs. This algorithm uses complex subprocedures that handle more restricted subcases. For the connected and disconnected cases, they then show that the additional compatibility constraints can also be tested in linear time. While their work constitutes a significant result, the algorithm described therein is highly complex, its description spans more than 30 pages. Even when the graph H𝐻Hitalic_H that comes with a fixed drawing is connected; i.e., the embedding is uniquely determined by the rotation system of G𝐺Gitalic_G, it uses a decomposition of G𝐺Gitalic_G first into its biconnected, and then into its triconnected components. When H𝐻Hitalic_H is not connected, these algorithms are applied for each face of H𝐻Hitalic_H. The resulting algorithm is thus highly technical and relies on a large number of non-trivial subprocedures and data structures. It is therefore not surprising that no implementation is available to date.

Testing Planarity via Vertex Addition.

In this paper, we propose an alternative solution for the problem that, unlike the work of Angelini et al., does not rely on dynamic programming on graph decompositions such as the SPQR-tree. Instead, we straightforwardly extend the well-known linear-time vertex-addition planarity test of Booth and Lueker [boo-pta-75, bl-tft-76]. This test incrementally inserts the vertices of a biconnected graph in an order that ensures that both the already inserted vertices as well as the not-yet inserted ones, respectively, induce a connected subgraph. At every step, all edges from inserted to not-yet inserted vertices thus have to lie on the outer face of the already inserted subgraph. One only cares about the possible cyclic orders of such edges along the outer face, disregarding the different planar embeddings that yield these orders. To insert the next vertex, all edges connecting it to already-inserted vertices need to be consecutive on the outer face, as otherwise further edges to not-yet inserted vertices would be enclosed. The algorithm uses a PC-tree111A simplified, cyclic version of the PQ-trees originally used by Booth and Lueker [boo-pta-75, bl-tft-76], which only represent linear orders. to succinctly represent the set of possible edge orders on the outer face. The PC-tree is a data structure that represents sets of cyclic orders of its leaves, using two different types of inner nodes to model the possibilities for rearranging its leaves. Its main operation is to restrict the set of represented orders to only those orders that have a certain subset of leaves cyclically consecutive (i.e., uninterrupted by leaves from the complement subset). After making a set of edges to already-inserted vertices consecutive, they are removed from the represented orders and replaced by the set of the remaining edges of the inserted vertex (i.e., those to not-yet-inserted vertices). The algorithm then proceeds to the next not-yet-inserted vertex.

Augmented PC-trees.

The literature contains several examples where this ordinary planarity test is transferred to new settings by adapting its PC-trees to represent further constraints. One example is the Level Planarity problem [dbn-hap-88], where vertices have to be drawn on predefined horizontal lines. Leipert et al. [jlm-lpt-98] annotate PC-trees with information on the height of components and the space available within faces to test this problem; see also [brue-pvf-21, Chapter 5]. Similarly, in the Constrained Level Planarity problem [br-pac-17] where vertices have to satisfy some predefined ordering constraints, these constraints can also be carried over into the PC-tree; see [br-pac-17, Figure 5]. Another example is Simultaneous Planarity [hjl-tsp-13], where we seek planar drawings of two graphs that share some vertices and edges such that any shared vertex or edge is represented by the same point or curve, respectively. Haeupler et al. show that for restricted variants of this problem, the standard planarity test can be augmented to process both graphs at the same time while using synchronization constraints on PC-tree nodes to ensure that a simultaneous embedding is obtained [hjl-tsp-13].

1 v1,,vnst-Order(G)subscript𝑣1subscript𝑣𝑛st-Order𝐺v_{1},\ldots,v_{n}\leftarrow\texttt{st-Order}(G)italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ← st-Order ( italic_G );
2 T1subscript𝑇1absentT_{1}\leftarrowitalic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ← constrained P-node with deg(v1)degreesubscript𝑣1\deg(v_{1})roman_deg ( italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) leaves E(v1)𝐸subscript𝑣1E(v_{1})italic_E ( italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) copying constraints of v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT;
3 for i𝑖iitalic_i in 1,,n2,n11𝑛2𝑛11,\ldots,n-2{\color[rgb]{1,.5,0}\definecolor[named]{pgfstrokecolor}{rgb}{% 1,.5,0},n-1}1 , … , italic_n - 2 , italic_n - 1 do
4       absent\ell\leftarrowroman_ℓ ← new leaf;  F𝐹absentF\leftarrowitalic_F ← edges between vi+1subscript𝑣𝑖1v_{i+1}italic_v start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT and {v1,,vi}subscript𝑣1subscript𝑣𝑖\{v_{1},\ldots,v_{i}\}{ italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT };
5       Ssuperscript𝑆absentS^{\prime}\leftarrowitalic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ← constrained P-node with leaves (E(vi+1)F){}𝐸subscript𝑣𝑖1𝐹(E(v_{i+1})\setminus F)\cup\{\ell\}( italic_E ( italic_v start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ) ∖ italic_F ) ∪ { roman_ℓ } copying constr. of vi+1subscript𝑣𝑖1v_{i+1}italic_v start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT;
6       TTisuperscript𝑇subscript𝑇𝑖T^{\prime}\leftarrow T_{i}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ← italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT updated to have F𝐹Fitalic_F consecutive and with the subtree of F𝐹Fitalic_F replaced by \ellroman_ℓ;
7       Ti+1Ssubscript𝑇𝑖1superscript𝑆T_{i+1}\leftarrow S^{\prime}italic_T start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ← italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT merged with Tsuperscript𝑇T^{\prime}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT at \ellroman_ℓ;
8       if empty intersection between rotations of vi+1subscript𝑣𝑖1v_{i+1}italic_v start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT and admissible orders of Tsuperscript𝑇T^{\prime}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT then
9             return false;
10       else if constraints of vi+1subscript𝑣𝑖1v_{i+1}italic_v start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT fix flip of C-node μ𝜇\muitalic_μ in Tsuperscript𝑇T^{\prime}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT then
11             fix flip of respective C-node μsuperscript𝜇\mu^{\prime}italic_μ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT in Ti+1subscript𝑇𝑖1T_{i+1}italic_T start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT;
12      
13return true if no PC-tree update returned the null tree, and false otherwise;
Algorithm 1 High-level algorithm for testing a biconnected graph G𝐺Gitalic_G for Partially Embedded Planarity. Our additions to the plain planarity test are shown in orange. See LABEL:sec:peplan-bicon for the full exposition of both algorithms.

Our approach.

Similarly, the core of our approach for testing Partially Embedded Planarity is a modification of the PC-tree as underlying data structure of the ordinary planarity test. Our modification allows it to additionally handle the constraints that stem from the partial drawing. In addition to the changes of the underlying data structure, we only need to make very small adaptations in the planarity testing algorithm itself; the high-level comparsion in Algorithm 1 nicely highlights this. As our main contribution, we obtain a strongly simplified algorithm that relies on one depth-first search together with a single non-trivial data structure222In contrast, the algorithm by Angelini et al. uses “several auxiliary data structures, namely block-cutvertex trees, SPQR-trees, enriched block-cutvertex trees, block-face trees, component-face trees, and vertex-face incidence graphs” [abf-tpo-15] and requires dynamic programming on these data structures to obtain a solution in linear time.. To further underline the practical advantages of our algorithm, we give concise, implementation-level pseudo-code for it. The description of our core algorithm is less than half as long as the description of the algorithm by Angelini et al. [abf-tpo-15], while at the same time being far less technically involved.