OOPS: Optimized One-Planarity Solver via SAT
Abstract
We present OOPS (Optimized One-Planarity Solver), a practical heuristic for recognizing 1-planar graphs and several important subclasses. A graph is 1-planar if it can be drawn in the plane such that each edge is crossed at most once – a natural generalization of planar graphs that has received increasing attention in graph drawing and beyond-planar graph theory. Although testing planarity can be done in linear time, recognizing 1-planar graphs is NP-complete, making effective practical algorithms especially valuable.
The core idea of our approach is to reduce the recognition of 1-planarity to a propositional satisfiability (SAT) instance, enabling the use of modern SAT solvers to efficiently explore the search space. Despite the inherent complexity of the problem, our method is substantially faster in practice than naïve or brute-force algorithms. In addition to demonstrating the empirical performance of our solver on synthetic and real-world instances, we show how OOPS can be used as a discovery tool in theoretical graph theory. Specifically, we employ OOPS to investigate two research problems concerning 1-planarity of specific graph families. Our implementation of the algorithm is publicly available to support further exploration in the field.
Keywords and phrases:
beyond planarity, 1-planar graph, SAT, book embeddings, upward 1-planarity2012 ACM Subject Classification:
Theory of computation Design and analysis of algorithms ; Mathematics of computing Graph theoryEditors:
Vida Dujmović and Fabrizio MontecchianiSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Planarity is a central concept in graph drawing; it describes graphs that can be embedded in the plane without edge crossings. Thanks to classical results, planarity testing can be carried out in linear time, and planar embeddings can be constructed for very large instances. However, most graphs arising in real-world applications, such as bioinformatics and software engineering, are non-planar. This motivates the study of beyond-planar graph classes, which extend planarity by allowing a limited number of edge crossings.
One of the most natural such classes is that of 1-planar graphs, introduced by Ringel in 1965 in the context of vertex-face colorings of plane graphs [36]. A graph is 1-planar if it can be drawn in the plane such that each edge is crossed at most once. This definition generalizes planar graphs but retains many of their structural properties, such as bounded edge density, bounded chromatic number, small separators, and low treewidth. The class of 1-planar graphs is receiving an increasing attention in the recent years: While the annotated bibliography on 1-planarity by Kobourov, Liotta, and Montecchiani from 2017 [28] lists references on the topic, a recent Google Scholar search of “1-planar graph” reveals several thousand of related publications.
Despite their structural similarities to planar graphs, 1-planar graphs are substantially more challenging from a computational standpoint. In contrast to the linear-time algorithms for planarity testing, recognizing whether a given graph is 1-planar is -complete, even for restricted graph families [29, 24, 14]. As a result, research on 1-planarity recognition has focused on developing algorithms for restricted subclasses, such as IC-planar and outer-1-planar graphs [1, 39, 5, 25], or on parameterized and approximation algorithms [8, 20]. While these results have deepened our theoretical understanding of 1-planarity, there remains a significant gap between theory and practice: existing exact algorithms are typically not scalable for use on general graphs arising in real-world scenarios. The design and evaluation of practical algorithms for recognizing (subclasses of) 1-planar graphs remains an underexplored direction [28, 10].
1.1 Summary of Contributions
In this paper, we reduce the gap by designing and implementing a practical heuristic for testing 1-planarity. Besides a naïve exhaustive search to enumerate all possible crossings in a graph, we are aware of only one attempt to implement a general algorithm for recognizing 1-planar graphs [10]. While this backtracking algorithm is carefully engineered, it is not efficient enough to answer basic research questions like “What is the smallest bipartite non-1-planar graph?” or “Is the 28-vertex Coxeter graph 1-planar?”. In contrast, our new algorithm, which we call OOPS (Optimized One-Planarity Solver), provides a substantial speedup and thus capable to answer such questions in seconds.
Our heuristic is based on converting the 1-planarity problem into a propositional satisfiability (SAT) instance, which enables the use of modern SAT solvers. To this end, we design two novel schemes for encoding the 1-planarity of a graph (which is a problem of geometric flavor) into a discrete SAT instance. The first one is based on the Hanani-Tutte characterization of planar graphs, which has been used earlier for designing practical algorithms for upward planarity [15]. This type of encoding is rather flexible and allows to easily extend the algorithm to other use cases, such as 1-planarity of directed graphs. Our second encoding is tailored to 1-planar graphs and exploits a connection to book embeddings. It results in a specifically compact encoding and much faster processing times, and thus, can be an interesting contribution on its own.
We summarize the main contributions of the paper as follows.
-
In Section 2 we describe our algorithm for the recognition of 1-planar graphs. It starts with a preprocessing step and an analysis of global properties of the input graph, such as edge density, that can eliminate some obviously non-1-planar instances. Then we present the two SAT encoding schemes for 1-planarity, followed by a set of more involved rules for breaking symmetries and reducing the search space.
-
An implementation of the algorithm, OOPS, is open sourced in [34]. The implementation is self-contained and requires only a C++ compiler with C++17 support.
-
Section 3 presents an extensive evaluation of the new approach, comparing its efficiency on a suite of benchmark graphs with alternatives. In particular, we provide the status of 1-planarity for named Wikipedia graphs (Table 2). Furthermore, we use OOPS to investigate two theoretical questions concerning 1-planarity regarding the smallest non-1-planar instances for several graph families (Problem 1) and the existence of a subclass of 1-planar graphs with certain properties (Problem 2).
1.2 Other Related Work
Although the family of 1-planar graphs shares some similarities with planar graphs, there is a fundamental difference. Planarity can be characterized by Wagner’s theorem (forbidden minors and ) or by Kuratowski’s theorem (forbidden subdivisions of and ). In contrast, every graph admits a 1-planar subdivision, making it impossible to characterize 1-planar graphs via a Kuratowski-type theorem. Testing 1-planarity is -complete. The first proof of this result is given by Grigoriev and Bodlaender [24], via a reduction from the 3-partition problem. An independent proof by Korzhik and Mohar [29] uses a reduction from the 3-coloring problem for planar graphs. The recognition problem remains -complete even for graphs with bounded bandwidth, pathwidth, or treewidth [8]; for graphs obtained from planar graphs by the addition of a single edge [14], and for graphs with a fixed rotation system [6]. However, the problem becomes fixed-parameter tractable when parameterized by the vertex-cover number, cyclomatic number, or tree-depth [8]. Polynomial-time algorithms are known only for restricted subfamilies of 1-planar graphs [5, 25, 13]. The extensive literature on the topic reflects a strong interest in determining the boundary between tractable and intractable cases. Nevertheless, general-purpose algorithms that are both practical and widely applicable remain lacking.
To prove that a given graph is not 1-planar, one can attempt several approaches. One method is to show that the graph has too many edges, as a 1-planar graph with vertices has at most edges [11]; better bounds exist for subclasses such as bipartite 1-planar graphs [27, 26]. Another approach is to leverage the chromatic number: 1-planar graphs are 6-colorable [12], so a graph requiring more colors cannot be 1-planar. Alternatively, one may identify a small non-1-planar subgraph (e.g., a complete multipartite graph [16]), or show that any drawing of the graph necessarily contains too many crossings [17]. However, once a graph passes these basic filters (consider for example a random cubic graph on vertices), determining whether a 1-planar drawing exists – or proving its nonexistence – remains a challenging and elusive problem. A brute-force approach is practical only for small instances, typically those with up to vertices, depending on the level of engineering effort. For this reason, Eppstein [46], Kobourov, Liotta, and Montecchiani [28] and Binucci, Didimo, and Montecchiani [10] discuss a need for a more powerful technique to attack larger graphs.
2 Model
2.1 Preliminaries
We consider a simple undirected graph with vertices and edges. A drawing of maps vertices to distinct points of the plane and edges to Jordan curves connecting corresponding endpoints; the curves may not pass through vertices except their endpoints. Two edges cross if their Jordan curves intersect in a point different from the endpoints. For the ease of notation we often identify a vertex and its drawing as well as an edge and its drawing . A drawing is planar if every edge is crossing-free, and a graph is planar if it admits a planar drawing. A drawing of a graph partitions the plane into connected regions, called faces; the unbounded region is called the outer face. The set of all faces describes the embedding of a planar graph .
A graph is 1-planar if it admits a 1-planar drawing, that is, a drawing in which every edge is crossed at most once. The planarization of a 1-planar drawing of is a (planar) graph that replaces each pair of crossing edges, and , by four edges , where is a new dummy vertex. The vertices of in the planarization are referred to as original. There are several important subclasses of 1-planar graphs; for example, optimal 1-planar graphs containing the maximum possible number of edges, [11]. A graph is IC-planar (independent crossing planar) if it has a 1-planar embedding so that each vertex is incident to at most one crossing edge [1]. In NIC-planar graphs (near-independent crossing planar), two pairs of crossing edges share at most one vertex [39]. Outer 1-planar graphs are another subclass of 1-planar graphs; they admit a 1-planar drawing such that all vertices are in the outer face [5, 25].
2.2 Preprocessing
We may simplify the testing of 1-planarity of an input graph by preprocessing the graph and eliminating some instances early. First, we split into (edge-disjoint) biconnected components and test each component independently, as a 1-planar drawing of can be easily composed from 1-planar drawings of its biconnected components. Second, we check the edge density of and reject instances violating the maximum possible density in a 1-planar graph. While there are several density-related results in the area (e.g., for IC and NIC graphs [40, 7]), we apply only the bound for general graphs [11] and the bound for bipartite ones [27]. Third, we test if is planar, which can be done efficiently. Finally, we verify if is 1-planar with skewness , that is, if it admits a 1-planar drawing in which only one pair of edges cross. This can be done by enumerating all possible pairs of edges, and testing if replacing the pair of crossed edges with a vertex of degree four yields a planar graph.
After the preprocessing step, we may assume that the input graph is biconnected, non-planar, and does not violate the edge density.
2.3 SAT-based Encoding of 1-Planarity
To test whether a given graph admits a -planar drawing, we formulate a Boolean Satisfiability Problem that has a solution if and only if is -planar. We develop two encoding schemes for the problem; both are based on the concept of a linear graph layout (also referred to as an ordered embedding in [15]). Refer to [35] for a survey of various types of linear layouts. Assume that admits a 1-planar drawing; planarize it by adding a dummy vertex for every crossing and consider a straight-line planar drawing of the planarization. Now it is easy to perturb the vertices such that they have different -coordinates, which yield a total (linear) order of the vertices; see Figure 1. Observe that the drawing can be modified so that the vertices lie on the same horizontal line (called the spine) while keeping planarity and the vertex -coordinates. The edges in the drawing are curves that are monotone in the direction; they cannot cross each other but can pass through the spine multiple times, as the red edge in Figure 1(c).
Our encoding schemes operate with two auxiliary graphs built as follows. Subdivide every edge of with a new division vertex to get its subdivision with and . The division vertices are . From we build another graph, denoted , by allowing to merge pairs of division vertices. Let and be two edges of that are subdivided by and in . By merging and , we get a new (dummy) vertex, , and four new edges in , namely , , , and . The construction of is similar to planarization of (a 1-planar drawing of) , except that contains extra non-merged division vertices. The importance of is shown below.
Observation 1.
Let be a graph and be its subdivision. Then is 1-planar if and only if merging some pairs of division vertices in results in a planar graph .
Proof.
In one direction, if is 1-planar, consider its planarization. Subdividing every edge non-incident to a dummy vertex, yields a desired planar graph . In another direction, start with a planar drawing of ; smooth all (non-merged) degree-2 division vertices and replace all degree-4 dummy vertices with two edges. The result is a 1-planar drawing of .
To model the merging process in by a SAT formula, consider a partial order on . In this order all vertices are pairwise comparable, except for pairs of merged division vertices that “share” a position in ; these exceptional pairs correspond to edge crossings in . Formally, we introduce variables encoding the relative order of vertices in :
-
:
two variables and for every pair of distinct vertices indicating whether precedes in the order.
Intuitively, means that precedes in the order, and symmetrically, means that follows . We stress that this is a partial order, meaning that for some pairs of division vertices, called merged, it holds that .
To indicate that a pair of division vertices is merged (or equivalently, that a pair of edges in cross each other), we introduce variables for pairs of division vertices. Note that not all division vertices can be merged. For example, one may assume that adjacent edges in do not cross in its 1-planar drawing; hence, we forbid to merge the corresponding division vertices by introducing a set of candidate pairs: . In the simplest scenario, contains pairs of division vertices corresponding to independent edges in ; Section 2.4 shows how to further shrink the set of candidates. The introduced variables are as follows:
-
:
a variable for every pair of distinct division vertices indicating whether is merged with .
To ensure the correctness of the order, , we enforce the following constraints for the associativity for non-candidate pairs of vertices, and order transitivity:
-
:
;
-
:
;
-
:
.
In order to link relative variables, , with merge variables, , we use:
-
:
.
Finally, a division vertex can be merged with only one other division vertex:
-
:
.
Next we discuss how the basic scheme can be customized in two different ways to encode 1-planarity of a graph.
2.3.1 Hanani-Tutte Encoding
The encoding presented in the previous section allows to model a linear layout of a graph and crossings between pairs of edges. However, one still needs to guarantee that the edges can be routed in a planar way. This is achieved with a help of a Hanani-Tutte-type characterization for monotone drawings:
Lemma 2 ([33, 23]).
Let be a graph. If has an -monotone drawing such that every pair of independent edges crosses an even number of times, then there is an -monotone planar drawing of with the same vertex locations.
Based on the characterization, Chimani and Zeranski [15] designed a SAT formulation for upward planarity, where edges of a directed acyclic graph have to be drawn in a monotone fashion. We observe that essentially the same encoding can be used for graph . To this end, we need extra variables to encode -moves that model how an edge is routed around a vertex . The true (resp., false) value of the variable indicates that edge is routed above (below) . We refer to [23] and [15] for further details on -moves.
-
:
a variable for every edge and every vertex to indicate whether we perform an -move.
The move variables can guarantee planarity using the following constraints. Here we consider a pair of edges , and assume that precedes in and that precedes in .
-
:
.
-
:
.
Finally, we need to ensure that merged division vertices have the same move variables:
-
:
.
Theorem 3.
Let be a graph and be its subdivision. Then is 1-planar if and only if the SAT formula built for and comprised of variables and constraints is satisfiable.
The proof of the theorem is inspired by results (for planar graphs) in [23, 15] with the key difference that is non-planar and contains pairs of division vertices that can be merged.
Proof of Theorem 3.
Assume that graph is 1-planar and let be its subdivision. Let us show that there is an assignment of variables such that are satisfiable.
Consider a 1-planar drawing of ; planarize it by inserting a dummy vertex for every crossing to get a planar graph . Now we subdivide every edge between original vertices and call the result . This graph, , is planar and hence, admits a straight-line drawing. Perturb the vertices in the drawing so that they have distinct -coordinates; we get a (planar) drawing of , where every edge is monotone in the direction; see Figure 1(c). Now we build a partial order, , of by assigning whenever . Dummy vertices in correspond to two division vertices in and have the same coordinates; set for such pairs. This construction guarantees constraints , , , , and . The move variables, , are assigned depending on whether an edge is routed above or below vertex . It is easy to verify (see also [23, 15]) that the absence of crossings imply , , .
For the opposite direction, assume that variables , , are assigned so that , , , , , , , are satisfied for . Constraints , , and guarantee a partial order of where all pairs of vertices are comparable except merged pairs. We position the vertices of on a spine following the order. To draw edges, we use together with , , and apply Theorem 4.1 of [23]. Note that edges might cross the spine multiple times but do not cross each other. To get a 1-planar drawing of , simply smooth (degree-2) division vertices; merged division vertices correspond to edge crossings.
2.3.2 Stack-Based Encoding
While the Hanani-Tutte-based encoding already provides a practical approach for 1-planarity, it is not utilizing all properties of 1-planar graphs. We observe that the auxiliary graph is bipartite, with one part being the original vertices, , and another part being the division vertices, . Furthermore, the graph remains bipartite after merging division vertices; that is, is bipartite too. To exploit the bipartiteness, we use the concept of (-page) book embeddings (a.k.a. stack layouts), which are special types of linear graph layouts in which edges are represented by (-monotone) semi-arcs that do not cross each other and the spine. We rely on the following result by Felsner, Fusy, Noy, and Orden [21]:
Lemma 4 ([21]).
Let be a bipartite planar graph. Then admits a (crossing-free) stack layout with order in which edge with (resp., ) is drawn as a semi-arc above (resp., below) the spine.
The lemma yields a -page book embedding for a maximal planar bipartite graph (a quadrangulation) using its separating decomposition. Intuitively, a separating decomposition for a quadrangulation with a fixed planar embedding is an orientation and a (red/blue) coloring of the edges such that every vertex (except two special vertices on the outer face) is incident to a non-empty interval of red edges followed by a non-empty interval of blue edges in the cyclic order around the vertex. Such a decomposition naturally defines an equatorial line that separates blue and red edges. The properties of the separating decomposition imply Section 2.3.2, that is, the existence of a -page book embedding in which the equatorial line is a spine and red/blue edges form two trees, that are called alternating in [21]. One tree contains the edges above the spine and another one contains the edges below the spine; see Figure 1(d). We refer to Figure 2 for an illustration.
In order to apply the result, assume that is 1-planar. Then combining Section 2.3 and Section 2.3.2, it follows that admits a stack layout with two alternating trees. This enables to encode 1-planarity of as follows. Consider a pair of independent edges with and with ; assume that precedes in order . We forbid a crossing between and above or below the spine using the following constraints.
-
:
;
-
:
.
Theorem 5.
Let be a graph and be its subdivision. Then is 1-planar if and only if the SAT formula built for and comprised of variables and constraints is satisfiable.
Proof.
Assume a graph is 1-planar and be its subdivision. Consider a 1-planar drawing of and build graph by planarizing the drawing and subdividing non-crossed edges. Since is bipartite, there exists a stack layout given by Section 2.3.2. We use the order of vertices along the spine in the stack layout to assign variables and , satisfying constraints , , , , and . Since the edges do not cross each other, constraints and are also satisfied.
For the converse, note that variables and together with , , , , define a linear layout of , while and guarantee that there are no crossings between edges of . To get a 1-planar drawing of , smooth division vertices so that every edge of is represented by a pair of semi-arcs; merged division vertices correspond to edge crossings.
2.4 Optimizations
Here we describe additional tricks to reduce the search space and speed up SAT solvers for recognizing 1-planar graphs. The first one is an improvement to relative variables, . Observe that constraint enforces associativity for pairs of vertices that cannot be merged, including for example, pairs of original vertices. While modern SAT solvers are able to simplify a formula substituting variable with (or vice versa), we found that performing this substitution directly during formula generation reduces both memory usage and solver runtime.
For the next optimization, we exploit a well-known property of 1-planar drawing. Consider a pair of crossing edges and ; then neither of the four adjacent edges (also called the kite edges in [10]) can participate in a crossing. This leads to a set of extra constraints that forbid such a crossing: , where is one of the kite edges corresponding to pair and is an arbitrary edge of .
A particularly useful technique for improving the effectiveness of our approach is reducing the size of candidate pairs of edges that can cross in a 1-planar drawing, . To this end, consider a potential crossing between edges and . In certain cases, it might be possible to exchange the positions of and (swap and ) while keeping the remaining vertices of unchanged so as to eliminate the crossing. Consider the neighborhoods (set of adjacent vertices) of and , that is, and . If coincides with and at most one edge out of is present in , then one can swap and and eliminate the crossing from the drawing; see Figure 3(a). Hence, we may assume that and remove the pair from the candidate set . An extension of the rule can be applied for multiple crossing pairs. For example, if there are two crossings between and and between with and (see Figure 3(b)), then again swapping and reduces the number of crossings. In our implementation, we enumerate all possible pairs of crossings and test if swapping two vertices reduces the number of crossings; the corresponding 2-clauses forbidding one of the crossings are then added to the formula.
Finally, we observe that when a 1-planar drawing of a graph exists, it is not unique. In other words, there might be multiple satisfying assignments for a formula. To reduce the search space explored by a SAT solver, we employ symmetry breaking techniques; a similar approach has been used by Bekos, Kaufmann, and Zielke [9] in the context of finding stack layouts of graphs. It is easy to see that one chosen vertex, say , can be assumed to be the first in the order. This is enforced by constraints for all . Furthermore, we may force a relative order for twin vertices whose neighborhoods are identical; that is, for pairs of twins . Last but not least, we integrate into the implementation of OOPS two generic symmetry-breaking engines, that can analyze the entire formula and add extra constraints without changing its satisfiability.
2.5 Extensions
It is possible to extend the schemes provided in Sections 2.3.1 and 2.3.2 to several other tasks in the area of 1-planarity. Recall that a graph is NIC-planar (resp., IC-planar) if it admits a 1-planar drawing in which two pairs of crossing edges share at most one (resp., zero) vertices. This can be straightforwardly formulated using the following constraints: Let be a division vertex adjacent to original vertices and . We consider distinct division vertices and whenever (resp., ), we introduce constraint to forbid a crossing for one of the pairs.
Another interesting extension is for directed acyclic graphs (DAG), whose 1-planarity has been recently studied [3, 4]. In this context, the input is a DAG and the question is whether it admits an upward drawing with at most one crossing per edge; a drawing is upward if for every (directed) edge , the -coordinate of is less than the -coordinate of . Our Hanani-Tutte encoding scheme can be applied for the setting by enforcing additional directional constraints for every edge of the DAG.
3 Experiments
To validate the effectiveness of OOPS, we conduct an experimental evaluation focusing on three objectives. (i) Analyze how well does the algorithm perform in terms of quality and scalability compared to alternatives. (ii) Study how available parameters of the algorithm contribute to its performance. (iii) Show how OOPS can be used as a discovery tool to answer open research questions in graph drawing and topological graph theory.
The experiments presented in this section were conducted in two modes referred to as single-core and parallel. For the former, we utilize a Linux-based laptop with a 3.6 GHz Intel Core Ultra 5 125U processor having GB RAM. For the latter, we use a more powerful server with a dual-node multi-core 3.2 GHz Intel Xeon Platinum 8488C (Sapphire) processor having GB RAM. Single-core computations are based on the (sequential) MapleGlucose SAT solver [41, 37], while parallel experiments use up to 32 cores of the server machine running Painless SAT solver [42, 30]. To enhance SAT solving, one can optionally use integrated symmetry-breaking engines, BreakID [18] and satsuma [2].
Our algorithm, OOPS, is fully open sourced [34]; the implementation is self-contained (except for the optional parallel mode, which requires a parallel SAT solver) and can be built with a C++ compiler having C++17 support.
3.1 Comparison with Alternatives
Here we analyze how the SAT-based 1-planarity solver compares to alternative solutions. Arguably the simplest approach for testing 1-planarity is based on an exhaustive search, which enumerates all possible combinations of crossing edges, inserts a dummy vertex for every crossing, and tests whether the resulting graph is planar. We call the heuristic brute-force; refer to [34] for the implementation. Another candidate solver is by Binucci, Didimo, and Montecchiani [10], which we refer to as 1PlanarTester. Since the solver is not open sourced111There exists an implementation of the algorithm at https://github.com/seemanne/1PlanarTester but a close inspection of the source code reveals substantial gaps both in performance and correctness; thus, we do not use it in our evaluation., we use the same datasets and report the measurements presented in the paper [10]. The algorithms are compared with two versions of our SAT-based solver, described in Section 2.3.1 and Section 2.3.2; they are referred to as OOPS (H-T) and OOPS (Stack), respectively222Further heuristics are being developed independently by Fink, Münch, Pfretzschner, and Rutter [22]..
We use the following datasets to compare the solvers:
-
north50 graphs is a subset of the north benchmark [45] containing all instances with at most vertices; all planar graphs have been removed from the collection, resulting in a total of instances;
-
rome50 graphs is a set of all non-planar Rome graphs [45] with at most vertices; it contains instances.
In addition to the real-world graphs, we selected two datasets of graphs containing edges. The synthetic graph data is generated with the geng tool from nauty [43, 31].
-
3reg-gir7 are all connected cubic (-regular) graphs with and having girth ; all but five instances are known to be 1-planar;
-
5reg-b is a random sample of connected -regular bipartite graphs with ; all the graphs are non-1-planar.
| benchmark | algorithm | 1-planar | non-1-planar | unsolved | ||
| instances | runtime, sec | instances | runtime, sec | instances | ||
| north50 | 1PlanarTester | |||||
| brute-force | ||||||
| OOPS (H-T) | ||||||
| OOPS (Stack) | ||||||
| rome50 | 1PlanarTester | |||||
| brute-force | ||||||
| OOPS (H-T) | ||||||
| OOPS (Stack) | ||||||
| 3reg-gir7 | brute-force | |||||
| OOPS (H-T) | ||||||
| OOPS (Stack) | ||||||
| 5reg-b | brute-force | |||||
| OOPS (H-T) | ||||||
| OOPS (Stack) | ||||||
We report the results of the experiment in Table 1, which contain the number of identified 1-planar and non-1-planar instances, along with the mean processing times (in seconds) and confidence intervals, for each of the benchmarks. To run the brute-force and OOPS solvers on the data, we use the single-core mode (which is comparable to the configuration reported in [10]) and set the runtime limit for each execution to minutes; for comparison, the runtime limit of 1PlanarTester in [10] is set to hours.
One prominent observation from the results is that there is a large gap between SAT-based approaches (OOPS) and the naïve ones (brute-force and 1PlanarTester). In most of the cases, OOPS is able to solve substantially more instances, both in the 1-planar and non-1-planar category. The relatively low runtime of 1PlanarTester suggests that it can handle only “easy” instances that do not require exploring a large search space. Similarly, the performance of brute-force on rome50, where it solves two thirds of the cases, implies that the collection contains many almost-planar graphs that require two or three crossings. The difference becomes striking for the “harder” collections, 3reg-gir7 and 5reg-b, where the exhaustive search is not able to solve any instance, while OOPS (Stack) solves a majority of cases. For this reason, we do not consider existing algorithms as a viable alternative to the new SAT-based technique.
A comparison between Hanani-Tutte and Stack SAT encodings reveals a significant advantage of the latter on all the benchmarks. While both encodings contain variables and constraints, the Stack-based encoding is more succinct, requiring approximately half as many constraints on the data. (Note however, that Hanani-Tutte-based encoding might be more flexible, as discussed in Section 2.5). Thus, we use the Stack-based encoding as a default one in the following experiments.
3.2 Named Graphs
To further validate OOPS on a real-world benchmark, we apply the algorithm for a collection of named Wikipedia graphs available at [44]. We filtered out all planar instances, and all dense instances with that are obviously non-1-planar, and all instances with , which are likely too difficult for our algorithm. The remaining graphs are tested with OOPS using the Stack-based encoding in the parallel mode. The status of 1-planarity, NIC-planarity, and IC-planarity (refer to Section 2.5) are presented in Table 2. Here we enforce a time limit of hours for the SAT solver.
To the best of our knowledge, this is the first study of 1-planarity for many of the graphs in the dataset. OOPS is able to determine the status in the majority of the cases. Interestingly, all the unsolved instances (marked TLE in the table) correspond to cubic (-regular) graphs. To understand the performance of OOPS on the data, we plot its runtime as a function of the number of edges in the graph; see Figure 4. We look separately at satisfiable SAT instances (that is, 1-planar graphs) and non-satisfiable ones. Observe that on the benchmark data, every 1-planar graph takes less than seconds (and less than seconds for NIC/IC-planar instances). In contrast, most of the non-1-planar instances require substantially more time: the median runtime is around minutes, the mean is over hours, while the maximum (measured on IC-planarity of Tutte-Coxeter) is hours. The memory consumption of a SAT solver (Painless in this case) follows the same trend: it is below of RAM for all 1-planar instances but reaches GB on the hardest non-1-planar graphs. Given the amount of RAM required for processing non-satisfiable instances, it seems tempting to explore alternative SAT solving strategies, such as cloud-based or incremental, which we leave as a possible future work.
We have also evaluated the encoding optimizations presented in Section 2.4. While the optimizations have a moderate impact on the runtime of OOPS for 1-planar graphs, they are very helpful for large non-1-planar instances. For example, while proving non-1-planarity of the Robertson graph requires seconds using the basic encoding (Section 2.3.2), it needs seconds with the optimizations, a speed up. For larger instances, the impact is even more pronounced: (reduction from hours to minutes) for the Brinkmann graph, and (from to hours) for Holt.
| graph name | vertices | edges | degrees | 1-planar | NIC | IC |
|---|---|---|---|---|---|---|
| Petersen | 10 | 15 | yes | yes | yes | |
| Franklin | 12 | 18 | yes | yes | yes | |
| Tietze | 12 | 18 | yes | yes | yes | |
| Grotzsch | 11 | 20 | yes | no | no | |
| Heawood | 14 | 21 | yes | yes | yes | |
| Chvatal | 12 | 24 | yes | yes | no | |
| Möbius–Kantor | 16 | 24 | yes | yes | yes | |
| Sousselier | 16 | 27 | yes | yes | no | |
| Blanusa Snark (1st) | 18 | 27 | yes | yes | yes | |
| Blanusa Snark (2nd) | 18 | 27 | yes | yes | yes | |
| Pappus | 18 | 27 | yes | yes | no | |
| Desargues | 20 | 30 | yes | yes | no | |
| Flower snark (J5) | 20 | 30 | yes | yes | no | |
| Hoffman | 16 | 32 | no | no | no | |
| Loupekine snark (1st) | 22 | 33 | yes | yes | no | |
| Loupekine snark (2nd) | 22 | 33 | yes | yes | no | |
| McGee | 24 | 36 | yes | yes | no | |
| Nauru | 24 | 36 | yes | yes | no | |
| Truncated octahedral | 24 | 36 | yes | yes | yes | |
| Robertson | 19 | 38 | no | no | no | |
| Paley-13 | 13 | 39 | no | no | no | |
| F26A | 26 | 39 | yes | yes | no | |
| Clebsch | 16 | 40 | no | no | no | |
| Folkman | 20 | 40 | no | no | no | |
| Brinkmann | 21 | 42 | no | no | no | |
| Flower snark (J7) | 28 | 42 | yes | yes | no | |
| Coxeter | 28 | 42 | yes | TLE | no | |
| Double-Star snark | 30 | 45 | yes | yes | no | |
| Tutte-Coxeter | 30 | 45 | TLE | TLE | no | |
| Shrikhande | 16 | 48 | no | no | no | |
| Dyck | 32 | 48 | yes | yes | no | |
| Holt | 27 | 54 | no | no | no | |
| Barnette–Bosák–Lederberg | 38 | 57 | yes | yes | yes | |
| Tutte | 46 | 69 | yes | yes | yes | |
| Great rhombicuboctahedral | 48 | 72 | yes | yes | yes | |
| Foster cage | 30 | 75 | no | no | no | |
| Meringer | 30 | 75 | no | no | no | |
| Robertson–Wegner | 30 | 75 | no | no | no | |
| Wong | 30 | 75 | no | no | no | |
| Szekeres snark | 50 | 75 | yes | yes | yes | |
| Watkins snark | 50 | 75 | yes | yes | yes | |
| Wells | 32 | 80 | no | no | no | |
| Ellingham–Horton (54) | 54 | 81 | yes | yes | TLE | |
| Gray | 54 | 81 | TLE | TLE | TLE | |
| Klein (7-regular) | 24 | 84 | no | no | no | |
| Klein (cubic) | 56 | 84 | TLE | TLE | TLE | |
| Sylvester | 36 | 90 | no | no | no |
3.3 Applications
Arguably among the most natural applications of a tool for recognizing 1-planar graphs is finding the smallest non-1-planar instance in a family of graphs.
Problem 1.
What is the smallest non-1-planar instance in a family of graphs?
This question has two flavors depending on whether one is interested in vertex-minimal or edge-minimal instances. For planar graphs, it is well-known that smallest non-planar graphs contain vertices () or edges (). For 1-planar graphs, it is known that is the smallest complete non-1-planar graphs (see e.g., [16]), however, no such bound is known for non-1-planar edge-minimal graph. To fill the gap, we computationally tested all simple connected instances with up to edges (generated with [43]). All graphs with up to are 1-planar and there are exactly (out of connected) non-1-planar instances with ; see Figure 5. For bipartite graphs, a graph on vertices (in fact, as shown by Czap and Hudák [16]) is one of the two vertex-minimal bipartite non-1-planar graphs. The second such graph, namely , is in addition the unique edge-minimal bipartite non-1-planar graph; see Figure 5(d). This is confirmed by testing all connected bipartite graphs with and all smaller instances.
A related question (discussed in [47]) is: What is the minimum difference between edge and vertex counts in a connected non-1-planar graph? For planar graphs, one can show (see [47]) that every connected graph with is planar, while non-planar has . For 1-planarity, such a condition is unknown. Existing non-1-planar graphs, such as and [16], indicate that the difference can be . The two examples we found (Figures 5(a) and 5(d)) reduce the bound to . It is intriguing to fully resolve the question.
A particularly challenging variant of Problem 1 is to find the smallest 3-regular (cubic) graph that is not 1-planar. While it is easy to show (see e.g., [19]) that random (large) cubic graphs are not 1-planar, the smallest such instance is unknown.
In an attempt to answer the question, Eppstein [46] manually constructed 1-planar drawings of several graphs and suggested that either the Coxeter graph or the Tutte-Coxeter graph is not 1-planar. As pointed out in Table 2, the former is a 1-planar instance; see Figure 6. The latter is very likely non-1-planar, but we were unable to fully verify it, despite running several (parallel) SAT solvers for days. We did, however, verify 1-planarity of (i) all cubic graphs with up to vertices and of (ii) all cubic bipartite graphs with up to vertices. Note that there are around such instances and the total computation took machine-months (an equivalent of ms per instance).
As another application of OOPS, we investigate the following question proposed by Zhang, Ouyang, and Huang [38] regarding claw-free -planar graphs; recall that a claw is graph .
Problem 2 ([38]).
Does there exist infinitely many -connected claw-free 1-planar graphs?
In fact, the original version of the paper [38] suggests a candidate family, namely the cube of a cycle . That is, a graph with vertex set in which an edge exists if . Such graphs are (i) claw-free, since the neighborhood of any vertex is an interval on the cycle, so no vertex can have three pairwise non-adjacent neighbors, and (ii) -connected (for ), since to disconnect two vertices, and , one needs to remove three consecutive vertices going clockwise from to and the same counter-clockwise. However, the status of 1-planarity of such graphs is open. Using OOPS, we verified that such graphs are indeed 1-planar whenever for every .
Theorem 6.
Let be a graph obtained from a cycle by connecting every pair of vertices that are at most edges apart in . Then is 1-planar if for every .
Proof.
Let the vertices of for be . Split the vertices into (consecutive) groups of size four, that is, ; observe that all the edges of are either within the same group or between vertices of two consecutive groups (modulo ). A 1-planar drawing is built by placing the vertices on a horizontal line (spine), following the order given by the groups. Within -th group, , place the four vertices in the order if is even, and in the order if is odd; see Figure 7. Because of the symmetry, we only need to specify the drawing of the edges between groups and , and between groups and . Refer to Figure 7(c) for the construction; note that most edges are represented as semi-arcs (either above or below the spine) except for one inter-group edge for every pair of groups, which is a bi-arc, e.g., edges , , and in the figure.
According to OOPS (for small values of ), graph is 1-planar only if but proving that direction might be challenging.
4 Conclusion
We presented OOPS, a new SAT-based algorithm for testing 1-planarity and provided its implementation [34] to facilitate further research in the field. While the algorithm is shown to be useful for resolving various problems concerning 1-planarity of specific graph families, many questions remain unanswered. One particularly challenging task, discussed in Section 3.3, is finding the smallest cubic graph that is not 1-planar. We conjecture that the Tutte-Coxeter graph is such an instance, along with other -vertex graphs of girth , for which none of the tested (parallel) SAT solvers was able to find a solution even after a week of processing. We stress that proving the minimality would also require finding a 1-planar drawing for more than forty billion -vertex cubic graphs.
Another intriguing direction to explore is 1-planarity of DAGs; see Section 2.5 for an adaptation of OOPS for the case. Among many possible questions to study (refer for example to [32, 3]), we highlight one discussed by Angelini et al. [3, 4]:
Finally, extending our formulations or designing new ones for other classes of beyond-planar graphs, such as -planar graphs for , is of interest. While there is a straightforward adaptation of our scheme to -planarity (by inserting more division vertices per edge and enforcing appropriate merging rules), it might not be effective in practice due to the explosion of the search space. Hence, designing further techniques for simplifying or restricting the resulting SAT formulas, in addition to the ones discussed in Section 2.4, is an avenue for future research.
References
- [1] Michael O Albertson. Chromatic number, independence ratio, and crossing number. Ars Math. Contemp., 1(1):1–6, 2008. doi:10.26493/1855-3974.10.2D0.
- [2] Markus Anders, Sofia Brenner, and Gaurav Rattan. Satsuma: Structure-based symmetry breaking in SAT. In Supratik Chakraborty and Jie-Hong Roland Jiang, editors, Theory and Applications of Satisfiability Testing, volume 305 of LIPIcs, pages 4:1–4:23, 2024. doi:10.4230/LIPICS.SAT.2024.4.
- [3] Patrizio Angelini, Therese Biedl, Markus Chimani, Sabine Cornelsen, Giordano Da Lozzo, Seok-Hee Hong, Giuseppe Liotta, Maurizio Patrignani, Sergey Pupyrev, Ignaz Rutter, and Alexander Wolff. The price of upwardness. In International Symposium on Graph Drawing and Network Visualization (GD), volume 320, pages 13:1–13:20, 2024. doi:10.4230/LIPIcs.GD.2024.13.
- [4] Patrizio Angelini, Therese Biedl, Markus Chimani, Sabine Cornelsen, Giordano Da Lozzo, Seok-Hee Hong, Giuseppe Liotta, Maurizio Patrignani, Sergey Pupyrev, and Ignaz Rutter. The price of upwardness. Discret. Math. Theor. Comput. Sci., 27(3), 2025. doi:10.46298/DMTCS.15222.
- [5] Christopher Auer, Christian Bachmaier, Franz J Brandenburg, Andreas Gleißner, Kathrin Hanauer, Daniel Neuwirth, and Josef Reislhuber. Outer 1-planar graphs. Algorithmica, 74(4):1293–1320, 2016. doi:10.1007/S00453-015-0002-1.
- [6] Christopher Auer, Franz Brandenburg, Andreas Gleißner, and Josef Reislhuber. 1-planarity of graphs with a rotation system. Journal of Graph Algorithms and Applications, 19(1):67–86, 2015. doi:10.7155/JGAA.00347.
- [7] Christian Bachmaier, Franz J Brandenburg, Kathrin Hanauer, Daniel Neuwirth, and Josef Reislhuber. NIC-planar graphs. Discret. Appl. Math., 232:23–40, 2017. doi:10.1016/J.DAM.2017.08.015.
- [8] Michael J. Bannister, Sergio Cabello, and David Eppstein. Parameterized complexity of 1-planarity. J. Graph Algorithms Appl., 22(1):23–49, 2018. doi:10.7155/JGAA.00457.
- [9] Michael A. Bekos, Michael Kaufmann, and Christian Zielke. The book embedding problem from a SAT-solving perspective. In Emilio Di Giacomo and Anna Lubiw, editors, Graph Drawing and Network Visualization GD, volume 9411 of Lecture Notes in Computer Science, pages 125–138. Springer, 2015. doi:10.1007/978-3-319-27261-0_11.
- [10] Carla Binucci, Walter Didimo, and Fabrizio Montecchiani. 1-planarity testing and embedding: An experimental study. Comput. Geom., 108:101900, 2023. doi:10.1016/J.COMGEO.2022.101900.
- [11] Rainer Bodendiek, H Schumacher, and Klaus Wagner. Über 1-optimale graphen. Mathematische Nachrichten, 117(1):323–339, 1984. doi:10.1002/mana.3211170125.
- [12] O. V. Borodin. Solution of the Ringel problem on vertex-face coloring of planar graphs and coloring of 1-planar graphs. Metody Diskret. Analiz., 41(108):12–26, 1984.
- [13] Franz J. Brandenburg. Characterizing and recognizing 4-map graphs. Algorithmica, 81(5):1818–1843, 2019. doi:10.1007/S00453-018-0510-X.
- [14] Sergio Cabello and Bojan Mohar. Adding one edge to planar graphs makes crossing number and 1-planarity hard. SIAM J. Comput., 42(5):1803–1829, 2013. doi:10.1137/120872310.
- [15] Markus Chimani and Robert Zeranski. Upward planarity testing in practice: SAT formulations and comparative study. ACM J. Exp. Algorithmics, 20:1–27, 2015. doi:10.1145/2699875.
- [16] Július Czap and Dávid Hudák. 1-planarity of complete multipartite graphs. Discret. Appl. Math., 160(4–5):505–512, 2012. doi:10.1016/J.DAM.2011.11.014.
- [17] Július Czap and Dávid Hudák. On drawings and decompositions of 1-planar graphs. Electron. J. Comb., 20(2):54, 2013. doi:10.37236/2392.
- [18] Jo Devriendt and Bart Bogaerts. BreakID: Static symmetry breaking for ASP (system description). arXiv preprint arXiv:1608.08447, 2016. arXiv:1608.08447.
- [19] Vida Dujmovic, Ken-ichi Kawarabayashi, Bojan Mohar, and David R. Wood. Improved upper bounds on the crossing number. In Proceedings of the Twenty-Fourth Annual Symposium on Computational Geometry, pages 375–384. ACM, 2008. doi:10.1145/1377676.1377739.
- [20] Eduard Eiben, Robert Ganian, Thekla Hamm, Fabian Klute, and Martin Nöllenburg. Extending partial 1-planar drawings. In Artur Czumaj, Anuj Dawar, and Emanuela Merelli, editors, International Colloquium on Automata, Languages, and Programming, LIPIcs, pages 43:1–43:19, 2020. doi:10.4230/LIPIcs.ICALP.2020.43.
- [21] Stefan Felsner, Éric Fusy, Marc Noy, and David Orden. Bijections for Baxter families and related objects. Journal of Combinatorial Theory, Series A, 118(3):993–1020, 2011. doi:10.1016/j.jcta.2010.03.017.
- [22] Simon D. Fink, Miriam Münch, Matthias Pfretzschner, and Ignaz Rutter. Heuristics for exact 1-planarity testing. In Vida Dujmović and Fabrizio Montecchiani, editors, 33rd International Symposium on Graph Drawing and Network Visualization (GD 2025), Leibniz International Proceedings in Informatics (LIPIcs), pages 4:1–4:19, Dagstuhl, Germany, 2025. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.GD.2025.4.
- [23] Radoslav Fulek, Michael J. Pelsmajer, Marcus Schaefer, and Daniel Štefankovič. Hanani-Tutte, monotone drawings, and level-planarity. In János Pach, editor, Thirty Essays on Geometric Graph Theory, pages 263–287. Springer, 2013. doi:10.1007/978-1-4614-0110-0_14.
- [24] Alexander Grigoriev and Hans L Bodlaender. Algorithms for graphs embeddable with few crossings per edge. Algorithmica, 49(1):1–11, 2007. doi:10.1007/s00453-007-0010-x.
- [25] Seok-Hee Hong, Peter Eades, Naoki Katoh, Giuseppe Liotta, Pascal Schweitzer, and Yusuke Suzuki. A linear-time algorithm for testing outer-1-planarity. Algorithmica, 72:1033–1054, 2015. doi:10.1007/s00453-014-9890-8.
- [26] Yuanqiu Huang, Zhangdong Ouyang, and Fengming Dong. On the sizes of bipartite 1-planar graphs. Electron. J. Comb., 28(2):2, 2021. doi:10.37236/10012.
- [27] Dmitri V Karpov. An upper bound on the number of edges in an almost planar bipartite graph. Journal of Mathematical Sciences, 196:737–746, 2014. doi:10.1007/s10958-014-1690-9.
- [28] Stephen G Kobourov, Giuseppe Liotta, and Fabrizio Montecchiani. An annotated bibliography on 1-planarity. Computer Science Review, 25:49–67, 2017. doi:10.1016/j.cosrev.2017.06.002.
- [29] Vladimir P Korzhik and Bojan Mohar. Minimal obstructions for 1-immersions and hardness of 1-planarity testing. Journal of Graph Theory, 72(1):30–71, 2013. doi:10.1002/jgt.21630.
- [30] Ludovic Le Frioux, Souheib Baarir, Julien Sopena, and Fabrice Kordon. PaInleSS: A framework for parallel SAT solving. In Theory and Applications of Satisfiability Testing, pages 233–250. Springer, 2017. doi:10.1007/978-3-319-66263-3_15.
- [31] Brendan D. McKay and Adolfo Piperno. Practical graph isomorphism, ii. Journal of Symbolic Computation, 60:94–112, 2014. doi:10.1016/j.jsc.2013.09.003.
- [32] Martin Nöllenburg and Sergey Pupyrev. On families of planar dags with constant stack number. In Michael A. Bekos and Markus Chimani, editors, Graph Drawing and Network Visualization (GD), pages 135–151. Springer, 2023. doi:10.1007/978-3-031-49272-3_10.
- [33] János Pach and Géza Tóth. Monotone drawings of planar graphs. Journal of Graph Theory, 46(1):39–47, 2004. doi:10.1002/jgt.10168.
- [34] Sergey Pupyrev. spupyrev/oops. Software (visited on 2025-11-07). URL: https://github.com/spupyrev/oops, doi:10.4230/artifacts.25056.
- [35] Sergey Pupyrev. A collection of existing results on stack and queue numbers. https://spupyrev.github.io/linearlayouts.html, 2020. Accessed: 5/23/2025.
- [36] Gerhard Ringel. Ein Sechsfarbenproblem auf der Kugel. In Abhandlungen aus dem Mathematischen Seminar der Universität Hamburg, volume 29, pages 107–117. Springer, 1965. doi:10.1007/BF02996313.
- [37] Vincent Vallade, Ludovic Le Frioux, Razvan Oanea, Souheib Baarir, Julien Sopena, Fabrice Kordon, Saeed Nejati, and Vijay Ganesh. New concurrent and distributed painless solvers: p-mcomsps, pmcomsps-com, p-mcomsps-mpi, and p-mcomsps-com-mpi. SAT Competition, page 40, 2021.
- [38] Licheng Zhang, Zhangdong Ouyang, and Yuanqiu Huang. Maximum degree and connectivity on claw-free -planar graphs, 2025. v1 accessed: 1/25/2025. arXiv:2501.15124.
- [39] Xin Zhang. Drawing complete multipartite graphs on the plane with restrictions on crossings. Acta Mathematica Sinica, English Series, 30(12):2045–2053, 2014. doi:10.1007/s10114-014-3763-6.
- [40] Xin Zhang and Guizhen Liu. The structure of plane graphs with independent crossings and its applications to coloring problems. Central European Journal of Mathematics, 11:308–321, 2013. doi:10.2478/s11533-012-0094-7.
- [41] MapleGlucose SAT solver. https://maplesat.github.io/solvers.html, 2021.
- [42] Painless SAT solver. https://www.lrde.epita.fr/wiki/Painless, 2021.
- [43] nauty and Traces. https://pallini.di.uniroma1.it. Accessed: 5/23/2025.
- [44] List of graphs by edges and vertices. https://en.wikipedia.org/wiki/List_of_graphs_by_edges_and_vertices. Accessed: 5/23/2025.
- [45] AT&T and Rome graphs. http://graphdrawing.org/data.html. Accessed: 5/23/2025.
- [46] David Eppstein. Cubic 1-planarity. https://11011110.github.io/blog/2014/05/11/cubic-1-planarity.html. Accessed: 5/23/2025.
- [47] Mathematics StackExchange. Lower bound on the number of edges in a non-k-planar graph. https://math.stackexchange.com/questions/4637623. Accessed: 5/23/2025.
- [48] Mathematics StackExchange. Can a 3-regular non-1-planar graph be constructed? https://mathoverflow.net/questions/441370. Accessed: 5/23/2025.
