Crossing Minimization for 1-page and 2-page Drawings of Graphs with Bounded Treewidth

We investigate crossing minimization for 1-page and 2-page book drawings. We show that computing the 1-page crossing number is fixed-parameter tractable with respect to the number of crossings, that testing 2-page planarity is fixed-parameter tractable with respect to treewidth, and that computing the 2-page crossing number is fixed-parameter tractable with respect to the sum of the number of crossings and the treewidth of the input graph. We prove these results via Courcelle's theorem on the fixed-parameter tractability of properties expressible in monadic second order logic for graphs of bounded treewidth.


Introduction
A k-page book embedding of a graph G is a drawing that places the vertices of G on a line (the spine of the book) and draws each edge, without crossings, inside one of k half-planes bounded by the line (the pages of the book) [19,22]. In one common drawing style, an arc diagram, the edges in each page are drawn as circular arcs perpendicular to the spine [27], but the exact shape of the edges is unimportant for the existence of book embeddings. These embeddings can be generalized to k-page book drawings: as before, we place each vertex on the spine and each edge within a single page, but with crossings allowed. The crossing number of such a drawing is defined to be the sum of the numbers of crossings within each page, and the k-page crossing number cr k (G) is the minimum number of crossings in any k-page book drawing [25]. In an optimal drawing, two edges in the same page cross if and only if their endpoints form interleaved intervals on the spine, so the problem of finding an optimal drawing may be solved by finding a permutation of the vertices and an assignment of edges to pages minimizing the number of pairs of edges with interleaved intervals on the same page.
As with most crossing minimization problems, k-page crossing minimization is NP-hard; even the simple special case of testing whether the 2-page crossing number is zero is NP-complete [8]. However, it may still be possible to solve these problems in polynomial time for restricted families of graphs and restricted values of k. For instance, recently Bannister, Eppstein and Simons [3] showed the computation of cr 1 (G) and cr 2 (G) to be fixed-parameter tractable in the almost-tree parameter; here, a graph G has almost-tree parameter k if every biconnected component of G can be reduced to a tree by removing at most k edges. In this paper we improve these results by finding fixedparameter tractable algorithms for stronger parameters, allowing k-page crossing minimization to be performed in polynomial time for a much wider class of graphs.

New results
We design fixed-parameter algorithms for computing the minimum number of crossings cr 1 (G) in a 1-page drawing of a graph G, and the minimum number of crossings cr 2 (G) in a 2-page drawing of G. Ideally, fixed-parameter algorithms for crossing minimization should be parameterized by their natural parameter, the optimal number of crossings. We achieve this ideal bound, for the first time, for cr 1 (G). However, for cr 2 (G), even testing whether a given graph is 2-page planar (that is, whether cr 2 (G) = 0) is NP-complete [8]. Therefore, unless P = NP, there can be no fixed-parameter-tractable algorithm parameterized by the crossing number. Instead, we show that cr 2 (G) is fixed-parameter tractable in the sum of the natural parameter and the treewidth of G. One consequence of our result on cr 2 (G) is that it is possible to test whether a given graph is 2-page planar, in time that is fixed-parameter tractable with respect to treewidth.
We construct these algorithms via Courcelle's theorem [9,10], which connects the expressibility of graph properties in monadic second order logic with the fixed-parameter tractability of these properties with respect to treewidth. Recall that second order logic extends first order logic by allowing the quantification of k-ary relations in addition to quantification over individual elements. In monadic second order logic we are restricted to quantification over unary relations (equivalently subsets) of vertices and edges. The property of having a 2-page book embedding is easy to express in (full) second-order logic, via the known characterization that a graph has such an embedding if and only if it is a subgraph of a Hamiltonian planar graph [4]. However, this expression is not allowed in monadic second-order logic because the extra edges needed to make the input graph Hamiltonian cannot be described by a subset of the existing vertices and edges of the graph. Instead, we prove a new structural description of 2-page planarity that is more easily expressed in monadic second order logic.

Related work
As well as the previous work on crossing minimization for almost-trees [3], related results in fixedparameter optimization of crossing number include a proof by Grohe, using Courcelle's theorem, that the topological crossing number of a graph is fixed-parameter tractable in its natural parameter [18]. This result was later improved by Kawarabayashi and Reed [20]. Based on these results the crossing number itself was also shown to be fixed-parameter tractable; Pelsmajer et al. showed a similar result for the odd crossing number [23]. In layered graph drawing, Dujmović et al. showed that finding a drawing with k crossings and h layers is fixed-parameter tractable in the sum of these two parameters; this result depends on a bound on the pathwidth of such a drawing, a parameter closely related to its treewidth [13].
Like many of these earlier algorithms, our algorithms have a high dependence on their parameter, rendering them impractical. For this reason we have not attempted an exact analysis of their complexity nor have we searched for optimizations to our logical formulae that would improve this complexity.

Bridges vs flaps and isthmuses
There is an unfortunate terminological confusion in graph theory: two different concepts, a maximal subgraph that is internally connected by paths that avoid a given cycle, and an edge whose removal disconnects the graph, are both commonly called bridges. We need both concepts in our algorithms. To avoid confusion, we call the subgraph-type bridges flaps and the edge-type bridges isthmuses.
To be more precise, given a graph G and a cycle C, we define an equivalence relation on the edges of G \ C in which two edges are equivalent if they belong to a path that has no interior vertices in C, and we define a flap of C to be the subgraph formed by an equivalence class of this relation. (In general, different cycles will give rise to different flaps.) And given a graph G, we define an isthmus of G to be an edge of G that does not belong to any simple cycles in G.

Treewidth and graph minors
The treewidth of G can be defined to be one less than the number of vertices in the largest clique in a chordal supergraph of G that (among possible chordal supergraphs) is chosen to minimize this clique size [6]. The problem of computing the treewidth of a general graph is NP-hard [1], but it is fixed-parameter tractable in its natural parameter [5].
A graph H is said to be a minor of a graph G if H can be constructed from G via a sequence edge contractions, edge deletions, and vertex deletions. It can be determined whether a graph H is a minor of a graph G, in time that is polynomial in the size of G and fixed-parameter tractable in the size of H [24].

Logic of graphs
We will be expressing graph properties in extended monadic second-order logic (MSO 2 ). This is a fragment of second-order logic that includes: variables for vertices, sets of vertices, edges, and sets of edges; binary relations for equality (=), inclusion of an element in a set (∈) and edge-vertex incidence (I); the standard propositional logic operations: ¬, ∧, ∨, →; the universal quantifier (∀) and the existential quantifier (∃), both which may be applied to variables of any of the four variable types.
To distinguish the variables of different types, we will use u, v, w, . . . for vertices, e, f, g, . . . for edges, and capital letters for sets of vertices or edges (with context making clear which type of set). Given a graph G and an MSO 2 formula φ we write G |= φ ("G models φ") to express the statement that φ is true for the vertices, edges, and sets of vertices and edges in G, with the semantics of this relation defined in the obvious way. MSO 2 differs from full second order logic in that it allows quantification over sets, but not over higher order relations, such as sets of pairs of vertices that are not subsets of the given edges. In Appendix A, we provide a brief introduction to MSO 2 logic in which we describe how to express some of the properties we need for our results.
The reason we care about expressing graph properties in MSO 2 is the following powerful algorithmic meta-theorem due to Courcelle.
Lemma 1 (Courcelle's theorem [9,10]). Given an integer k ≥ 0 and an MSO 2 -formula φ of length , an algorithm can be constructed that takes as input a graph G of treewidth at most k and decides in O f (k, ) · (n + m) time whether G |= φ, where the function f appearing in the time bound is a computable function of the treewidth k and formula length .

Combinatorial enumeration of crossing diagrams
In order to show that the properties we study can be represented by logical formulas of finite length, we need to bound the number of combinatorially distinct ways that a subset of edges in a k-page graph drawing can cross each other.
We define a 1-page crossing diagram to be a placement of some points on the circumference of a circle, together with some straight line segments connecting the points such that each point is incident to a segment, no segment is uncrossed and no three segments cross at the same point. Two crossing diagrams are combinatorially equivalent if they have the same numbers of points and line segments and there exists a cyclic-order-preserving bijection of their points that takes line segments to line segments. The crossing number of a 1-page crossing diagram is the number of pairs of its line segments that cross each other.
We define a 2-page crossing diagram to be a 1-page crossing diagram together with a labeling of its line segments by two colors. For a 2-page crossing diagram we define the crossing number to be the total number of crossing pairs of line segments that have the same color as each other. Similarly, every 2-page crossing diagram can be represented by a subset of the same 4k points, and two disjoint subsets of pairs of points, which again can be bounded by 2 O(k 2 ) .
Two combinatorially equivalent crossing diagrams, as defined above, may have a topology that differs from each other, or from combinatorially equivalent diagrams with curved edges. This is because, for an edge with multiple crossings, the order of the crossings along this edge may differ from one diagram to another, but this ordering is not considered as part of the definition of combinatorial equivalence. For our purposes such differences are unimportant, as we are concerned only with the total number of crossings. So we consider two crossing diagrams to be equivalent if they have the same crossing pairs of edges, regardless of whether the crossings occur in the same order.

Outerplanarity
Recall that a graph is outerplanar if there exists a placement of its vertices on the circumference of a circle such that when its edges are drawn as straight line segments they do not cross. Topologically, the circle and the half-plane are equivalent, so a graph is outerplanar if and only if it has a crossingfree 1-page drawing. For incorporating a test of outerplanarity into methods using Courcelle's theorem, it is convenient to use a standard characterization of the outerplanar graphs by forbidden minors: Lemma 3 (Chartrand and Harary [7]). A graph G is outerplanar (1-page planar) if and only if it contains neither K 4 nor K 2,3 as a minor.
Lemma 4 (Corollary 1.15 in [10]). Given any fixed graph H there exists a MSO 2 -formula φ such that, for all graphs G, G |= φ if and only if G contains H as a minor. We will write minor H for φ.
Let outerplanar be the formula ¬ minor K 4 ∧¬ minor K 2,3 . Then Lemma 3 implies that, for all graphs G, G |= outerplanar if and only if G is outerplanar. Because outerplanar graphs have bounded treewidth (at most two), Courcelle's theorem together with Lemma 4 guarantee the existence of a linear time algorithm for testing outerplanarity. There are of course much simpler linear time algorithms for testing outerplanarity [21,28].

Crossings vs treewidth
Next, we relate the natural parameter for 1-page crossing minimization (the number of crossings) to the parameter for Courcelle's theorem (the treewidth). This relation will allow us to construct a fixed-parameter-tractable algorithm for the natural parameter.
A k-clique sum of two disjoint graphs each containing a k-clique is formed by bijectively identifying each vertex of one k-clique with a vertex of the other k-clique, and then removing one or more of the k-clique edges from the resulting combined graph.
Lemma 5 (Lemma 1 in [11]). If G 1 and G 2 each have treewidth at most k, then any clique-sum of G 1 and G 2 also has treewidth at most k. Lemma 6. Every graph G has treewidth O( cr 1 (G)).
Proof. Let G be a graph with cr 1 (G) = k, and D a 1-page drawing of G with k crossings. Then let H be the subgraph of G induced by the endpoints of crossed edges in D. The remainder of G after removing the edges in H is a disjoint union of outerplanar graphs. Augment each connected component of H and each outerplanar graph in the remainder of G by adding edges between consecutive vertices along the spine of the drawing, completing a cycle around each connected component. From each augmented connected component C we create a planar graph C by planarizing C with respect to the drawing D. Since C is a planar graph with O(k) vertices it has treewidth O( √ k). C also has treewidth O( √ k), as its treewidth is at most four times that of C . The graph G may now be constructed from the augmented connected components and the outerplanar connected components by performing repeated {1, 2}-clique-sums. Since each cliquesum preserves the treewidth, the graph G has treewidth O( √ k). An example of this construction is depicted in Figure 1.

Logical characterization
Let G be a graph with bounded 1-page crossing number, and consider a drawing of G achieving this crossing number. Then the set of crossing edges of the drawing partitions the halfplane into an arrangement of curves, and we can partition G itself into the subgraphs that lie within each face of this arrangement. Each of these subgraphs is itself outerplanar, because it lies within a subset of the halfplane (with its vertices on the boundary of the subset) and has no more crossing edges;  see Figure 2. This intuitive idea forms the basis for the following characterization of the 1-page crossing number, which we will use to construct an MSO 2 -formula for the property of having a drawing with low crossing number.
, and a partition U 0 , . . . , U of V \ W into (possibly empty) subsets, satisfying the following properties: 1. W is the set of vertices incident to edges in F . 2. F contains all edges in the induced subgraph on W .
3. There are no edges between U i and U j for i = j. 4. There is an outerplanar embedding of the induced subgraph on adjacent for all 0 ≤ i < . 5. The edges in F produce at most k crossings when their endpoints (the vertices in W ) are placed in order according to their indices.
We now construct a formula onepage k , based on Lemma 7, such that G |= onepage k if and only if cr 1 (G) ≤ k. The formula onepage k will have the overall form of a disjunction, over all crossing configurations, of a conjunction of sub-formulas representing Properties 1-4 in Lemma 7. Property 5 will be represented implicitly, by the enumeration of crossing configurations. The first three properties are easy to express directly: the formulas express in MSO 2 Properties 1, 2, and 3 of Lemma 7 respectively.
To express Property 4 we first observe that it is equivalent to the property that the induced subgraph on U i ∪ {v i , v i+1 } with v i and v i+1 identified (merged) to form a single supervertex is outerpalanar. That is, the requirement in Property 4 that vertices v i and v i+1 be adjacent in the outerplanar embedding can be enforced by identifying the vertices. To express this property we need the following lemma, which can be proved in straightforward manner using the method of syntactic interpretations. (For details on this method see [15,18].) a, b) if and only if G/a ∼ b |= φ, where G/a ∼ b is the graph constructed from G by identifying vertices a and b. Now, to construct θ 4 (U i , v i , v j ) we first modify the formula outerplanar by restricting its quantifiers to only quantify over vertices (and sets of vertices) in U i ∪ {v i , v j } and edges (and sets of edges) between these vertices. This modified formula describes the outerplanarity of U i ∪ {v i , v j }. We then apply the transformation of Lemma 8 to produce the formula θ 4 (U i , v i , v j ), expressing the outerplanarity of the induced graph on Lemma 2 tells us that there are 2 O(k 2 ) ways of satisfying Property 5 of Lemma 7. For each crossing diagram D with k crossings we can construct a formula α D (v 0 , . . . , v , e 0 , . . . , e r ) specifying that the vertices v 0 , . . . , v and edges e 0 , . . . , e r are in configuration D. We then construct the formula . This formula expresses the property that, in the given graph G, we can construct a crossing diagram of type D, and a corresponding partition of the vertices into subsets U i , that obeys Properties 1-4 of Lemma 7. By Lemma 7, this is equivalent to the property that G has a 1-page drawing with k crossings in configuration D. Finally, we construct onepage k by taking the disjunction of the β D where D ranges over all crossing diagrams with ≤ k crossings. Thus, onepage k is a formula of length 2 O(k 2 ) , expressing the property that cr 1 (G) ≤ k. Theorem 1. There exists a computable function f such that cr 1 (G) can be computed in O(f (k)n) time for a graph G with n vertices and with k = cr 1 (G).
Proof. We have shown the existence of a formula onepage k such that a graph G |= onepage k if and only if cr 1 (G) ≤ k. By Lemma 6, the treewidth of any graph with crossing number k is O(k). Applying Courcelle's theorem with the formula onepage k and the O(k) treewidth bound, it follows that computing cr 1 (G) is fixed-parameter tractable in k .

2-page planarity
A classical characterization of the graphs with planar 2-page drawings is that they are exactly the subhamiltonian planar graphs:

Lemma 9 (Bernhart and Kainen [4]). A graph is 2-page planar if and only if it is the subgraph of planar Hamiltonian graph.
However, this characterization does not directly help us to construct an MSO 2 -formula expressing the 2-page planarity of a graph, as we do not know how to construct a formula that asserts the existence of a supergraph with the given property. Hamiltonicity and planarity are both straightforward to express in MSO 2 , but there is no obvious way to describe a set of edges that may be of more than constant size, is not a subset of the existing edges, and can be used to augment the given graph to form a planar Hamiltonian graph.
For this reason we provide a new characterization, which we model on a standard characterization of planar graphs: a graph is planar if and only if, for every cycle C, the flaps of C can be partitioned into two subsets (the interior and exterior of C) such that no two flaps in the same subset cross each other. For instance, this characterization has been used as the basis for a cubictime divide and conquer algorithm for planarity testing, which recursively subdivides the graph into cycles and non-crossing subsets of flaps [2,17,26]. In our characterization of 2-page graphs, we apply this idea to a special set of cycles, the boundaries of maximal regions within each halfplane that are separated from the spine of a 2-page book embedding by the edges of the embedding. The cycles of this type are edge-disjoint, and if a single cycle of this type has been identified then its interior flaps can also be identified easily: each interior flap is a single edge, and an edge forms an interior flap if and only if it belongs to the same page as the cycle in the book embedding and has both its endpoints on the cycle. As well as identifying which of the two pages each edge of a given graph is assigned to, our MSO 2 formula will partition the edges into three different types of edge: the ones that belong to these special cycles, the ones that form interior flaps of these special cycles, and the remaining isthmus edges that, if deleted, would disconnect parts of their page.
Suppose we are given a graph G = (V, E) and a partition of its edges into two subsets A, B, intended to represent the two pages of a 2-page drawing of G. We define the graph separate(G; A, B) that splits each vertex of G into two vertices, one in each page, with a new edge connecting them. Thus, separate(G; A, B) has 2n vertices, which can be labeled by pairs of the form (v, X) where v is a vertex in V and X is one of the two sets in A, B. It has an edge between (x, X) and (y, Y ) if either of two conditions is met: (1) x = y and X = Y , or (2) X = Y and there is an edge between x and y in X. See Figure 4 for an illustration of the separate(G; A, B) construction. 1. X c is a union of edge-disjoint cycles. 2. X c ∪ X b does not contain any additional cycles that involve edges in X b . 3. For every edge e in X i there exists a cycle in X c containing both endpoints of e. 4. The graph formed by the edges X i ∪ X c ∪ X b is outerplanar. 5. For each cycle C in X c it is not possible to find two vertex-disjoint paths P 1 and P 2 in E such that neither path is a single edge in X i , all four path endpoints are distinct vertices of C, neither path contains a vertex of C in its interior, and the two pairs of path endpoints are in crossing position on C. 6. The subdivision separate(G; We construct a formula twopage based on Lemma 10 with the property that G |= twopage if and only if G is 2-page planar. First, we construct formulas θ 1 , . . . , θ 5 expressing Properties 1 through 5 in Lemma 10, as we did for 1-page crossing; each of these properties has a straightforward expression in MSO 2 . To express Property 6 we will need the following technical lemma, which can be proved using the method of syntactic interpretations.   G; A, B) where G is the graph in Figure 3, A and B are respectively the edges in the first and second page. Now, we can express Property 6 as an MSO 2 -formula θ 6 using Lemma 11, as planarity is expressible by Lemma 4 and the fact that planar graphs are the graph that avoid K 5 and K 3,3 as minors. Thus, we define twopage to be the formula expressing the existence of Theorem 2. There exists a computable function f and an algorithm that can decide whether a given graph with treewidth k is 2-page planar in O(f (k)n) time.
Proof. The result follows from Courcelle's theorem together with the construction of the MSO 2 formula twopage representing the existence of a two-page planar embedding.

2-page crossing minimization
We now extend the results of the previous section from 2-page planarity to 2-page crossing minimization. As in the 1-page case, we will use a formula that involves a disjunction over crossing diagrams. Given a crossing diagram D with k crossings and r + 1 edges, whose graph is G, we define the planarization of G with respect to D to be the graph in which each edge e i is replaced by a path of degree four vertices, such that two of these replacement paths share a vertex if and only if the original two edges cross in D. As explained earlier, we do not care about the order of crossings along each edge (two crossing diagrams with the same sets of crossing pairs but with different crossing orders are considered equivalent. Nevertheless, we do preserve the order of crossings from (one representative of an equivalence class of) crossing diagrams to their planarizations, in order to ensure that the planarizations form planar graphs.
Lemma 12. A graph G = (V, E) has cr 2 (G) = k if and only if there exists edges e 0 , e 1 , · · · , e r with r < 2k and a 2-page crossing diagram D with k crossings on these edges such that when G is planarized with respect to D the resulting graph 1. X c is a union of edge disjoint cycles. 4. For every edge e in X i , there exists a subgraph P containing e and a cycle C in X c such that P consists only of vertices of C and of degree-four vertices introduced in the planarization, P contains at least two vertices of C, and P includes all four edges incident to each of its planarization vertices. 5. For each two edges e and f in X i , the two subgraphs P e and P f satisfying Property 4 do not each have a pair of endpoints in crossing position on the same cycle C. 6. For each cycle C in X c there do not exist two paths in E, such that neither path uses edges of X i or interior vertices of C, with four distinct endpoints on C in crossing position. 7. the subdivision separate(G; Now, we construct a MSO 2 -formula ζ k based on Lemma 12 such that G |= ζ k if and only if cr 2 (G) = k. To handle the planarization process we use the following lemma. In the lemma, the notation G e 1 ×e 2 describes the graph obtained from a graph G by deleting two edges e 1 and e 2 that do not share a common endpoint, and adding a new degree-4 vertex connected to the endpoints of e 1 and e 2 .
Given any MSO 2 -formula φ and crossing diagram D, we can repeatedly apply the lemma above to construct a formula φ D such that G |= φ D (e 0 , . . . , e r ) if and only if G D |= φ. With this tool in hand it is straightforward to construct a formula γ D , expressing the property that, in a given graph G we can build a crossing diagram with the structure of D, and partition the planarization G D into six sets, satisfying Lemma 12. So we can define ζ k to be the disjunction of the γ D ranging over all 2-page crossing diagrams with k-crossings. Theorem 3. There exists a computable function f such that cr 2 (G) can be computed in O(f (k, t)n) time for a graph G with n vertices, k = cr 2 (G), and t = tw(G).

Conclusion
We have provided new fixed-parameter algorithms for computing the crossing numbers for 1-page and 2-page drawings of graphs with bounded treewidth. The use of monadic second order logic and Courcelle's theorem in our solutions causes the running times of our algorithms to have an impractically high dependence on their parameters. We believe that it should be possible to achieve a better dependence by directly designing dynamic programming algorithms that use tree-decompositions of the given graphs, rather than by relying on Courcelle's theorem to prove the existence of these algorithms. Can this dependency be reduced to the point of producing practical algorithms? For 2-page crossing minimization the runtime is parameterized by both the treewidth and the crossing number. Is 2-page crossing minimization NP-hard for graphs of fixed treewidth? We leave these questions open for future research.
It would also be of interest to determine whether three-page book embedding is fixed-parameter tractable in the treewidth or in other natural parameters of the input graphs. For this problem, we do not know of a logical characterization that would allow us to apply Courcelle's theorem. Even the special case of recognizing graphs with treewidth 3 that have three-page book embeddings would be of interest, to provide a computational attack on the still-open problem of whether there exist planar graphs that require four pages [14,29].

A Expressing graph properties in MSO 2
For readers unfamiliar with MSO 2 logic, we provide in this appendix some standard examples of graph properties that may be expressed in this logic, leading up to the properties that we use in our results. Additional examples may be found in the one of the standard introductions to graph logic [10,12,16]. The building blocks in this section can be used to construct the formulas that we use throughout our paper.
Because the equal sign (=) is an element that is used within MSO 2 formulas, expressing the equality relation between two vertices, edges, or sets, we instead use the equivalence sign (≡) to express the syntactic equality of two formulas, or the assignment of a name to a formula.

A.1 k-Coloring
The formula color k that we construct below expresses the k-colorability of a graph. As a step towards the construction of color k , we first construct a formula vertex-partition expressing the property that a collection of vertex sets forms a partition of the vertices: the sets are disjoint from each other and their union contains all vertices in the graph.
A formula edge-partition expressing the property that a collection of edge sets forms a partition of the edges in the graph may be constructed in the same way by changing vertex variables to edge variables and vertex set variables to edge set variables.
With the ability to partition vertices we can now construct color k . The construction uses the fact that a k-coloring forms a partition of the vertices with the additional property that, for every color class C, all edges have an endpoint of a different color than C.

A.2 Minor containment and planarity
Next, we construct a formula minor H expressing the property that a graph has H as a minor. If we label each of the k vertices in H with a distinct number in the range from 1 to k, then H is a minor of G if and only if there exists a corresponding collection of k connected and disjoint subsets of the vertices of G, say U 1 , . . . , U k , such that for each edge (i, j) in H there is an edge from U i to U j .
As part of this construction, we will use a formula connected expressing the property that a graph is connected. We will construct this formula by first constructing a formula disconnected expressing the property that a graph is disconnected. This is true if and only if the graph supports a nontrivial cut of the vertices with an empty cut-set.
We can now define connected ≡ ¬ disconnected. A similar construction leads to formulas connected-vertices(V ) and connected-edges(E) expressing the properties that vertex set V describes a connected induced subgraph or that edge set E describes a connected subgraph.
With the ability to express connectedness we can now construct minor H .
Since the planar graphs are precisely the graphs that have neither K 5 nor K 3,3 as minors, we have planar ≡ ¬ minor K 5 ∧¬ minor K 3,3 expressing the planarity of a graph in terms of these forbidden minors.

A.3 Hamiltonicity
Our last example will be a formula expressing the existence of a Hamiltonian cycle in a graph. A set of edges F in a graph is a union of vertex-disjoint cycles if every edge in F is adjacent to exactly two edges in F other than itself. Thus, expresses the property that F is a disjoint union of cycles. (Here ∃ =2 is a logical shorthand for the existence of exactly two objects satisfying the given property, i.e. that there exist f 1 and f 2 both satisfying the property, that f 1 and f 2 are unequal, and that there do not exist three unequal edges all satisfying the property.) Then a set of edges is a single cycle if it is a union of cycles and forms a connected subgraph. So we define A set of edges F spans a graph if every vertex is incident to at least one of the edges in F .
Finally, a graph is Hamiltonian if it has a spanning cycle.

B Proof of Lemma 10
Suppose G has a 2-page planar drawing. This drawing partitions the edges of G into two sets A and B. For X = A or B, let X c be the set of edges X forming a union of edge disjoint cycles that surround a maximal subset of their page. Then let X i be the edges in X drawn in the interior of one of these cycles, and X b the remaining edges in X. It can be easily verified that the constructed partition satisfies Properties 1 through 6. Conversely, suppose we have a graph G with a partition of its edges satisfying the properties of the lemma. By Property 6, separate(G; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ) has a planar embedding. We may assume without loss of generality that, in this embedding, the cycles of X c given by Property 1 separate the edges of X i (interior to the cycles) from the rest of the graph (exterior to the cycles). For, by Property 4, no two interior edges can cross, and by Property 5, no two exterior paths can cross. So, if we have a cycle in X c that does not properly separate X i from the rest of the graph, we may modify the embedding to flip the edges of X i into the interior of the cycle and to flip the components of the rest of the graph to the exterior of the cycle, preserving the (reflected) planar embedding of each flipped component, without introducing any new crossings. By performing this flipping operation to all cycles of A c and B c , we obtain an embedding in which the cycles of X c separate X i from the rest of the graph, as stated above.
Next, given this embedding of separate(G; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ), we contract all of the cycles (X c ) and isthmuses (X b ) in each page (X = A and B), maintaining the orientation of the edges that were not contracted. As a consequence, the edges in X i within each cycle of X c are also contracted. However, in the embedding of separate(G; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ), none of the contracted cycles surrounds any part of the graph that is not itself contracted. As a result, we are left with an embedding of a planar embedded bipartite multigraph that has one edge (v, A)-(v, B) for each vertex v in the original graph. Because this multigraph is bipartite, its dual graph has even degree at every vertex, and as the dual graph of a planar graph it is necessarily connected. Thus, the dual of the bipartite multigraph has an Euler tour, and (as with any Eulerian planar graph) this Euler tour can be made non-self-crossing by local uncrossing operations at each vertex. This tour can be represented geometrically as a Jordan curve J that passes through the faces of the embedding of separate(G; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ) (in some cases more than once per face) and crosses each edge (v, A)-(v, B) exactly once.
From the embedding of separate(G; A b ∪A c ∪A i , B b ∪B c ∪B i ) we can obtain a planar embedding of G itself by contracting all the edges of the form (v, A)-(v, B). If we augment G by adding an edge uv between any two vertices u and v whose edges (u, A)-(u, B) and (v, A)-(v, B) are crossed consecutively by the Jordan curve J, then J can be used to guide a non-crossing placement of these additional edges within the resulting embedding of G. Thus, we have augmented G to a Hamiltonian planar supergraph. The Jordan curve passing through these contracted edges gives us a routing of a set of pairs The planar dual of this graph has an Euler tour, as the primal graph is bipartite. This tour corresponds to Hamiltonian cycle in a planar supergraph of G, where edges are added between vertices if the edge does not already exist. The result that G has a 2-page book embedding follows by Lemma 9.