Crossing Minimization for 1-page and 2-page Drawings of Graphs with Bounded Treewidth
CCrossing Minimization for 1-page and 2-page Drawings of Graphswith Bounded Treewidth
Michael J. Bannister and David Eppstein
Department of Computer Science, University of California, Irvine
Abstract.
We investigate crossing minimization for 1-page and 2-page book drawings. We show thatcomputing the 1-page crossing number is fixed-parameter tractable with respect to the number ofcrossings, that testing 2-page planarity is fixed-parameter tractable with respect to treewidth, andthat computing the 2-page crossing number is fixed-parameter tractable with respect to the sum ofthe number of crossings and the treewidth of the input graph. We prove these results via Courcelle’stheorem on the fixed-parameter tractability of properties expressible in monadic second order logic forgraphs of bounded treewidth. 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 bythe line (the pages of the book) [19, 22]. In one common drawing style, an arc diagram , the edgesin each page are drawn as circular arcs perpendicular to the spine [27], but the exact shape of theedges is unimportant for the existence of book embeddings. These embeddings can be generalizedto k -page book drawings : as before, we place each vertex on the spine and each edge within asingle page, but with crossings allowed. The crossing number of such a drawing is defined to be thesum of the numbers of crossings within each page, and the k -page crossing number cr k ( G ) is theminimum number of crossings in any k -page book drawing [25]. In an optimal drawing, two edgesin the same page cross if and only if their endpoints form interleaved intervals on the spine, so theproblem of finding an optimal drawing may be solved by finding a permutation of the vertices andan assignment of edges to pages minimizing the number of pairs of edges with interleaved intervalson the same page.As with most crossing minimization problems, k -page crossing minimization is NP -hard; eventhe 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 ofgraphs and restricted values of k . For instance, recently Bannister, Eppstein and Simons [3] showedthe computation of cr ( G ) and cr ( 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 reducedto a tree by removing at most k edges. In this paper we improve these results by finding fixed-parameter tractable algorithms for stronger parameters, allowing k -page crossing minimization tobe performed in polynomial time for a much wider class of graphs. We design fixed-parameter algorithms for computing the minimum number of crossings cr ( G ) ina 1-page drawing of a graph G , and the minimum number of crossings cr ( G ) in a 2-page drawingof G . Ideally, fixed-parameter algorithms for crossing minimization should be parameterized bytheir natural parameter , the optimal number of crossings. We achieve this ideal bound, for thefirst time, for cr ( G ). However, for cr ( G ), even testing whether a given graph is 2-page planar a r X i v : . [ c s . D S ] A ug that is, whether cr ( G ) = 0) is NP -complete [8]. Therefore, unless P = NP , there can be nofixed-parameter-tractable algorithm parameterized by the crossing number. Instead, we show thatcr ( G ) is fixed-parameter tractable in the sum of the natural parameter and the treewidth of G .One consequence of our result on cr ( G ) is that it is possible to test whether a given graph is 2-pageplanar, in time that is fixed-parameter tractable with respect to treewidth.We construct these algorithms via Courcelle’s theorem [9, 10], which connects the expressibilityof graph properties in monadic second order logic with the fixed-parameter tractability of theseproperties with respect to treewidth. Recall that second order logic extends first order logic byallowing 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 (equivalentlysubsets) 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 andonly if it is a subgraph of a Hamiltonian planar graph [4]. However, this expression is not allowed inmonadic second-order logic because the extra edges needed to make the input graph Hamiltoniancannot be described by a subset of the existing vertices and edges of the graph. Instead, we provea new structural description of 2-page planarity that is more easily expressed in monadic secondorder logic. As well as the previous work on crossing minimization for almost-trees [3], related results in fixed-parameter 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 param-eter [18]. This result was later improved by Kawarabayashi and Reed [20]. Based on these resultsthe crossing number itself was also shown to be fixed-parameter tractable; Pelsmajer et al. showeda similar result for the odd crossing number [23]. In layered graph drawing , Dujmovi´c et al. showedthat finding a drawing with k crossings and h layers is fixed-parameter tractable in the sum of thesetwo parameters; this result depends on a bound on the pathwidth of such a drawing, a parameterclosely 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 theircomplexity nor have we searched for optimizations to our logical formulae that would improve thiscomplexity. There is an unfortunate terminological confusion in graph theory: two different concepts, a maximalsubgraph that is internally connected by paths that avoid a given cycle, and an edge whose removaldisconnects 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 edgesof 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. (Ingeneral, 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 .2 .2 Treewidth and graph minors The treewidth of G can be defined to be one less than the number of vertices in the largest cliquein a chordal supergraph of G that (among possible chordal supergraphs) is chosen to minimize thisclique size [6]. The problem of computing the treewidth of a general graph is NP -hard [1], but it isfixed-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 sequenceedge contractions, edge deletions, and vertex deletions. It can be determined whether a graph H isa minor of a graph G , in time that is polynomial in the size of G and fixed-parameter tractable inthe size of H [24]. We will be expressing graph properties in extended monadic second-order logic (MSO ). This is afragment 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 tovariables 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, . . . foredges, and capital letters for sets of vertices or edges (with context making clear which type of set).Given a graph G and an MSO formula φ we write G | = φ (“ G models φ ”) to express the statementthat φ is true for the vertices, edges, and sets of vertices and edges in G , with the semantics ofthis relation defined in the obvious way. MSO differs from full second order logic in that it allowsquantification over sets, but not over higher order relations, such as sets of pairs of vertices thatare not subsets of the given edges. In Appendix A, we provide a brief introduction to MSO logicin 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 is the following powerful algo-rithmic meta-theorem due to Courcelle. Lemma 1 (Courcelle’s theorem [9, 10]).
Given an integer k ≥ and an MSO -formula φ oflength (cid:96) , an algorithm can be constructed that takes as input a graph G of treewidth at most k anddecides in O (cid:0) f ( k, (cid:96) ) · ( n + m ) (cid:1) time whether G | = φ , where the function f appearing in the timebound is a computable function of the treewidth k and formula length (cid:96) . 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 -pagegraph drawing can cross each other.We define a 1 -page crossing diagram to be a placement of some points on the circumference ofa circle, together with some straight line segments connecting the points such that each point isincident to a segment, no segment is uncrossed and no three segments cross at the same point. Twocrossing diagrams are combinatorially equivalent if they have the same numbers of points and linesegments and there exists a cyclic-order-preserving bijection of their points that takes line segments3o line segments. The crossing number of a 1-page crossing diagram is the number of pairs of itsline segments that cross each other.We define a 2 -page crossing diagram to be a 1-page crossing diagram together with a labelingof its line segments by two colors. For a 2-page crossing diagram we define the crossing number tobe the total number of crossing pairs of line segments that have the same color as each other. Lemma 2.
There are O ( k ) k crossings, and there are O ( k ) k crossings.Proof. Place 4 k points around a circle. Then every 1-page crossing diagram with k or fewer crossingscan be represented by choosing a subset of the points and a set of line segments connecting a subsetof pairs of the points. There are 4 k points and 4 k (4 k − / O ( k ) possible subsetsto choose.Similarly, every 2-page crossing diagram can be represented by a subset of the same 4 k points,and two disjoint subsets of pairs of points, which again can be bounded by 2 O ( k ) . (cid:117)(cid:116) Two combinatorially equivalent crossing diagrams, as defined above, may have a topology thatdiffers from each other, or from combinatorially equivalent diagrams with curved edges. This isbecause, for an edge with multiple crossings, the order of the crossings along this edge may differfrom one diagram to another, but this ordering is not considered as part of the definition of combi-natorial equivalence. For our purposes such differences are unimportant, as we are concerned onlywith the total number of crossings. So we consider two crossing diagrams to be equivalent if theyhave the same crossing pairs of edges, regardless of whether the crossings occur in the same order.
Recall that a graph is outerplanar if there exists a placement of its vertices on the circumference of acircle 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 crossing-free 1-page drawing. For incorporating a test of outerplanarity into methods using Courcelle’stheorem, it is convenient to use a standard characterization of the outerplanar graphs by forbiddenminors:
Lemma 3 (Chartrand and Harary [7]).
A graph G is outerplanar ( -page planar) if and onlyif it contains neither K nor K , as a minor. Lemma 4 (Corollary 1.15 in [10]).
Given any fixed graph H there exists a MSO -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 ∧¬ minor K , . Then Lemma 3 implies that, forall graphs G , G | = outerplanar if and only if G is outerplanar. Because outerplanar graphshave bounded treewidth (at most two), Courcelle’s theorem together with Lemma 4 guarantee theexistence of a linear time algorithm for testing outerplanarity. There are of course much simplerlinear time algorithms for testing outerplanarity [21, 28].4 ig. 1. An example of the clique-sum decomposition in Lemma 6. The red regions represent the components withcrossings and the blue regions represent outerplanar components. The entire graph may be reconstructed by perform-ing clique-sums on the region boundaries.
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 constructa 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 iden-tifying each vertex of one k -clique with a vertex of the other k -clique, and then removing one ormore of the k -clique edges from the resulting combined graph. Lemma 5 (Lemma 1 in [11]). If G and G each have treewidth at most k , then any clique-sumof G and G also has treewidth at most k . Lemma 6.
Every graph G has treewidth O ( (cid:112) cr ( G )) .Proof. Let G be a graph with cr ( G ) = k , and D a 1-page drawing of G with k crossings. Thenlet 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 connectedcomponent of H and each outerplanar graph in the remainder of G by adding edges between consec-utive 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 (cid:48) by planarizing C withrespect to the drawing D . Since C (cid:48) 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 (cid:48) .The graph G may now be constructed from the augmented connected components and theouterplanar connected components by performing repeated { , } -clique-sums. Since each clique-sum preserves the treewidth, the graph G has treewidth O ( √ k ). An example of this constructionis depicted in Figure 1. (cid:117)(cid:116) Let G be a graph with bounded 1-page crossing number, and consider a drawing of G achievingthis crossing number. Then the set of crossing edges of the drawing partitions the halfplane into anarrangement of curves, and we can partition G itself into the subgraphs that lie within each faceof this arrangement. Each of these subgraphs is itself outerplanar, because it lies within a subsetof the halfplane (with its vertices on the boundary of the subset) and has no more crossing edges;5 U U U U Fig. 2.
A 1-page drawing of a graph withtwo crossings and five outerplanar sub-graphs.
Fig. 3.
A 2-page planar graph with its edges partitioned into the sixsets A b (green edges), A c (blue edges), A i (red edges), B b (yellowedges), B c (purple edges), and B i (gray edges). see Figure 2. This intuitive idea forms the basis for the following characterization of the 1-pagecrossing number, which we will use to construct an MSO -formula for the property of having adrawing with low crossing number. Lemma 7.
A graph G = ( V, E ) has cr ( G ) ≤ k if and only if there exist edges F = { e , . . . , e r } with r = O ( k ) , vertices W = { v , . . . , v (cid:96) } with (cid:96) = O ( k ) , and a partition U , . . . , U (cid:96) 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 (cid:54) = j .4. There is an outerplanar embedding of the induced subgraph on U i ∪ { v i , v i +1 } with v i and v i +1 adjacent for all ≤ i < (cid:96) .5. The edges in F produce at most k crossings when their endpoints (the vertices in W ) are placedin order according to their indices. We now construct a formula onepage k , based on Lemma 7, such that G | = onepage k if andonly if cr ( G ) ≤ k . The formula onepage k will have the overall form of a disjunction, over allcrossing 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 firstthree properties are easy to express directly: the formulas θ ( W, F ) ≡ ( ∀ v )[ v ∈ W → ( ∃ e )[ e ∈ F ∧ I ( e, v )]] θ ( F, W ) ≡ ( ∀ e )[( ∀ v )[ I ( e, v ) → v ∈ W ] → e ∈ F ] θ ( U i , U j ) ≡ ¬ ( ∃ e )( ∃ u, v )[ I ( e, u ) ∧ I ( e, v ) ∧ u ∈ U i ∧ v ∈ U j ]express in MSO 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 inducedsubgraph on U i ∪ { v i , v i +1 } with v i and v i +1 identified (merged) to form a single supervertex isouterpalanar. That is, the requirement in Property 4 that vertices v i and v i +1 be adjacent in theouterplanar embedding can be enforced by identifying the vertices. To express this property weneed the following lemma, which can be proved in straightforward manner using the method ofsyntactic interpretations. (For details on this method see [15, 18].)6 emma 8. For every
MSO -formula φ there exists an MSO -formula φ ∗ ( v , v ) such that G | = φ ∗ ( a, b ) if and only if G/a ∼ b | = φ , where G/a ∼ b is the graph constructed from G by identifyingvertices a and b . Now, to construct θ ( U i , v i , v j ) we first modify the formula outerplanar by restricting itsquantifiers to only quantify over vertices (and sets of vertices) in U i ∪ { v i , v j } and edges (and sets ofedges) 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 θ ( U i , v i , v j ), expressing theouterplanarity of the induced graph on U i ∪ { v i , v j } with v i and v j identified.Lemma 2 tells us that there are 2 O ( k ) ways of satisfying Property 5 of Lemma 7. For eachcrossing diagram D with k crossings we can construct a formula α D ( v , . . . , v (cid:96) , e , . . . , e r ) specifyingthat the vertices v , . . . , v (cid:96) and edges e , . . . , e r are in configuration D . We then construct theformula β D ≡ ( ∃ v , . . . v (cid:96) )( ∃ e , . . . , e r )( ∃ U , . . . , U (cid:96) ) (cid:104) α D ( v , . . . , v (cid:96) , e , . . . , e r ) ∧ (cid:96) (cid:91) U i = V \ { v , . . . , v (cid:96) } ∧ (cid:94) i (cid:54) = j U i ∩ U j = ∅∧ θ ( v , . . . , v (cid:96) ; e , . . . , e r ) ∧ θ ( e , . . . , e r ; v , . . . , v (cid:96) ) ∧ (cid:94) i (cid:54) = j θ ( U i , U j ) ∧ (cid:96) (cid:94) i =0 θ ( U i , v i , v i +1 ) (cid:105) of length O ( k ). This formula expresses the property that, in the given graph G , we can constructa crossing diagram of type D , and a corresponding partition of the vertices into subsets U i , thatobeys Properties 1–4 of Lemma 7. By Lemma 7, this is equivalent to the property that G has a1-page drawing with k crossings in configuration D . Finally, we construct onepage k by takingthe 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 ) , expressing the property that cr ( G ) ≤ k . Theorem 1.
There exists a computable function f such that cr ( G ) can be computed in O ( f ( k ) n ) time for a graph G with n vertices and with k = cr ( G ) .Proof. We have shown the existence of a formula onepage k such that a graph G | = onepage k ifand only if cr ( 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 followsthat computing cr ( G ) is fixed-parameter tractable in k . (cid:117)(cid:116) A classical characterization of the graphs with planar 2-page drawings is that they are exactly thesubhamiltonian planar graphs:
Lemma 9 (Bernhart and Kainen [4]).
A graph is -page planar if and only if it is the subgraphof planar Hamiltonian graph. However, this characterization does not directly help us to construct an MSO -formula express-ing the 2-page planarity of a graph, as we do not know how to construct a formula that asserts theexistence of a supergraph with the given property. Hamiltonicity and planarity are both straight-forward to express in MSO , but there is no obvious way to describe a set of edges that may be7f more than constant size, is not a subset of the existing edges, and can be used to augment thegiven graph to form a planar Hamiltonian graph.For this reason we provide a new characterization, which we model on a standard characteri-zation of planar graphs: a graph is planar if and only if, for every cycle C , the flaps of C can bepartitioned into two subsets (the interior and exterior of C ) such that no two flaps in the samesubset cross each other. For instance, this characterization has been used as the basis for a cubic-time divide and conquer algorithm for planarity testing, which recursively subdivides the graphinto cycles and non-crossing subsets of flaps [2, 17, 26]. In our characterization of 2-page graphs, weapply this idea to a special set of cycles, the boundaries of maximal regions within each halfplanethat are separated from the spine of a 2-page book embedding by the edges of the embedding. Thecycles of this type are edge-disjoint, and if a single cycle of this type has been identified then itsinterior flaps can also be identified easily: each interior flap is a single edge, and an edge forms aninterior flap if and only if it belongs to the same page as the cycle in the book embedding and hasboth its endpoints on the cycle. As well as identifying which of the two pages each edge of a givengraph is assigned to, our MSO 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 2 n 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 ) ifeither of two conditions is met: (1) x = y and X (cid:54) = 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.
Lemma 10.
A graph G = ( V, E ) is -page planar if and only if there exists a partition A b , A c , A i , B b , B c , B i of E into six subsets such that, for each of the two choices of X = A and X = B ,these subsets satisfy the following properties: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 and P in E suchthat neither path is a single edge in X i , all four path endpoints are distinct vertices of C , neitherpath contains a vertex of C in its interior, and the two pairs of path endpoints are in crossingposition on C .6. The subdivision separate( G ; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ) is planar. Figure 4 illustrates the division of edge into six subsets described in Lemma 10. For the proofof Lemma 10, see Appendix 5.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 θ , . . . , θ expressing Properties 1through 5 in Lemma 10, as we did for 1-page crossing; each of these properties has a straightforwardexpression in MSO . To express Property 6 we will need the following technical lemma, which canbe proved using the method of syntactic interpretations. Lemma 11.
For every
MSO -formula φ there exists an MSO -formula φ ∗ ( A, B ) such that G | = φ ∗ ( A, B ) if and only if separate( G ; A, B ) | = φ . ig. 4. The graph separate( G ; A, B ) where G is the graph in Figure 3, A and B are respectively the edges in the firstand second page. Now, we can express Property 6 as an MSO -formula θ using Lemma 11, as planarity isexpressible by Lemma 4 and the fact that planar graphs are the graph that avoid K and K , asminors. Thus, we define twopage to be the formula expressing the existence of A b , A c , A i , B b , B c , B i satisfying θ , . . . θ . Theorem 2.
There exists a computable function f and an algorithm that can decide whether agiven graph with treewidth k is -page planar in O ( f ( k ) n ) time.Proof. The result follows from Courcelle’s theorem together with the construction of the MSO formula twopage representing the existence of a two-page planar embedding. (cid:117)(cid:116) We now extend the results of the previous section from 2-page planarity to 2-page crossing min-imization. As in the 1-page case, we will use a formula that involves a disjunction over crossingdiagrams. Given a crossing diagram D with k crossings and r + 1 edges, whose graph is G , we definethe planarization of G with respect to D to be the graph in which each edge e i is replaced by apath of degree four vertices, such that two of these replacement paths share a vertex if and only ifthe original two edges cross in D . As explained earlier, we do not care about the order of crossingsalong each edge (two crossing diagrams with the same sets of crossing pairs but with differentcrossing 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 orderto ensure that the planarizations form planar graphs. Lemma 12.
A graph G = ( V, E ) has cr ( G ) = k if and only if there exists edges e , e , · · · , e r with r < k and a -page crossing diagram D with k crossings on these edges such that when G is planarized with respect to D the resulting graph G D = ( V D , E D ) has a partition of E D into A b , A c , A i , B b , B c , B i such that, for X = A, B :1. X c is a union of edge disjoint cycles.2. None of the cycles X c ∪ X b contains an edge in X b .3. If e is an edge introduced in the planarization, then e ∈ A b ∪ A c ∪ A i if e is in the first page of D , and e ∈ B b ∪ B c ∪ B i if it is in the second page of D . . 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 itsplanarization vertices.5. For each two edges e and f in X i , the two subgraphs P e and P f satisfying Property 4 do noteach 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 ; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ) is planar. Now, we construct a MSO -formula ζ k based on Lemma 12 such that G | = ζ k if and only ifcr ( G ) = k . To handle the planarization process we use the following lemma. In the lemma, thenotation G e × e describes the graph obtained from a graph G by deleting two edges e and e thatdo not share a common endpoint, and adding a new degree-4 vertex connected to the endpoints of e and e . Lemma 13 (Grohe [18]).
For every
MSO -formula φ there exists an MSO -formula φ ∗ ( x , x ) such that G | = φ ∗ ( e , e ) if and only if G e × e | = φ . Given any MSO -formula φ and crossing diagram D , we can repeatedly apply the lemma aboveto construct a formula φ D such that G | = φ D ( e , . . . , e r ) if and only if G D | = φ . With this toolin hand it is straightforward to construct a formula γ D , expressing the property that, in a givengraph 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 rangingover all 2-page crossing diagrams with k -crossings. Theorem 3.
There exists a computable function f such that cr ( G ) can be computed in O ( f ( k, t ) n ) time for a graph G with n vertices, k = cr ( G ) , and t = tw( G ) . We have provided new fixed-parameter algorithms for computing the crossing numbers for 1-pageand 2-page drawings of graphs with bounded treewidth. The use of monadic second order logic andCourcelle’s theorem in our solutions causes the running times of our algorithms to have an impracti-cally high dependence on their parameters. We believe that it should be possible to achieve a betterdependence by directly designing dynamic programming algorithms that use tree-decompositionsof the given graphs, rather than by relying on Courcelle’s theorem to prove the existence of thesealgorithms. Can this dependency be reduced to the point of producing practical algorithms? For2-page crossing minimization the runtime is parameterized by both the treewidth and the crossingnumber. Is 2-page crossing minimization NP -hard for graphs of fixed treewidth? We leave thesequestions open for future research.It would also be of interest to determine whether three-page book embedding is fixed-parametertractable in the treewidth or in other natural parameters of the input graphs. For this problem, wedo not know of a logical characterization that would allow us to apply Courcelle’s theorem. Even thespecial case of recognizing graphs with treewidth 3 that have three-page book embeddings wouldbe of interest, to provide a computational attack on the still-open problem of whether there existplanar graphs that require four pages [14, 29]. 10 cknowledgments This material is based upon work supported by the National Science Foundation under GrantCCF-1228639 and by the Office of Naval Research under Grant No. N00014-08-1-1015.
References [1] S. Arnborg, D. Corneil, and A. Proskurowski. Complexity of finding embeddings in a k -tree. SIAM J. Alg.Disc. Meth.
Journal of Mathematics and Mechanics
Graph Drawing , pp. 340–351. Springer, Lecture Notes in Computer Science 8242, 2013,doi:10.1007/978-3-319-03841-4 30.[4] F. Bernhart and P. C. Kainen. The book thickness of a graph.
Journal of Combinatorial Theory, Series B
Proceedings ofthe Twenty-fifth Annual ACM Symposium on Theory of Computing , pp. 226–234. ACM, STOC ’93, 1993,doi:10.1145/167088.167161.[6] H. L. Bodlaender. A partial k -arboretum of graphs with bounded treewidth. Theoretical Computer Science
Annales de l’institut Henri Poincar´e (B)Probabilit´es et Statistiques http://eudml.org/doc/76875 .[8] F. R. K. Chung, F. T. Leighton, and A. L. Rosenberg. Embedding graphs in books: A layout problem withapplications to VLSI design.
SIAM J. Alg. Disc. Meth.
Information andComputation
Graph Structure and Monadic Second-Order Logic: A Language-TheoreticApproach . Cambridge University Press, 2012.[11] E. D. Demaine, M. Hajiaghayi, and D. M. Thilikos. 1.5-Approximation for Treewidth of Graphs Excluding aGraph with One Crossing as a Minor.
Approximation Algorithms for Combinatorial Optimization , pp. 67–80.Springer Berlin Heidelberg, Lecture Notes in Computer Science 2462, 2002, doi:10.1007/3-540-45753-4 8.[12] R. G. Downey and M. R. Fellows.
Fundamentals of Parameterized Complexity . Springer, 2013.[13] V. Dujmovi´c, M. R. Fellows, M. Kitching, G. Liotta, C. McCartin, N. Nishimura, P. Ragde, F. Rosamond,S. Whitesides, and D. R. Wood. On the parameterized complexity of layered graph drawing.
Algorithmica
Discrete Comput. Geom.
Mathematical logic . Undergraduate Texts in Mathematics.Springer, 2nd edition, 1994, doi:10.1007/978-1-4757-2355-7. Translated from the German by Margit Meßmer.[16] J. Flum and M. Grohe.
Parameterized Complexity Theory . Springer, 2006.[17] A. J. Goldstein. An efficient and constructive algorithm for testing whether a graph can be embedded in aplane.
Graph and Combinatorics Conference , 1963.[18] M. Grohe. Computing crossing numbers in quadratic time.
Journal of Computer and System Sciences
Graphs and Combinatorics , pp. 76–108.Springer, Lecture Notes in Mathematics 406, 1974, doi:10.1007/BFb0066436.[20] K. Kawarabayashi and B. Reed. Computing crossing number in linear time.
ACM Symp. Theory ofComputing (STOC 2007) , pp. 382–390, 2007, doi:10.1145/1250790.1250848.[21] S. L. Mitchell. Linear algorithms to recognize outerplanar and maximal outerplanar graphs.
InformationProcessing Letters
Proc. 4th Southeastern Conference onCombinatorics, Graph Theory and Computing , vol. 8, p. 459, 1973.[23] M. J. Pelsmajer, M. Schaefer, and D. ˇStefankoviˇc. Crossing numbers and parameterized complexity.
GraphDrawing , pp. 31–36. Springer, Lecture Notes in Comput. Sci. 4875, 2008, doi:10.1007/978-3-540-77537-9 6.[24] N. Robertson and P. D. Seymour. Graph minors. XIII. The disjoint paths problem.
Journal of CombinatorialTheory, Series B
25] F. Shahrokhi, O. S´ykora, L. A. Sz´ekely, and I. Vˇrˇto. Book embeddings and crossing numbers.
Graph-TheoreticConcepts in Computer Science , pp. 256–268. Springer, Lecture Notes in Computer Science 903, 1995,doi:10.1007/3-540-59071-4 53.[26] R. W. Shirey.
Implementation and Analysis of Efficient Graph Planarity Testing Algorithms . Ph.D. thesis,The University of Wisconsin – Madison, 1969.[27] M. Wattenberg. Arc diagrams: visualizing structure in strings.
IEEE Symposium on Information Visualization(INFOVIS 2002) , pp. 110–116, 2002, doi:10.1109/INFVIS.2002.1173155.[28] M. Wiegers. Recognizing outerplanar graphs in linear time.
Graph-Theoretic Concepts in Computer Science ,pp. 165–176. Springer, Lecture Notes in Computer Science 246, 1987, doi:10.1007/3-540-17218-1 57.[29] M. Yannakakis. Four pages are necessary and sufficient for planar graphs.
Proc. 18th ACM Symp. on Theoryof Computing (STOC ’86) , pp. 104–108, 1986, doi:10.1145/12130.12141. Expressing graph properties in MSO For readers unfamiliar with MSO logic, we provide in this appendix some standard examples ofgraph properties that may be expressed in this logic, leading up to the properties that we use inour results. Additional examples may be found in the one of the standard introductions to graphlogic [10, 12, 16]. The building blocks in this section can be used to construct the formulas that weuse throughout our paper.Because the equal sign (=) is an element that is used within MSO formulas, expressing theequality relation between two vertices, edges, or sets, we instead use the equivalence sign ( ≡ ) toexpress 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 steptowards the construction of color k , we first construct a formula vertex-partition expressingthe property that a collection of vertex sets forms a partition of the vertices: the sets are disjointfrom each other and their union contains all vertices in the graph. vertex-partition ( U , . . . , U k ) ≡ ( ∀ v ) (cid:32) k (cid:95) i =1 v ∈ U k (cid:33) ∧ (cid:94) i (cid:54) = j ¬ ( v ∈ U i ∧ v ∈ U j ) A formula edge-partition expressing the property that a collection of edge sets forms a partitionof the edges in the graph may be constructed in the same way by changing vertex variables to edgevariables and vertex set variables to edge set variables.With the ability to partition vertices we can now construct color k . The construction uses thefact that a k -coloring forms a partition of the vertices with the additional property that, for everycolor class C , all edges have an endpoint of a different color than C . color k ≡ ( ∃ U , . . . , U k ) (cid:104) vertex-partition ( U , . . . , U k ) ∧ k (cid:94) i =1 ( ∀ e )( ∃ v )[I( e, v ) ∧ v (cid:54)∈ U i ] (cid:105) A.2 Minor containment and planarity
Next, we construct a formula minor H expressing the property that a graph has H as a minor. Ifwe label each of the k vertices in H with a distinct number in the range from 1 to k , then H is aminor of G if and only if there exists a corresponding collection of k connected and disjoint subsetsof the vertices of G , say U , . . . , 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 agraph 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 supportsa nontrivial cut of the vertices with an empty cut-set. disconnected ≡ ( ∃ U ) (cid:104) ( ∃ u, v ) (cid:2) u ∈ U ∧ v (cid:54)∈ U (cid:3) ∧ ¬ ( ∃ e )( ∃ u, v ) (cid:2) I( e, u ) ∧ I( e, v ) ∧ u ∈ U ∧ v (cid:54)∈ U (cid:3)(cid:105)
13e 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 . minor H ≡ ∃ ( U , . . . , U k ) (cid:34) k (cid:94) i =1 ( ∃ u )[ u ∈ U i ] ∧ k (cid:94) i =1 connected-vertices ( U i ) ∧ (cid:94) i (cid:54) = j ( ∀ v )[ v (cid:54)∈ U i ∨ v (cid:54)∈ U j ] ∧ (cid:94) ( i,j ) ∈ E H ( ∃ e )( ∃ x, y )[I( e, x ) ∧ I( e, y ) ∧ x ∈ U i ∧ y ∈ U j ] (cid:35) Since the planar graphs are precisely the graphs that have neither K nor K , as minors, wehave planar ≡ ¬ minor K ∧¬ minor K , 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. Aset of edges F in a graph is a union of vertex-disjoint cycles if every edge in F is adjacent to exactlytwo edges in F other than itself. Thus, cycle-set ( F ) ≡ ( ∀ e ) (cid:104) e ∈ F → ( ∃ =2 f ) (cid:2) f ∈ F ∧ e (cid:54) = f ∧ ( ∃ v )[I( e, v ) ∧ I( f, v )] (cid:3)(cid:105) expresses the property that F is a disjoint union of cycles. (Here ∃ =2 is a logical shorthand for theexistence of exactly two objects satisfying the given property, i.e. that there exist f and f bothsatisfying the property, that f and f are unequal, and that there do not exist three unequal edgesall satisfying the property.) Then a set of edges is a single cycle if it is a union of cycles and formsa connected subgraph. So we define cycle ( F ) ≡ cycle-set ( F ) ∧ connected-edges ( F ) , A set of edges F spans a graph if every vertex is incident to at least one of the edges in F . span ( F ) ≡ ( ∀ v )( ∃ e )[ e ∈ F ∧ I( e, v )]Finally, a graph is Hamiltonian if it has a spanning cycle. hamiltonian ≡ ( ∃ F )[ cycle ( F ) ∧ span ( F )] 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 thatsurround a maximal subset of their page. Then let X i be the edges in X drawn in the interior ofone of these cycles, and X b the remaining edges in X . It can be easily verified that the constructedpartition satisfies Properties 1 through 6. 14
23 456 7 8910 1112
Fig. 5.
The contraction of the graph in Figure 4 and its planar dual (drawn with blue vertices and green edges). Theedge labels correspond to the Hamiltonian cycle ordering of the vertices of G . Conversely, suppose we have a graph G with a partition of its edges satisfying the propertiesof the lemma. By Property 6, separate( G ; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ) has a planar embedding. Wemay assume without loss of generality that, in this embedding, the cycles of X c given by Property 1separate 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 cancross. 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 thecomponents of the rest of the graph to the exterior of the cycle, preserving the (reflected) planarembedding of each flipped component, without introducing any new crossings. By performing thisflipping 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 thecycles ( X c ) and isthmuses ( X b ) in each page ( X = A and B ), maintaining the orientation of theedges that were not contracted. As a consequence, the edges in X i within each cycle of X c arealso contracted. However, in the embedding of separate( G ; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ), none of thecontracted cycles surrounds any part of the graph that is not itself contracted. As a result, we areleft 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 evendegree 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. Thistour can be represented geometrically as a Jordan curve J that passes through the faces of theembedding of separate( G ; A b ∪ A c ∪ A i , B b ∪ B c ∪ B i ) (in some cases more than once per face) andcrosses 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 embeddingof G itself by contracting all the edges of the form ( v, A )–( v, B ). If we augment G by adding anedge uv between any two vertices u and v whose edges ( u, A )–( u, B ) and ( v, A )–( v, B ) are crossedconsecutively by the Jordan curve J , then J can be used to guide a non-crossing placement of theseadditional edges within the resulting embedding of G . Thus, we have augmented G to a Hamiltonianplanar supergraph. The Jordan curve passing through these contracted edges gives us a routing ofa set of pairsThe planar dual of this graph has an Euler tour, as the primal graph is bipartite. This tourcorresponds to Hamiltonian cycle in a planar supergraph of G , where edges are added between15ertices if the edge does not already exist. The result that G has a 2-page book embedding followsby Lemma 9. (cid:117)(cid:116)(cid:117)(cid:116)