\section{Introduction}

A drawing of a graph $G$ in the plane is a mapping, in which every vertex of $G$ is mapped into a point in the plane, and every edge into a continuous curve connecting the images of its endpoints.
We assume that no three curves meet at the same point, and no curve contains an image of any vertex other than its endpoints.
A \emph{crossing} in such a drawing is a point where the images of two edges intersect, and the \emph{crossing number} of a graph $G$, denoted by $\optcro{G}$, is the smallest number of crossings achievable by any drawing of $G$ in the plane. The goal in the {\sf Minimum Crossing Number}\xspace problem is to find a drawing of the input graph $G$ with minimum number of crossings.
We denote by $n$ the number of vertices in $G$, and by $d_{\mbox{\textup{\footnotesize{max}}}}$ its maximum vertex degree.

The concept of the graph crossing number dates back to 1944, when P\'al Tur\'an has posed the question of determining the crossing number of the complete bipartite graph $K_{m,n}$. This question was motivated by improving the performance of workers at a brick factory, where Tur\'an has been working at the time (see Tur\'an's account in \cite{turan_first}). Later, Anthony Hill (see~\cite{Guy-complete-graphs}) has posed the question of computing the crossing number of the complete graph $K_n$, and Erd\"{o}s and Guy~\cite{erdos_guy73} noted that
\emph{``Almost all questions one can ask about crossing numbers remain unsolved.''}
Since then, the problem has become a subject of intense study, with hundreds of papers written on the subject (see, e.g. the extensive bibliography maintained by Vrt'o \cite{vrto_biblio}.)
Despite this enormous stream of results and ideas, some of the most basic questions about the crossing number problem remain unanswered.
For example, the crossing number of $K_{11}$ was established just a few years ago (\cite{K11}), while the answer for $K_t, t\geq 13$, remains elusive.
We note that in general $\optcro{G}$ can be as large as $\Omega(n^4)$, for example for the complete graph. In particular, one of the famous results in this area, due to Ajtai et al.~\cite{ajtai82} and Leighton~ \cite{leighton_book} states that if $|E(G)|\geq 4n$, then $\optcro{G}=\Omega(|E(G)|^3/n^2)$.

In this paper we focus on the algorithmic aspect of the problem.
The first non-trivial algorithm for {\sf Minimum Crossing Number}\xspace was obtained by Leighton and Rao \cite{LR},
who combined their breakthrough result on balanced separators with the techniques of Bhatt and Leighton~\cite{bhatt84} for VLSI design, to obtain an algorithm that finds a drawing of any bounded-degree $n$-vertex graph with at most $O(\log^4 n) \cdot (n + \optcro{G})$ crossings.
This bound was later improved to $O(\log^3 n) \cdot (n+\optcro{G})$ by Even, Guha and Schieber \cite{EvenGS02}, and the new approximation algorithm of Arora, Rao and Vazirani~\cite{ARV} for Balanced Cut  gives a further improvement to $O(\log^2 n) \cdot (n+\optcro{G})$, thus implying an $O(n \cdot \log^2 n)$-approximation for {\sf Minimum Crossing Number}\xspace on bounded-degree graphs. This result can also be extended to general graphs with maximum vertex degree $d_{\mbox{\textup{\footnotesize{max}}}}$, where the approximation factor becomes  $O(n\cdot\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}})\cdot \log^2n)$. Chuzhoy, Makarychev and Sidiropoulos~\cite{CMS10} have recently improved this result to an $O(n\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}})\cdot \log^{3/2} n)$-approximation.
On the negative side, the problem was shown to be NP-complete by Garey and Johnson \cite{crossing_np_complete}, and remains NP-complete even on cubic graphs~\cite{Hlineny06a}.
More surprisingly, even in the very restricted case, where the input graph $G$ is obtained by adding a single edge to a planar graph, the problem is still NP-complete~\cite{cabello_edge}.
The NP-hardness proof of ~\cite{crossing_np_complete}, combined with the inapproximability result for Minimum Linear-Arrangement \cite{Ambuhl07}, implies that there is no PTAS for {\sf Minimum Crossing Number}\xspace unless NP has randomized subexponential time algorithms.

To summarise, although current lower bounds do not rule out the possibility of a constant-factor approximation for the problem, the state of the art, prior to this work, only gives an $\tilde O(n\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}))$-approximation. In view of this glaring gap in our understanding of the problem, a natural question is whether we can obtain good algorithms for the case where the optimal solution cost is low --- arguably, the most interesting setting for this problem.
A partial answer was given by Grohe~\cite{Grohe04}, who showed that the problem is fixed-parameter tractable. Specifically, Grohe designed an exact $O(n^2)$-time algorithm, for the case where the optimal solution cost is bounded by a constant. Later, Kawarabayashi and Reed \cite{KawarabayashiR07} have shown a linear-time algorithm for the same setting. Unfortunately, the running time of both algorithms depends super-exponentially on the optimal solution cost.

Our main result is an efficient randomized algorithm, that, given any $n$-vertex graph with maximum degree $d_{\mbox{\textup{\footnotesize{max}}}}$,
produces a drawing of $G$ with $O\left ((\optcro{G})^{10}\cdot\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)\right )$ crossings with high probability. In particular, we obtain an $O\left (n^{9/10}\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)\right )$-approximation for general graphs, and an
$\tilde{O}(n^{9/10})$-approximation for bounded-degree graphs, thus breaking the long standing barrier of $\tilde{O}(n)$-approximation for this setting.

We note that many special cases of the {\sf Minimum Crossing Number}\xspace problem have been extensively studied, with better approximation algorithms known for some.
Examples include $k$-apex graphs~\cite{crossing_apex,CMS10}, bounded genus graphs~\cite{BorozkyPT06,crossing_genus,crossing_projective,crossing_torus,CMS10} and minor-free graphs~\cite{WoodT06}.
Further overview of work on {\sf Minimum Crossing Number}\xspace can be found in the expositions of Richter and Salazar \cite{richter_survey}, Pach and T\'{o}th \cite{pach_survey}, Matou\v{s}ek \cite{matousek_book}, and Sz\'{e}kely \cite{szekely_survey}.

\noindent {\bf Our results and techniques.}
Our main result is summarized in the following theorem.

\begin{theorem}\label{theorem: main-crossing-number}
There is an efficient randomized algorithm, that, given any $n$-vertex graph $G$ with maximum degree $d_{\mbox{\textup{\footnotesize{max}}}}$, finds a drawing of $G$ in the plane with $O\left ((\optcro{G})^{10}\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)\right )$ crossings with high probability.
\end{theorem}

Combining this theorem with the algorithm of Even et al.~\cite{EvenGS02}, we obtain the following corollary.

\begin{corollary}\label{corollary: main-approx-crossing-number}
There is an efficient randomized $O\left (n^{9/10}\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)\right )$-approximation algorithm for {\sf Minimum Crossing Number}\xspace.
\end{corollary}

We now give an overview of our techniques. Instead of directly solving the {\sf Minimum Crossing Number}\xspace problem, it is more  convenient to work with a closely related problem -- {\sf Minimum Planarization}\xspace.
In this problem, given a graph $G$, the goal is to find a minimum-cardinality subset $E^*$ of edges, such that the graph $G\setminus E^*$ is planar.
The two problem are closely related, and this connection was recently formalized by~\cite{CMS10}, in the following theorem:

\begin{theorem}[\cite{CMS10}]\label{thm:CMS10}
Let $G=(V,E)$ be any $n$-vertex graph of maximum degree $d_{\max}$, and suppose we are given a subset $E^*\subset E$ of edges, $|E^*|=k$, such that $G\setminus E^*$ is planar.
Then there is an efficient algorithm to find a drawing of $G$ in the plane with at most $O\left(d_{\max}^3 \cdot k \cdot (\optcro{G} + k)\right)$ crossings.
\end{theorem}

Therefore, in order to solve the {\sf Minimum Crossing Number}\xspace problem, it is sufficient to find a good solution to the {\sf Minimum Planarization}\xspace problem on the same graph.
We note that an $O(\sqrt {n\log n}\cdot d_{\mbox{\textup{\footnotesize{max}}}})$-approximation algorithm for the {\sf Minimum Planarization}\xspace problem follows easily from  the Planar Separator theorem of Lipton and Tarjan~\cite{planar-separator} (see e.g.~\cite{CMS10}), and we are not aware of any other algorithmic results for the problem.
 Our main technical result is the proof of the following theorem, which, combined with Theorem~\ref{thm:CMS10}, implies Theorem~\ref{theorem: main-crossing-number}.

\begin{theorem}\label{thm:main}
There is an efficient randomized algorithm, that,
given an $n$-vertex graph $G=(V,E)$ with maximum degree $d_{\mbox{\textup{\footnotesize{max}}}}$, finds a subset $E^*\subseteq E$ of edges, such that $G\setminus E^*$ is planar, and  with high probability $|E^*| = O\left ((\optcro{G})^5\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n)\right )$.
\end{theorem}

We now describe our main ideas and techniques. Given an optimal solution $\phi$ to the {\sf Minimum Crossing Number}\xspace problem on graph $G$, we say that an edge $e\in E(G)$ is \emph{good} iff it does not participate in any crossings in $\phi$. For convenience, we consider a slightly more general version of the problem, where, in addition to the graph $G$, we are given a simple cycle $X\subseteq G$, that we call the \emph{bounding box}, and our goal is to find a drawing of $G$, such that the edges of $X$ do not participate in any crossings, and all vertices and edges of $G\setminus X$ appear on the same side of the closed curve to which $X$ is mapped. In other words, if $\gamma_X$ is the simple closed curve to which $X$ is mapped, and $F_1,F_2$ are the two faces into which $\gamma_X$ partitions the plane, then one of the faces $F\in \set{F_1,F_2}$ must contain the drawings of all the edges and vertices of $G\setminus X$. We call such a drawing \emph{a drawing of $G$ inside the bounding box $X$}. Since we allow $X$ to be empty, this is indeed a generalization of the {\sf Minimum Crossing Number}\xspace problem. In fact, from Theorem~\ref{thm:CMS10}, it is enough to find what we call a \emph{weak solution} to the problem, namely, a small-cardinality subset $E^*$ of edges with $E^*\cap E(X)=\emptyset$, such that there is a planar drawing of the remaining graph $G\setminus E^*$ inside the bounding box $X$. Our proof consists of three major ingredients that we describe below.

The algorithm is iterative. Throughout the algorithm, we gradually remove some edges from the graph, and gradually build a planar drawing of the remaining graph. One of the central notions we use is that of \emph{graph skeletons}. A skeleton $K$ of graph $G$ is simply a sub-graph of $G$, that contains the bounding box $X$, and has a unique planar drawing (for example, it may be convenient to think of $K$ as being $3$-vertex connected). Given a skeleton $K$, and a small subset $E'$ of edges (that we eventually remove from the graph), we say that $K$ is an \emph{admissible skeleton} iff all the edges of $K$ are good, and every connected component of $G\setminus (K\cup E')$ only contains a small number of vertices (say, at most $(1-1/\rho)n$, for some balance parameter $\rho$). Since $K$ has a unique planar drawing, and all its edges are good, we can find its unique planar drawing efficiently, and it must be identical to the drawing $\phi_K$ of $K$ induced by the optimal solution $\phi$. Let ${\mathcal{F}}$ be the set of faces in this drawing. Since $K$ only contains good edges, for each connected component $C$ of $G\setminus (K\cup E')$, all edges and vertices of $C$ must be drawn completely inside one of the faces $F_C\in {\mathcal{F}}$ in $\phi$. Therefore, if, for each such connected component $C$, we can identify the face $F_C$ inside which it needs to be embedded, then we can recursively solve the problems induced by each such component $C$, together with the bounding box formed by the boundary of $F_C$. In fact, given an admissible skeleton $K$, we show that we can find a good assignment of the connected components of $G\setminus (K\cup E')$ to the faces of ${\mathcal{F}}$, so that, on the one hand, all resulting sub-problems have solutions of total cost at most $\optcro{G}$, while, on the other hand, if we combine weak solutions to these sub-problems with the set $E'$ of edges, we obtain a feasible weak solution to the original problem. The assignment of the components to the faces of ${\mathcal{F}}$ is done by reducing the problem to an instance of the Min-Uncut problem. We defer the details of this part to later sections, and focus here on finding an admissible skeleton $K$.

Our second main ingredient is the use of well-linked sets of vertices, and well-linked balanced bi-partitions. Given a set $S$ of vertices, let $G[S]$ be the sub-graph of $G$ induced by $S$, and let $\Gamma(S)$ be the subset of vertices of $S$ adjacent to the edges in $E(S,\overline S)$. Informally, we say that $S$ is $\alpha$-well-linked, iff every pair of vertices in $\Gamma(S)$ can send one flow unit to each other, with overall congestion bounded by $\alpha|\Gamma(S)|$. We say that a bi-partition $(S,\overline S)$ of the vertices of $G$ is $\rho$-balanced and $\alpha$-well-linked, iff $|S|,|\overline S|\geq n/\rho$, and both $S$ and $\overline S$ are $\alpha$-well-linked. Suppose we can find a $\rho$-balanced, $\alpha$-well linked bi-partition of $G$ (it is convenient to think of $\rho,\alpha=\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n)$). In this case, we show a randomized algorithm, that w.h.p. constructs an admissible skeleton $K$, as follows. Let ${\mathcal{P}},{\mathcal{P}}'$ be the collections of the flow-paths in $G[S]$ and $G[\overline S]$ respectively, guaranteed by the well-linkedness of $S$ and $\overline S$. Since the congestion on all edges is relatively low, only a small number of paths in ${\mathcal{P}}\cup {\mathcal{P}}'$ contain bad edges. Therefore, if we choose a random collection of paths from ${\mathcal{P}}$ and ${\mathcal{P}}'$ with appropriate probability, the resulting skeleton $K$, obtained from the union of these paths, is unlikely to contain bad edges. Moreover, we can show that w.h.p., every connected component of $G\setminus K$ only contains a small number of edges in $E(S,\overline S)$. It is still possible that some connected component $C$ of $G\setminus K$ contains many vertices of $G$. However, only one such component $C$ may contain more than $n/2$ vertices. Let $E'$ be the subset of edges in $E(S,\overline S)$, that belong to $C$. Then, since the original cut $(S,\overline S)$ is $\rho$-balanced, once we remove the edges of $E'$ from $C$, it will decompose into small enough components. This will ensure that all connected components of $G\setminus (K\cup E')$ are small enough, and $K$ is admissible.

Using these ideas, given an efficient algorithm for computing $\rho$-balanced $\alpha$-well-linked cuts, we can obtain an algorithm for the {\sf Minimum Crossing Number}\xspace problem. Unfortunately, we do not have an efficient algorithm for computing such cuts. We can only compute such cuts in graphs that do not contain a certain structure, that we call \emph{nasty vertex sets}. Informally, a subset $S$ of vertices is a nasty set, iff $|S|>>|E(S,\overline S)|^2$, and the sub-graph $G[S]$ induced by $S$ is planar. We show an algorithm, that, given any graph $G$, either produces a $\rho$-balanced $\alpha$-well linked cut, or finds a nasty set $S$ in $G$. Therefore, if $G$ does not contain any nasty sets, we can compute the $\rho$-balanced $\alpha$-well-linked bi-paritition of $G$, and hence obtain an algorithm for {\sf Minimum Crossing Number}\xspace.
Moreover, given {\bf any} graph $G$, if our algorithm fails to produce a good solution to {\sf Minimum Crossing Number}\xspace on $G$, then w.h.p. it returns a nasty set of vertices in $G$.

The third major component of our algorithm is handling the nasty sets. Suppose we are given a nasty set $S$, and assume for now that it is also $\alpha$-well-linked for some parameter $\alpha=\operatorname{poly}(\log n)$.  Let $\Gamma(S)$ denote the endpoints of the edges in $E(S,\overline S)$ that belong to $S$, and let $|\Gamma(S)|=z$. Recall that $|S|>>z^2$, and $G[S]$ is planar. Intuitively, in this case we can use the $z\times z$ grid to ``simulate'' the sub-graph $G[S]$. More precisely, we replace the sub-graph $G[S]$ with the $z\times z$ grid $Z_S$, and identify the vertices of the first row of the grid with the vertices in $\Gamma(S)$. We call the resulting graph the \emph{contracted graph}, and denote it by $G_{|S}$. Notice that the number of vertices in $G_{|S}$ is smaller than that in $G$.
When $S$ is not well-linked, we perform a simple well-linked decomposition procedure to partition $S$ into a collection of well-linked subsets, and replace each one of them with a grid separately.
Given a drawing of the resulting contracted graph $G_{|S}$, we say that it is a \emph{canonical drawing} if the edges of the newly added grids do not participate in any crossings. Similarly, we say that a planarizing subset $E^*$ of edges is a weak canonical solution for $G_{|S}$, iff the edges of the grids do not belong to $E^*$.
We show that the crossing number of $G_{|S}$ is bounded by $\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)\optcro{G}$, and this bound remains true even for canonical drawings. On the other hand, we show that given any weak canonical solution $E^*$ for $G_{|S}$, we can efficiently find a weak solution of comparable cost for $G$. Therefore, it is enough to find a weak feasible canonical solution for graph $G_{|S}$.
However, even the contracted graph $G_{|S}$ may still contain nasty sets. We then show that, given any nasty set $S'$ in $G_{|S}$, we can find another subset $S''$ of vertices in the original graph $G$, such that the contracted graph $G_{|S''}$ contains fewer vertices than $G_{|S}$. The crossing number of $G_{|S''}$ is again bounded by $\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)\optcro{G}$ even for canonical drawings, and a weak canonical solution to $G_{|S''}$ gives a weak solution to $G$ as before.

Our algorithm then consists of a number of stages. In each stage, it starts with the current contracted graph $G_{|S}$ (where in the first stage, $S=\emptyset$, and $G_{|S}=G$). It then either finds a good weak canonical solution for problem $G_{|S}$, thus giving a feasible solution to the original problem, or returns a nasty set $S'$ in graph $G_{|S}$. We then construct a new contracted graph $G_{|S''}$, that contains fewer vertices than $G_{|S}$, and becomes the input to the next stage.

\noindent{\bf Organization.} We start with some basic definitions, notation, and general results on cuts and flows in Section~\ref{sec: Prelims}. We then present a more detailed algorithm overview in Section~\ref{sec: overview}. Section~\ref{sec: graph contraction} is devoted to the graph contraction step, and the rest of the algorithm appears in Sections~\ref{sec: alg} and~\ref{sec: iteration}. For convenience, the list of all main parameters appears in Section~\ref{sec: param-list} of Appendix. Our conclusions appear in Section~\ref{sec: conclusions}.

\label{------------------------------------------------Preliminaries--------------------------------------------}
\section{Preliminaries and Notation}\label{sec: Prelims}
 In order to avoid confusion, throughout the paper, we denote the input graph by ${\mathbf{G}}$, with $|V({\mathbf{G}})|=n$, and maximum vertex degree $d_{\mbox{\textup{\footnotesize{max}}}}$.

 In statements regarding general arbitrary graphs, we will denote them by $G$, to distinguish them from the specific graph ${\mathbf{G}}$.

\noindent{\bf General Notation.}
We use the words ``drawing'' and ``embedding'' interchangeably.
Given any graph $G$, a drawing $\phi$ of $G$, and any sub-graph $H$ of $G$, we denote by $\phi_H$ the drawing of $H$ induced by $\phi$, and by $\operatorname{cr}_{\phi}(G)$ the number of crossings in the drawing $\phi$ of $G$. Notice that we can assume w.l.o.g. that no edge crosses itself in any drawing. For any pair $E_1,E_2\subseteq E(G)$ of subsets of edges, we denote by $\operatorname{cr}_{\phi}(E_1,E_2)$ the number of crossings in $\phi$ in which the images of edges of $E_1$ intersect the images of edges of $E_2$, and by $\operatorname{cr}_{\phi}(E_1)$ the number of crossings in $\phi$ in which the images of edges of $E_1$ intersect with each other. Given two disjoint sub-graphs $H_1,H_2$ of $G$, we will sometimes write $\operatorname{cr}_{\phi}(H_1,H_2)$ instead of $\operatorname{cr}_{\phi}(E(H_1),E(H_2))$, and $\operatorname{cr}_{\phi}(H_1)$ instead of $\operatorname{cr}_{\phi}(E(H_1))$.
If $G$ is a planar graph, and $\phi$ is a drawing of $G$ with no crossings, then we say that $\phi$ is a \emph{planar} drawing of $G$.
For a graph $G=(V,E)$, and subsets $V'\subseteq V$, $E'\subseteq E$ of its vertices and edges respectively, we denote by $G[V']$, $G\setminus V'$, and $G\setminus E'$ the sub-graphs of $G$ induced by $V'$, $V\setminus V'$, and $E\setminus E'$, respectively.

\begin{definition}
Let $\gamma$ be any closed simple curve, and let $F_1,F_2$ be the two faces into which $\gamma$ partitions the plane. Given any drawing $\phi$ of a graph $G$, we say that $G$ is \emph{embedded inside $\gamma$}, iff one of the faces $F\in\set{F_1,F_2}$ contains the images of all edges and vertices of $G$ (the images of the vertices of $G$ may lie on $\gamma$). Similarly, if $C\subseteq G$ is a simple cycle, then we say that $G$ is embedded inside $C$, iff the edges of $C$ do not participate in any crossings, and $G\setminus E(C)$ is embedded inside $\gamma_C$ -- the simple closed curve to which $C$ is mapped.
\end{definition}

Given a graph $G$ and a bounding box $X$, we define the problem $\pi(G,X)$, that we use extensively.

\begin{definition}
Given a graph $G$ and a simple (possibly empty) cycle $X\subseteq G$, called the \emph{bounding box}, a \emph{strong solution} for problem $\pi(G,X)$, is a drawing $\psi$ of $G$, in which $G$ is embedded inside the bounding box $X$, and its cost is the number of crossings in $\psi$. A \emph{weak solution} to  problem $\pi(G,X)$ is a subset $E'\subseteq E(G)\setminus E(X)$ of edges, such that $G\setminus E'$ has a \emph{planar drawing}, in which it is embedded inside the bounding box $X$. \end{definition}

Notice that in order to prove Theorem~\ref{thm:main}, it is enough to find a weak solution for problem $\pi({\mathbf{G}},X_0)$, where $X_0=\emptyset$, of cost $O\left ((\optcro{{\mathbf{G}}})^5\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n)\right )$.

\begin{definition} For any graph $G=(V,E)$, a subset $V'\subseteq V$ of vertices is called a $c$-separator, iff $|V'|=c$, and the graph $G\setminus V'$ is not connected. We say that $G$ is $c$-connected iff it does not contain $c'$-separators, for any $0<c'<c$.
 \end{definition}

We will use the following four well-known results:

\begin{theorem} (Whitney~\cite{Whitney})\label{thm:Whitney} Every 3-connected planar graph has a unique planar drawing.
\end{theorem}

\begin{theorem}(Hopcroft-Tarjan~\cite{planar-drawing})\label{thm:planar drawing}
For any graph $G$, there is an efficient algorithm to determine whether $G$ is planar, and if so, to find a planar drawing of $G$.
\end{theorem}

\begin{theorem}(Ajtai et al.~\cite{ajtai82}, Leighton \cite{leighton_book})\label{thm: large average degree large crossing number}
Let $G$ be any graph with $n$ vertices and $m\geq 4n$ edges. Then $\optcro{G}=\Omega(m^3/n^2)=\Omega(n)$.
\end{theorem}

\begin{theorem}(Lipton-Tarjan~\cite{planar-separator})\label{thm: planar separator}
Let $G$ be any $n$-vertex planar graph. Then there is a constant $q$, and an efficient algorithm to partition the vertices of $G$ into three sets $A,B,C$, such that $|A|,|C|\geq n/3$, $|B|\leq q\sqrt{n}$, and there are no edges in $G$ connecting the vertices of $A$ to the vertices of $C$.
\end{theorem}

\subsection{Well-linkedness}

\begin{definition} Let $G=(V,E)$ be any graph, and $J\subseteq V$ any subset of its vertices. We denote by $\operatorname{out}_G(J)=E_G(J,V\setminus J)$, and we call the edges in $\operatorname{out}_G(J)$ the \emph{terminal edges for $J$}. For each terminal edge $e=(u,v)$, with $u\in J$, $v\not \in J$, we call $u$ the \emph{interface vertex} and $v$ the \emph{terminal vertex} for $J$. We denote by $\Gamma_G(J)$ and $T_G(J)$ the sets of all interface and terminal vertices for $J$, respectively, and we omit the subscript $G$ when clear from context (see Figure~\ref{fig: terminal interface vertices}).
\end{definition}

\begin{figure}[h]
\scalebox{0.3}{\rotatebox{0}{\includegraphics{terminal-vertices-edges-cut.pdf}}} \caption{Terminal vertices and edges for set $J$ are red; interface vertices are blue. \label{fig: terminal interface vertices}}
\end{figure}

\begin{definition} Given a graph $G$, a subset $J$ of its vertices, and a parameter $\alpha>0$, we say that $J$ is $\alpha$-well-linked, iff for any partition $(J_1,J_2)$ of $J$, if we denote by $T_1=\operatorname{out}(J_1)\cap \operatorname{out}(J)$, and by $T_2=\operatorname{out}(J_2)\cap \operatorname{out}(J)$, then
$|E(J_1,J_2)|\geq \alpha\cdot \min\set{|T_1|,|T_2|}$
\end{definition}

Notice that if  $G$ is a connected graph and $J\subset V(G)$ is $\alpha$-well-linked for any $\alpha>0$, then $G[J]$ must be connected. Finally, we define $\rho$-balanced $\alpha$-well-linked bi-partitions.

\begin{definition} Let $G$ be any graph, and let $\rho>1, 0<\alpha\leq 1$ be any parameters. We say that a bi-partition $(S,\overline S)$ of $V(G)$ is $\rho$-balanced and $\alpha$-well-linked, iff $|S|,|\overline S|\geq |V(G)|/\rho$ and both $S$ and $\overline S$ are $\alpha$-well-linked.
\end{definition}

\subsection{Sparsest Cut and Concurrent Flow}\label{subsec: sparsest cut}
In this section we summarize some well-known results on graph cuts and flows that we use throughout the paper.
We start by defining the non-uniform sparsest cut problem. Suppose we are given a graph $G=(V,E)$, with weights $w_v$ on vertices $v\in V$. Given any partition $(A,B)$ of $V$, the \emph{sparsity} of the cut $(A,B)$ is $\frac{|E(A,B)|}{\min\set{W(A),W(B)}}$, where $W(A)=\sum_{v\in A}w_v$ and $W(B)=\sum_{v\in B}w_v$. In the non-uniform sparsest cut problem, the input is a graph $G$ with weights on vertices, and the goal is to find a cut of minimum sparsity. Arora, Lee and Naor~\cite{sparsest-cut} have shown an $O(\sqrt{\log n}\cdot \log\log n)$-approximation algorithm for the non-uniform sparsest cut problem. We denote by $\ensuremath{{\mathcal{A}}_{\mbox{\textup{\footnotesize{ALN}}}}}\xspace$ this algorithm and by $\ensuremath{\alpha_{\mbox{\textup{\footnotesize{ALN}}}}}=O(\sqrt{\log n}\cdot\log\log n)$ its approximation factor.
We will usually work with a special case of the sparsest cut problem, where we are given a subset $T\subseteq V$ of vertices, called terminals, and the vertex weights are $w_v=1$ for $v\in T$, and $w_v=0$ otherwise.

A problem dual to sparsest cut is the maximum concurrent multicommodity flow problem.
Here, we need to compute the maximum value $\lambda$, such that $\lambda/|T|$ flow units can be simultaneously sent in $G$ between every pair of terminals with no congestion. The flow-cut gap is the maximum possible ratio, in any graph, between the value of the minimum sparsest cut and the maximum concurrent flow. The value of the flow-cut gap in undirected graphs, that we denote by $\ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} $ throughout the paper, is $\Theta(\log n)$~\cite{LR, GVY,LLR,Aumann-Rabani}.
In particular, if the value of the sparsest cut is $\alpha$, then every pair of terminals can send $\frac{\alpha}{|T|\cdot \ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }$ flow units to each other with no congestion.

Let $G$ be any graph, let $S$ be a subset of vertices of $G$, and let $0 < \alpha < 1$, such that $S$ is $\alpha$-well-linked.
We now define the sparsest cut and the concurrent flow instances corresponding to $S$, as follows.
For each edge $e\in \operatorname{out}(S)$, we sub-divide the edge by adding a new vertex $t_e$ to it. Let $G'$ denote the resulting graph, and let $T$ denote the set of all vertices $t_e$ for $e\in \operatorname{out}_G(S)$.
Consider the graph $H=G'[S]\cup \operatorname{out}_{G'}(S)$. We can naturally define an instance of the non-uniform sparsest cut problem on $H$, where the set of terminals is $T$. The fact that $S$ is $\alpha$-well-linked is equivalent to the value of the sparsest cut in the resulting instance being at least $\alpha$.
We obtain the following simple well-known consequence:

\begin{observation}\label{observation: existence of flow in well-linked instance}
Let $G$, $S$, $H$, and $T$ be defined as above, and let $0<\alpha<1$, such that $S$ is $\alpha$-well-linked. Then every pair of vertices in $T$ can send one flow unit to each other in $H$, such that the maximum congestion on any edge is at most $\ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} |T|/\alpha$.
Moreover, if $M$ is any partial matching on the vertices of $T$, then we can send one flow unit between every pair $(u,v)\in M$ in graph $H$, with maximum congestion at most $2\ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} /\alpha$.
\end{observation}
\begin{proof}
The first part is immediate from the definition of the flow-cut gap. Let $F$ denote the resulting flow. In order to obtain the second part, for every pair $(u,v)\in M$,
 $u$ will send $1/|T|$ flow units to every vertex in $T$, and $v$ will collect $1/|T|$ flow units from every vertex in $T$, via the flow $F$. It is easy to see that every flow-path is used at most twice.
\end{proof}

For convenience, when given an $\alpha$-well-linked subset $S$ of vertices in a graph $G$, we will omit the subdivision of the edges in $\operatorname{out}(S)$, and we will say that the edges $e\in \operatorname{out}(S)$ send flow to each other, instead of the corresponding vertices $t_e$.

We will also use the algorithm of Arora, Rao and Vazirani~\cite{ARV} for balanced cut, summarized below.

\begin{theorem}[Balanced Cut~\cite{ARV}]\label{thm: ARV}
Let $G$ be any $n$-vertex graph, and suppose there is a partition of the vertices of $G$ into two sets, $A$ and $B$, with $|A|,|B|\geq \epsilon n$ for some constant $\epsilon>0$, and
$|E(A,B)|=c$. Then there is an efficient algorithm to find a partition $(A',B')$ of the vertices of $G$, such that $|A'|,|B'|\geq \epsilon' n$ for some constant $0<\epsilon'<\epsilon$, and $|E(A',B')|\leq O(c\sqrt{\log n})$.
\end{theorem}

\subsection{Canonical Vertex Sets and Solutions}

As already mentioned in the Introduction, we will perform a number of graph contraction steps on the input graph ${\mathbf{G}}$, where in each such graph contraction step, a sub-graph of ${\mathbf{G}}$ will be replaced with a grid. So in general, if $H$ is the current graph, we will also be given a collection ${\mathcal{Z}}$ of disjoint subsets of vertices of $H$, such that for each $Z\in {\mathcal{Z}}$, $H[Z]$ is the $k_Z\times k_Z$ grid, for some $k_Z\geq 2$. We will also ensure that $\Gamma_H(Z)$ is precisely the set of the vertices in the first row of the grid $H[Z]$, and the edges in $\operatorname{out}_H(Z)$ form a matching between $\Gamma_H(Z)$ and $T_H(Z)$. Given such a graph $H$, and  a collection ${\mathcal{Z}}$ of vertex subsets, we will be looking for solutions in which the edges of the grids $H[Z]$ do not participate in any crossings. This motivates the following definitions of canonical vertex sets and canonical solutions.

Assume that we are given a graph $G$ and a collection ${\mathcal{Z}}$ of disjoint subsets of vertices of $G$, such that each subset $Z\in{\mathcal{Z}}$ is $1$-well-linked (but some vertices of $G$ may not belong to any subset $Z\in {\mathcal{Z}}$).

\begin{definition}\label{definiton: canonical subset} We say that a subset $J\subseteq V$ of vertices is \emph{canonical} for ${\mathcal{Z}}$ iff for each $Z\in{\mathcal{Z}}$, either $Z\subseteq J$, or $Z\cap J=\emptyset$.
\end{definition}

We next define canonical drawings and canonical solutions w.r.t. the collection ${\mathcal{Z}}$ of subsets of vertices:

\begin{definition}\label{definition: canonical drawing} Let $G=(V,E)$ be any graph, and ${\mathcal{Z}}$ any collection of disjoint subsets of vertices of $G$. We say that a drawing $\phi$ of $G$ is \emph{canonical} for ${\mathcal{Z}}$ iff for each $Z\in {\mathcal{Z}}$, no edge of $G[Z]$ participates in crossings.
Similarly, we say that a solution $E^*$ to the {\sf Minimum Planarization}\xspace problem on $G$ is \emph{canonical} for ${\mathcal{Z}}$, iff for each $Z\in {\mathcal{Z}}$, no edge of $G[Z]$ belongs to $E^*$.
\end{definition}

\begin{definition}
Given a graph $G$, a simple cycle $X\subseteq G$ (that may be empty), and a collection ${\mathcal{Z}}$ of disjoint subsets of vertices of $G$, a \emph{strong solution} to problem $\pi(G,X,{\mathcal{Z}})$ is a drawing $\psi$ of $G$, in which the edges of $E(X)\cup\left(\bigcup_{Z\in{\mathcal{Z}}}E(G[Z])\right )$ do not participate in any crossings, and $G$ is embedded inside the bounding box $X$. The cost of the solution is the number of edge crossings in $\psi$. A \emph{weak solution} to  problem $\pi(G,X,{\mathcal{Z}})$ is a subset $E'\subseteq E(G)\setminus E(X)$ of edges, such that graph $G\setminus E'$ has a \emph{planar drawing} inside the bounding box $X$, and for all $Z\in {\mathcal{Z}}$, $E'\cap E(G[Z])=\emptyset$. \end{definition}

We will sometimes use the above definition for problem $\pi(G',X,{\mathcal{Z}})$, where $G'$ is a sub-graph of $G$. That is, some sets $Z\in {\mathcal{Z}}$ may not be contained in $G'$, or only partially contained in it. We can then define ${\mathcal{Z}}'$ to contain, for each $Z\in {\mathcal{Z}}$, the set $Z\cap V(G')$. We will sometimes use the notion of weak or strong solution to problem $\pi(G',X,{\mathcal{Z}})$ to mean weak or strong solutions to $\pi(G',X,{\mathcal{Z}}')$, to simplify notation.

\subsection{Cuts in Grids}

The following simple claim about grids and its corollary are used throughout the paper.

\begin{claim}\label{claim: cut of grids}
Let $Z$ be the $k\times k$ grid, for any integer $k\geq 2$, and let $\Gamma$ denote the set of vertices in the first row of $Z$. Let $(A,B)$ be any partition of the vertices of $Z$, with $A,B\neq \emptyset$. Then $|E(A,B)|\geq\min\set{|A\cap \Gamma|, |B\cap \Gamma|}+1$.
\end{claim}

\begin{proof}
Let $\Gamma_A=\Gamma\cap A$, $\Gamma_B=\Gamma\cap B$, and assume w.l.o.g. that $|\Gamma_A|\leq |\Gamma_B|$.
If $\Gamma_A=\emptyset$, then the claim is clearly true.
Otherwise, there is some vertex $t\in \Gamma_A$, such that a vertex $t'$ immediately to the right or to the left of $t$ in the first row of the grid belongs to $\Gamma_B$. Let $e=(t,t')$ be the corresponding edge in the first row of $Z$.
We can find a collection of $|\Gamma_A|$ edge-disjoint paths, connecting vertices in $\Gamma_A$ to vertices in  $\Gamma_B$, that do not include the edge $e$, as follows: assign a distinct row of $Z$ (different from the first row) to each vertex in $\Gamma_A$. Route each such vertex inside its column to its designated row, and inside this row to the column corresponding to some vertex in $\Gamma_B$. If we add the path consisting of the single edge $e$, we will obtain a collection of $|\Gamma_A|+1$ edge-disjoint paths, connecting vertices in $\Gamma_A$ to vertices in $\Gamma_B$. All these paths have to be disconnected by the above cut.
\end{proof}

\begin{corollary}\label{corollary: canonical s-t cut} Let $G$ be any graph, ${\mathcal{Z}}$ any collection of disjoint subsets of vertices of $G$, such that for each $Z\in {\mathcal{Z}}$, $G[Z]$ is the $k_Z\times k_Z$ grid, for $k_Z\geq 2$. Moreover, assume that each vertex in the first row of $Z$ is adjacent to exactly one edge in $\operatorname{out}_G(Z)$, and no other vertex of $Z$ is adjacent to edges in $\operatorname{out}_G(Z)$. Let $s,t$ be any pair of vertices of $G$, that do not belong to any set $Z\in {\mathcal{Z}}$, and let $(A,B)$ be the minimum $s$--$t$ cut in $G$. Then both sets $A$ and $B$ are canonical w.r.t. ${\mathcal{Z}}$.
\end{corollary}
\begin{proof}
Assume for contradiction that some set $Z\in {\mathcal{Z}}$ is split between the two sides, $A$ and $B$. Let $\Gamma=\Gamma(Z)$ denote the set of vertices in the first row of $Z$, and let $\Gamma_A=\Gamma\cap A$, $\Gamma_B=\Gamma\cap B$. Assume w.l.o.g. that $|\Gamma_A|\leq |\Gamma_B|$.
Then by Claim~\ref{claim: cut of grids} $|E(A\cap Z,B\cap Z)|>|\Gamma_A|$, and so the value of the cut $(A\setminus Z,B\cup Z)$ is smaller than the value of the cut $(A,B)$, a contradiction.
\end{proof}

\begin{claim}\label{claim: cutting the grid}
Let $Z$ be the $k\times k$ grid, for any integer $k\geq 2$, and let $\Gamma$ be the set of vertices in the first row of $Z$. Suppose we are given any partition $(A,B)$ of $V(Z)$, denote $\Gamma_A=\Gamma\cap A$, $\Gamma_B=\Gamma\cap B$, and assume that $|\Gamma_B|\leq |\Gamma_A|$. Then $|B|\leq 4|E(A,B)|^2$.
\end{claim}
\begin{proof}
Denote $M=|E(A,B)|$. Let $C_A$ denote the set of columns associated with the vertices in $\Gamma_A$, and similarly, $C_B$ is the set of columns associated with the vertices in $\Gamma_B$. Notice that $(C_A,C_B)$ define a partition of the columns of $Z$. We consider three cases.

The first case is when no column is completely contained in $A$. In this case, for every column in $C_A$, at least one edge must belong to $E(A,B)$, and so $M\geq |\Gamma_A|\geq k/2$. Since $|B|\leq |Z|\leq k^2$, the claim follows. From now on we assume that there is some grid column, denoted by $c$, that is completely contained in $A$.

The second case is when some grid column $c'$ is completely contained in $B$. In this case, it is easy to see that $M\geq k$ must hold, as there are $k$ edge-disjont paths connecting vertices of $c$ to vertices of $c'$ in $Z$. So $|B|\leq |Z|\leq k^2\leq M^2$, as required.

Finally, assume that no column is contained in $B$. Let $C'_B$ be the set of columns that have at least one vertex in $B$. Clearly, $M\geq |C'_B|$. Let $M'$ be the maximum number of vertices in any column $c'\in C'_B$, which are contained in $B$. Then $M\geq M'$ must hold, since there are $M'$ edge-disjoint paths between the vertices of column $c$, and the vertices of $c'\cap B$. On the other hand, $|B|\leq |C'_B|\cdot M'\leq M^2$.
\end{proof}

\subsection{Well-linked Decompositions}

The next theorem summarizes well-linked decomposition of graphs, which has been used extensively in graph decomposition (e.g., see~\cite{CSS,Raecke}). For completeness we provide its proof in Appendix.

\begin{theorem}[Well-linked decomposition]\label{thm: well-linked} Given any graph $G=(V,E)$, and any subset $J\subseteq V$ of vertices, we can efficiently find a partition ${\mathcal{J}}$ of $J$, such that each set $J'\in {\mathcal{J}}$ is $\alpha^*$-well-linked for $\alpha^*=\Omega(1/(\log^{3/2} n\log\log n))$, and $\sum_{J'\in {\mathcal{J}}}|\operatorname{out}(J')|\leq 2\operatorname{out}(J)$.
\end{theorem}

We now define some additional properties that set $J$ may possess, that we use throughout the paper. We will then show that if a set $J$ has any collection of these properties, then we can find a well-linked decomposition ${\mathcal{J}}$ of $J$, such that every set $J'\in {\mathcal{J}}$ has these properties as well.

\begin{definition} Given a graph $G$ and any subset $J\subseteq V(G)$ of its vertices, we say that $J$ has property (P1) iff the vertices of $T(J)$ are connected in $G\setminus J$. We say that it has property (P2) iff there is a planar drawing of $J$ in which all interface vertices $\Gamma(J)$ lie on the boundary of the same face, that we refer to as the \emph{outer face}. We denote such a planar drawing by $\pi(J)$. If there are several such drawing, we select any of them arbitrarily.
\end{definition}

The next theorem is an extension of Theorem~\ref{thm: well-linked}, and its proof appears in Appendix.

\begin{theorem}\label{thm: well-linked-general} Suppose we are given any graph $G=(V,E)$, a subset $J\subseteq V$ of vertices, and a collection ${\mathcal{Z}}$ of disjoint subsets of vertices of $V$, such that each set $Z\in {\mathcal{Z}}$ is $1$-well-linked. Then we can efficiently find a partition ${\mathcal{J}}$ of $J$, such that each set $J'\in {\mathcal{J}}$ is $\alpha^*$-well linked for $\alpha^*=\Omega(1/(\log^{3/2} n\log\log n))$, and $\sum_{J'\in {\mathcal{J}}}|\operatorname{out}(J')|\leq 2\operatorname{out}(J)$. Moreover, if $J$ has any combination of the following three properties: (1) property (P1); (2) property (P2); (3) it is a canonical set for ${\mathcal{Z}}$, then  each set $J'\in {\mathcal{J}}$ will also have the same combination of these properties.\end{theorem}

Throughout the paper, we use $\alpha^*$ to denote the parameter from Theorem~\ref{thm: well-linked-general}.

\label{--------------------------------sec: high level overview----------------------------------}
\section{High Level Algorithm Overview}\label{sec: overview}

In this section we provide a high-level overview of the algorithm.
We start by defining the notion of nasty vertex sets.

\begin{definition}
Given a graph $G$,
we say that a subset $S\subseteq V(G)$ of vertices is \emph{nasty} iff it has properties (P1) and (P2), and $|S|\geq \frac{2^{16}\cdot d_{\mbox{\textup{\footnotesize{max}}}}^6}{(\alpha^*)^2}\cdot|\Gamma(S)|^2$, where $\alpha^*$ is the parameter from Theorem \ref{thm: well-linked}.
\end{definition}

Note that we do not require that $G[S]$ is connected.

For the sake of clarity, let us first assume that the input graph ${\mathbf{G}}$ contains no nasty sets. Our algorithm then proceeds as follows. We use a balancing parameter $\rho=O(\optcro{G}\cdot\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n))$ whose exact value is set later. The algorithm  has $O(\rho\cdot\log n)$ iterations. At the beginning of each iteration $h$, we are given a collection $G_1,\ldots, G_{k_h}$ of $k_h\leq \optcro{G}$ disjoint sub-graphs of ${\mathbf{G}}$, together with bounding boxes $X_i\subseteq G_i$ for all $i$. We are guaranteed that w.h.p., there is a strong solution to each problem $\pi(G_i,X_i)$, of total cost at most $\optcro{{\mathbf{G}}}$.
In the first iteration, $k_1=1$, and the only graph is $G_1={\mathbf{G}}$, whose bounding box is $X_0=\emptyset$.

We now proceed to describe each iteration. The idea is to find a \emph{skeleton} $K_i$ for each graph $G_i$, with $X_i\subseteq K_i$, such that $K_i$ only contains good edges --- that is, edges that do not participate in any crossings in the optimal solution $\phi$, and $K_i$ has a unique planar drawing, in which $X_i$ serves as the bounding box. Therefore, we can efficiently find the drawing $\phi_{K_i}$ of the skeleton $K_i$, induced by the optimal drawing $\phi$. We then decompose the remaining graph $G_i\setminus E(K_i)$ into \emph{clusters}, by removing a small subset of edges from it, so that, on the one hand, for each such cluster $C$, we know the face $F_C$ of $\phi_{K_i}$ where we should embed it, while on the other hand, different clusters $C,C'$ do not interfere with each other, in the sense that we can find an embedding of each one of these clusters separately, and their embeddings do not affect each other. For each such cluster $C$, we then define a new problem $\pi(C,\gamma(F_C))$, where $\gamma(F_C)$ is the boundary of the face $F_C$. We will ensure that all resulting sub-problems have strong solutions whose total cost is at most $\optcro{{\mathbf{G}}}$. In particular, there are at most $\optcro{G}$ resulting sub-problems, for which $\emptyset$ is not a feasible weak solution. Therefore, in the next iteration we will need to solve at most $\optcro{G}$ new sub-problems.
The main challenge is to find $K_i$, such that the number of vertices in each such cluster $C$ is bounded by roughly $(1-1/\rho)|V(G_i)|$, so that the number of iterations is indeed bounded by $O(\rho \log n)$. We need this bound on the number of iterations, since the probability of successfully constructing the skeletons in each iteration is only $(1-1/\rho)$. Roughly speaking, we are able to build the skeleton as required, if we can find a $\rho$-balanced $\alpha$-well-linked bipartition of the vertices of $G_i$, where $\alpha=1/\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n)$. We are only able to find such a partition if no nasty sets exist in ${\mathbf{G}}$. More precisely, we show an efficient algorithm, that either finds the desired bi-partition, or returns a nasty vertex set.

In order to obtain the whole algorithm, we therefore need to deal with nasty sets. We do so by performing a graph contraction step, which is formally defined in the next section. Informally,
given a nasty set $S$, we find a partition ${\mathcal{X}}$ of $S$, such that for every pair $X,X'\in {\mathcal{X}}$, the graphs ${\mathbf{G}}[X],{\mathbf{G}}[X']$ share at most one interface vertex and no edges. Each such graph ${\mathbf{G}}[X]$ is also $\alpha^*$-well-linked, has properties (P1) and (P2), and $\sum_{X\in {\mathcal{X}}}|\Gamma(X)|\leq O(|\Gamma(S)|)$. We then replace each sub-graph ${\mathbf{G}}[X]$ of ${\mathbf{G}}$ by a grid $Z_X$, whose interface is $\Gamma(X)$. After we do so for each $X\in {\mathcal{X}}$, we denote by ${\mathbf{G}}_{|S}$ the resulting contracted graph. Notice that we have replaced ${\mathbf{G}}[S]$ by a much smaller graph, whose size is bounded by $O(|\Gamma(S)|^2)$. Let ${\mathcal{Z}}$ denote the collection of sets $V(Z_X)$ of vertices, for $X\in {\mathcal{X}}$.
We then show that the cost of the optimal solution to problem $\pi({\mathbf{G}}_{|S},\emptyset,{\mathcal{Z}})$ is at most $\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot\log n)\optcro{G}$. Therefore, we can restrict our attention to canonical solutions only. We also show that it is enough to find a weak solution to problem $\pi({\mathbf{G}}_{|S},\emptyset,{\mathcal{Z}})$, in order to obtain a weak solution for the whole graph ${\mathbf{G}}$.
Unfortunately, we do not know how to find a nasty set $S$, such that the corresponding contracted graph ${\mathbf{G}}_{|S}$ contains no nasty sets. Instead, we do the following. Let $H={\mathbf{G}}_{|S}$ be the current graph, which is a result of the graph contraction step on some set $S$ of vertices, and let ${\mathcal{Z}}$ be the corresponding collection of sub-sets of vertices representing the grids. Suppose we can find a nasty canonical set $R$ in the graph $H$. We show that this allows us to find a new set $S'$ of vertices in ${\mathbf{G}}$, such that the contracted graph ${\mathbf{G}}_{|S'}$ contains fewer vertices than ${\mathbf{G}}_{|S}$.

Returning to our algorithm, let ${\mathbf{G}}_{|S}$ be the current contracted graph. We show that with high probability, the algorithm either returns a weak solution for ${\mathbf{G}}_{|S}$ of cost $O\left ((\optcro{G})^5\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n)\right )$, or it returns a nasty canonical subset $S'$ of ${\mathbf{G}}_{|S}$. In the former case, we can recover a good weak solution for the original graph ${\mathbf{G}}$. In the latter case, we find a subset $S''$ of vertices in the original graph ${\mathbf{G}}$, and perform another contraction step on ${\mathbf{G}}$, obtaining a new graph ${\mathbf{G}}_{|S''}$, whose size is strictly smaller than that of ${\mathbf{G}}_{|S}$. We then apply the algorithm to graph ${\mathbf{G}}_{|S''}$. Since the total number of graph contraction steps is bounded by $n$, after $n$ such iterations, we are guaranteed w.h.p. to obtain a weak feasible solution of cost $O\left ((\optcro{G})^5\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n)\right )$ to $\pi({\mathbf{G}},\emptyset)$, thus satisfying the requirements of Theorem~\ref{thm:main}.
We now turn to formal description of the algorithm. One of the main ingredients is the graph contraction step, summarized in the next section.

\section{Graph Contraction Step}\label{sec: graph contraction}
The input to the graph contraction step consists of the input graph ${\mathbf{G}}$, and a subset $S\subseteq V({\mathbf{G}})$ of vertices, for which properties (P1) and (P2) hold. It will be convenient to think of $S$ as a nasty set, but we do not require it.

Let ${\mathcal{C}}=\set{G_1,\ldots,G_q}$ be the set of all connected components of ${\mathbf{G}}[S]$. For each $1\leq i\leq q$, let $\Gamma_i=V(G_i)\cap \Gamma(S)=\Gamma(V(G_i))$ be the set of the interface vertices of $G_i$.
The goal of the graph contraction step is to find,  for each $1\leq i\leq q$,
a partition ${\mathcal{X}}_i$ of the set $V(G_i)$, that has the following properties. Let ${\mathcal{X}}=\bigcup_{i=1}^q{\mathcal{X}}_i$.

\begin{properties}{C}
\item Each set $X\in {\mathcal{X}}$ is $\alpha^*$-well-linked, and has properties (P1) and (P2).
Moreover, there is a planar drawing $\pi'(X)$ of ${\mathbf{G}}[X]$, and a simple closed curve $\gamma_X$, such that ${\mathbf{G}}[X]$ is embedded inside $\gamma_X$ in $\pi'(X)$, and the vertices of $\Gamma(X)$ lie on $\gamma_X$.\label{property: subsets-first}

\item For each $X\in{\mathcal{X}}$, either $|\Gamma(X)|=2$, or there is a partition $(C^*_X,R_1,\ldots,R_t)$ of $X$, such that ${\mathbf{G}}[C^*_X]$ is $2$-connected and $\Gamma(X)\subseteq C^*_X$. Moreover, for each $1\leq t'\leq t$, there is a vertex $u_{t'}\in C^*_X$, whose removal from ${\mathbf{G}}[X]$ separates the vertices of $R_{t'}$ from the remaining vertices of $X$.
\label{property: structure of X}

\item For each pair $X,X'\in {\mathcal{X}}$, the two sets of vertices are completely disjoint, except for possibly sharing one interface vertex, $v\in \Gamma(X)\cap \Gamma(X')$.
\label{property: disjointness}

\item For each $1\leq i\leq q$, if $\Gamma_i'=\bigcup_{X\in{\mathcal{X}}_i}\Gamma(X)$, then $|\Gamma_i'|\leq 9|\Gamma_i|$. \label{property: subsets - last}

\item For each $X\in {\mathcal{X}}$, $|X|\geq (\alpha^*|\Gamma(X)|)^2/64d_{\mbox{\textup{\footnotesize{max}}}}^2$.\label{property: size-last}
\end{properties}

 For each set $X\in {\mathcal{X}}$, we now define a new graph $Z'_X$, that will eventually replace the sub-graph ${\mathbf{G}}[X]$ in ${\mathbf{G}}$. Intuitively, we need $Z'_X$ to contain the vertices of $\Gamma(X)$ and to be $1$-well-linked w.r.t. these vertices. We also need it to have a unique planar embedding where the vertices of $\Gamma(X)$ lie on the boundary of the same face, and finally, we need the size of the graph $Z'_X$ to be relatively small, since this is a graph contraction step. The simplest graph satisfying these properties is a grid of size $|\Gamma(X)|\times |\Gamma(X)|$.

 Specifically, we first define a graph $Z_X$ as follows: if $|\Gamma_X|=1$, then $Z_X$ consists of a single vertex, and if $|\Gamma_X|=2$, then $Z_X$ consists of a single edge. Otherwise, $Z_X$ is a grid of size $|\Gamma(X)|\times |\Gamma(X)|$. In order to obtain the graph $Z'_X$, we add the set $\Gamma(X)$ of vertices to $Z_X$, and add a matching between the vertices of the first row of the grid and the vertices of $\Gamma(X)$. This is done so that the order of the vertices of $\Gamma(X)$ along the first row of the grid is the same as their order along the curve $\gamma_X$ in the drawing $\pi'(X)$. We refer to these new edges as the \emph{matching edges}. For the cases where $|\Gamma_X|=1$ and $|\Gamma_X|=2$, we obtain $Z'_X$ by adding the vertices of $\Gamma(X)$ to $Z_X$, and adding an arbitrary matching between $\Gamma_X$ and the vertices of $Z_X$. (See Figure~\ref{fig: grids}).

\begin{figure}[h]
\centering
\subfigure[General case]{
	\scalebox{0.4}{\includegraphics{grid-new-cut.pdf}}
	\label{fig: grid}
}
\hfill
\subfigure[$|\Gamma(X)|=1$]{
	\scalebox{0.3}{\includegraphics{grid-1-interface-cut.pdf}}
	\label{fig: grid 1 interface}
}
\hfill
\subfigure[$|\Gamma(X)|=2$]{
	\scalebox{0.3}{\includegraphics{grid-2-interface-cut.pdf}}
	\label{fig: grid 2 interface}
}

\caption{Graph $Z'_X$. The matching edges and the interface vertices are blue; the grid $Z_X$ is black.}\label{fig: grids}
\end{figure}

The contracted graph ${\mathbf{G}}_{|S}$ is obtained from ${\mathbf{G}}$, by replacing, for each $X\in{\mathcal{X}}$, the subgraph ${\mathbf{G}}[X]$ of ${\mathbf{G}}$, with the graph $Z'_X$. This is done as follows: first, delete all vertices and edges of ${\mathbf{G}}[X]$, except for the vertices of $\Gamma(X)$, from ${\mathbf{G}}$, and add the edges and the vertices of $Z'_X$ instead. Next, identify the copies of the interface vertices $\Gamma[X]$ in the two graphs. Let $H={\mathbf{G}}_{|S}$ denote the resulting contracted graph.
Notice that

\begin{equation}\label{eq: final size}
\sum_{i=1}^q\sum_{X\in {\mathcal{X}}_i}|V(Z'_X)|\leq \sum_{i=1}^q\sum_{X\in {\mathcal{X}}_i}2|\Gamma(X)|^2\leq \sum_{i=1}^q2|\Gamma_i'|^2d_{\mbox{\textup{\footnotesize{max}}}}^2\leq 162d_{\mbox{\textup{\footnotesize{max}}}}^2|\Gamma|^2
\end{equation}

(we have used the fact that a vertex may belong to the interface of at most $d_{\mbox{\textup{\footnotesize{max}}}}$ sets  $X\in {\mathcal{X}}_i$, and Property~(\ref{property: subsets - last})). Therefore, if the initial vertex set $S$ is nasty, then we have indeed reduced the graph size, as $|V(H)|<|V({\mathbf{G}})|$.

We now define a collection ${\mathcal{Z}}$ of subsets of vertices of $H$, as follows:
${\mathcal{Z}}=\set{V(Z_X)\mid X\in {\mathcal{X}}}$.
Notice that these sets are completely disjoint, as $Z_X$ does not contain the interface vertices $\Gamma(X)$.
Moreover, for each $Z\in {\mathcal{Z}}$, $H[Z]$ is a grid, $\Gamma_H(Z)$ consists of the vertices in the first row of the grid, and $\operatorname{out}_H(Z)$ consists of the set of the matching edges, each of which connects a vertex in the first row of the grid $Z$ to a distinct vertex in $T_H(Z)$.
Using Definitions~\ref{definiton: canonical subset} and \ref{definition: canonical drawing},
we can now define canonical subsets of vertices, canonical drawings and canonical solutions to the {\sf Minimum Planarization}\xspace problem on $H$, with respect to ${\mathcal{Z}}$.
Our main result for graph contraction is summarized in the next theorem, whose proof appears in Appendix.

\begin{theorem}\label{thm: graph contraction}
Let $S\subseteq V({\mathbf{G}})$ be any subset of vertices with properties (P1) and (P2), and let $\set{G_1,\ldots,G_q}$ be the set of all connected components of graph ${\mathbf{G}}[S]$. Then
for each $1\leq i\leq q$, we can efficiently find a partition ${\mathcal{X}}_i$ of  $V(G_i)$, such that the resulting partition ${\mathcal{X}}=\bigcup_{i=1}^q{\mathcal{X}}_i$ of $S$ has properties~(\ref{property: subsets-first})--(\ref{property: size-last}). Moreover, there is a canonical drawing of the resulting contracted graph $H={\mathbf{G}}_{|S}$ with $O(d_{\max}^9 \cdot \log^{10} n \cdot (\log\log n)^4 \cdot \optcro{{\mathbf{G}}})$ crossings.
\end{theorem}

The next claim shows, that in order to find a good solution to the {\sf Minimum Planarization}\xspace problem on ${\mathbf{G}}$, it is enough to solve it on ${\mathbf{G}}_{|S}$.

\begin{claim}\label{claim: enough to solve contracted graph}
Let $S$ be any subset of vertices of ${\mathbf{G}}$, ${\mathcal{X}}$ any partition of $S$ with properties~(\ref{property: subsets-first})--(\ref{property: size-last}), $H={\mathbf{G}}_{|S}$ the corresponding contracted graph and ${\mathcal{Z}}$ the collection of grids $Z_X$ for $X\in {\mathcal{X}}$. Then given any canonical solution $E^*$ to the {\sf Minimum Planarization}\xspace problem on $H$, we can efficiently find a solution  of cost $O(d_{\mbox{\textup{\footnotesize{max}}}})|E^*|$
to {\sf Minimum Planarization}\xspace on ${\mathbf{G}}$.\end{claim}

\begin{proof}
Partition set $E^*$ of edges into two subsets: $E^*_1$ contains all edges that belong to sub-graphs $Z'_X$ for $X\in {\mathcal{X}}$, and $E^*_2$ contains all remaining edges. Notice that since $E^*$ is a canonical solution, each edge $e\in E^*_1$ must be a matching edge for some graph $Z'_X$. Also from the construction of the contracted graph $H$, all edges in $E^*_2$ belong to $E({\mathbf{G}})$.

Consider some set $X\in {\mathcal{X}}$, and let $\Gamma'(X)\subseteq \Gamma(X)$ denote the subset of the interface vertices of $Z'_X$, whose matching edges belong to $E^*_1$. Let $\Gamma'=\bigcup_{X\in {\mathcal{X}}}\Gamma'(X)$. We now define a subset $E^{**}_1$ of edges of ${\mathbf{G}}$ as follows: for each vertex $v\in \Gamma'$, add all edges incident to $v$ in ${\mathbf{G}}$ to $E^{**}_1$. Finally, we set $E^{**}=E^{**}_1\cup E^*_2$. Notice that $E^{**}$ is a subset of edges of ${\mathbf{G}}$, and $|E^{**}|=|E_1^{**}|+|E_2^*|\leq d_{\mbox{\textup{\footnotesize{max}}}}|E_1^*|+|E_2^*|\leq d_{\mbox{\textup{\footnotesize{max}}}} |E^*|$. In order to complete the proof of the claim, it is enough to show that $E^{**}$ is a feasible solution to the {\sf Minimum Planarization}\xspace problem on ${\mathbf{G}}$.

Let ${\mathbf{G}}'={\mathbf{G}}\setminus E^{**}$, let $H'=H\setminus E^*$, and let $\psi$ be a planar drawing of $H'$. It is now enough to construct a planar drawing $\psi'$ of ${\mathbf{G}}'$. In order to do so, we start from the planar drawing $\psi$ of $H'$. We then consider the sets $X\in {\mathcal{X}}$ one-by-one. For each such set, we replace the drawing of $Z'_X\setminus \Gamma'(X)$ with a drawing of ${\mathbf{G}}[X]\setminus \Gamma'(X)$. The drawings of the vertices in $\Gamma(X)$ are not changed by this procedure. After all sets $X\in {\mathcal{X}}$ are processed, we will obtain a planar drawing of graph ${\mathbf{G}}'$ (that may also contain drawings of some edges in $E^{**}$, that we can simply erase).

Consider some such set $X\in {\mathcal{X}}$. Let $G$ be the current graph (obtained from $H'$ after a number of such replacement steps), and let $\psi$ be the current planar drawing of $G$. Observe that the grid $Z_X$ has a unique planar drawing. We say that a planar drawing of graph $Z'_X\setminus \Gamma'(X)$ is \emph{standard} in $\psi$, iff we can draw a simple closed curve $\gamma'_X$, such that $Z_X$ is embedded completely inside $\gamma'_X$; no other vertices or edges of $G$ are embedded inside $\gamma'_X$; the only edges that $\gamma'_X$ intersects are the matching edges of $Z'_X\setminus \Gamma'(X)$, and each such matching edge is intersected  exactly once by $\gamma'_X$ (see Figure~\ref{fig: standard drawing}).

\begin{figure}[h]
\scalebox{0.4}{\rotatebox{0}{\includegraphics{standard-drawing-cut.pdf}}}\caption{A standard drawing of $Z'_X\setminus \Gamma'(X)$ \label{fig: standard drawing}}
\end{figure}

It is possible that the drawing of $Z'_X\setminus \Gamma'(X)$ in $\psi$ is not standard.
However, since $\psi$ is planar, this can only happen for the following three reasons: (1) some connected component $C$ of the current graph $G$ is embedded inside some face of the grid $Z_X$: in this case we can simply move the drawing of $C$ elsewhere; (2) there is some subset $C$ of $V(G)$, and a vertex $v\in \Gamma(X)\setminus \Gamma'(X)$, such that $\Gamma_G(C)=v$, and $G[C]$ is embedded inside one of the faces of the grid $Z_X$ incident to the other endpoint of the matching edge of $v$; and (3) there is some subset $C$ of $V(G)$, and two consecutive vertices $u,v\in \Gamma(X)\setminus \Gamma'(X)$, such that $\Gamma_G(C)=\set{u,v}$, and $G[C]$ is embedded inside the unique face of the grid $Z_X$ incident to the other endpoints of the matching edges of $u$ and $v$  (See Figure \ref{fig: any to standard drawing}).  In the latter two cases, we simply move the drawing of $C$ right outside the grid, so that the corresponding matching edges now cross the curve $\gamma'(X)$.

\begin{figure}[h]
\centering
\subfigure{
	\scalebox{0.4}{\includegraphics{any-to-standard-drawing1-cut.pdf}}
	\label{fig: any to standard before}
}
\hfill
\subfigure{
	\scalebox{0.4}{\includegraphics{any-to-standard-drawing2-cut.pdf}}
	\label{fig: any to standard after}
}
\caption{Transforming drawing $\psi$ to obtain a standard drawing of $Z'_X\setminus \Gamma'(X)$. Cases 1, 2 and 3 are illustrated by clusters $C_1$, $C_2$ and $C_3$, respectively. \label{fig: any to standard drawing}}
\end{figure}

To conclude, we can transform the current planar drawing $\psi$ of the graph $G$ into another planar drawing $\tilde{\psi}$, such that the induced drawing of $Z'_X\setminus \Gamma'(X)$ is standard. We can now draw a simple closed curve $\gamma''(X)$, such that $Z'_X\setminus \Gamma'(X)$ is embedded inside $\gamma''(X)$, no other vertices or edges are embedded inside $\gamma''(X)$, and the set of vertices whose drawings lie on $\gamma''(X)$ is precisely $\Gamma(X)\setminus \Gamma'(X)$. Notice that the ordering of the vertices of $\Gamma(X)\setminus \Gamma'(X)$ along this curve is exactly the same as their ordering along the curve $\gamma(X)$ in the planar embedding $\pi'(X)$ of ${\mathbf{G}}[X]$, guaranteed by Property (\ref{property: subsets-first}). Let $\pi''(X)$ be the drawing of ${\mathbf{G}}[X]\setminus \Gamma'(X)$ induced by $\pi'(X)$. We can now simply replace the drawing of $Z'_X\setminus \Gamma'(X)$ with the drawing $\pi''(X)$ of ${\mathbf{G}}[X]\setminus \Gamma'(X)$, identifying the curves $\gamma_X$ and $\gamma''_X$, and the drawings of the vertices in $\Gamma(X)\setminus \Gamma'(X)$ on them. The resulting drawing remains planar, and the drawings of the vertices in $\Gamma(X)$ do not change.
\end{proof}

Finally, we show that if we find a nasty canonical set in ${\mathbf{G}}_{|S}$, then we can contract ${\mathbf{G}}$ even further. The proof of the following theorem appears in Appendix.

\begin{theorem}\label{thm: nasty canonical set to contraction} Let $S$ be any subset of vertices of ${\mathbf{G}}$, ${\mathcal{X}}$ any partition of $S$ with properties~(\ref{property: subsets-first})--(\ref{property: size-last}), $H={\mathbf{G}}_{|S}$ the corresponding contracted graph, and ${\mathcal{Z}}$ the corresponding collection of grids $Z_X$ for $X\in {\mathcal{X}}$. Then given any  nasty canonical vertex set $R\subseteq V(H)$, we can efficiently find a subset $S'\subseteq V({\mathbf{G}})$ of vertices, and a partition ${\mathcal{X}}'$ of $S'$, such that properties~(\ref{property: subsets-first})--(\ref{property: size-last}) hold for ${\mathcal{X}}'$, and if $H'={\mathbf{G}}_{|S'}$ is the corresponding contracted graph, then $|V(H')|<|V(H)|$.
Moreover,  there is a canonical drawing $\phi'$ of $H'$ with $\operatorname{cr}_{\phi'}(H') = O(d_{\max}^9 \cdot \log^{10} n \cdot (\log\log n)^4 \cdot \optcro{{\mathbf{G}}})$.
\end{theorem}

Notice that Claim~\ref{claim: enough to solve contracted graph} applies to the new contracted graph as well.

\label{---------------------------------------------------------sec algorithm---------------------------------------------------}
\section{The Algorithm}\label{sec: alg}

The algorithm consists of a number of stages. In each stage $j$, we are given as input a subset $S$ of vertices of ${\mathbf{G}}$, the contracted graph $\H={\mathbf{G}}_{|S}$, and the collection ${\mathcal{Z}}$ of disjoint sub-sets of vertices of $\H$, corresponding to the grids $Z_X$ obtained during the contraction step. The goal of stage $j$ is to either produce a nasty canonical set $R$ in $\H$, or to find a weak feasible solution to problem $\pi(\H,\emptyset,{\mathcal{Z}})$. We prove the following theorem.

\begin{theorem}\label{thm: alg summary}
There is an efficient randomized algorithm, that, given a contracted graph $\H$, a corresponding collection ${\mathcal{Z}}$ of disjoint subsets of vertices of $\H$, and a bound $\mathsf{OPT}'$ on the cost of the strong optimal solution to problem $\pi(\H,\emptyset,{\mathcal{Z}})$, with probability at least $1/\operatorname{poly}(n)$, produces either a nasty canonical subset $R$ of vertices of $\H$, or a weak feasible solution $E^*$, $|E^*|\leq O((\mathsf{OPT}')^{5}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot\log n))$ for problem $\pi(\H,\emptyset,{\mathcal{Z}})$. (Here, $n=|V({\mathbf{G}})|$).
\end{theorem}

We prove this theorem in the rest of this section, but we first show how Theorems~\ref{thm:main}, \ref{theorem: main-crossing-number} and Corollary~\ref{corollary: main-approx-crossing-number} follow from it.
We start with proving Theorem~\ref{thm:main}, by showing an efficient randomized algorithm to find a subset $E^*\subseteq E({\mathbf{G}})$ of edges, such that ${\mathbf{G}}\setminus E^*$ is planar, and $|E^*|\leq O((\optcro{G})^5\cdot\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n))$.
We assume that we know the value $\optcro{{\mathbf{G}}}$, by using the standard practice of guessing this value, running the algorithm, and then adjusting the guessed value accordingly. It is enough to ensure that whenever the guessed value $\mathsf{OPT}\geq \optcro{{\mathbf{G}}}$, the algorithm indeed returns a subset $E^*$ of edges, $|E^*|\leq O(\mathsf{OPT}^{5}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n))$, such that ${\mathbf{G}}\setminus E^*$ is a planar graph w.h.p. Therefore, from now on we assume that we are given a value $\mathsf{OPT}\geq \optcro{{\mathbf{G}}}$. The algorithm consists of a number of stages. The input to stage $j$ is a contracted graph $\H$, with the corresponding family ${\mathcal{Z}}$ of vertex sets. In the input to the first stage, $\H={\mathbf{G}}$, and ${\mathcal{Z}}=\emptyset$. In each stage $j$, we run the algorithm from Theorem~\ref{thm: alg summary} on the current contracted graph $\H$, and the family ${\mathcal{Z}}$ of vertex subsets.
From Theorem~\ref{thm: graph contraction}, there is a strong feasible solution to problem $\pi(\H,\emptyset,{\mathcal{Z}})$ of cost $O(\mathsf{OPT} \cdot\operatorname{poly}(\log n\cdot d_{\mbox{\textup{\footnotesize{max}}}}))$, and so we can set the parameter $\mathsf{OPT}'$ to this value.
 Whenever the algorithm returns a nasty canonical set $R$ in graph $\H$, we terminate the current stage, and compute a new contracted graph $\H'$, guaranteed by Theorem~\ref{thm: nasty canonical set to contraction}. Graph $\H'$, together with the corresponding family ${\mathcal{Z}}'$ of vertex subsets, becomes the input to the next stage. Alternatively, if, after $\operatorname{poly}(n)$ executions of the algorithm from Theorem~\ref{thm: alg summary}, no nasty canonical set is returned, then with high probability, one of the algorithm executions has returned a weak feasible solution $E^*$, $|E^*|\leq O(\mathsf{OPT}^{5}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot\log n))$ for problem $\pi(\H,\emptyset,{\mathcal{Z}})$. From Claim~\ref{claim: enough to solve contracted graph}, we can recover from this solution a planarizing set $E^{**}$ of edges for graph ${\mathbf{G}}$, with $|E^{**}|=O(\mathsf{OPT}^{5}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot\log n))$. Since the size of the contracted graph $\H$ goes down after each contraction step, the number of stages is bounded by $n$, thus implying Theorem~\ref{thm:main}. Combining Theorem~\ref{thm:main} with Theorem~\ref{thm:CMS10} immediately gives Theorem~\ref{theorem: main-crossing-number}. Finally, we obtain Corollary~\ref{corollary: main-approx-crossing-number} as follows. Recall that the algorithm of Even et al.~ \cite{EvenGS02} computes a drawing of any $n$-vertex bounded degree graph ${\mathbf{G}}$ with $O(\log^2 n) \cdot (n+\optcro{G})$ crossings. It was shown in~\cite{CMS10}, that this algorithm can be extended to arbitrary graphs, where the number of crossings becomes $O(\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}})\cdot \log^2 n) \cdot (n+\optcro{G})$. We run their algorithm, and the algorithm presented in this section, on graph ${\mathbf{G}}$, and output the better of the two solutions. If $\optcro{{\mathbf{G}}}<n^{1/10}$, then our algorithm is an $O(n^{9/10}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n))$-approximation; otherwise, the algorithm of~\cite{EvenGS02} gives an  $O(n^{9/10}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n))$-approximation.

 The remainder of this section is devoted to proving Theorem~\ref{thm: alg summary}.
Recall that we are given the contracted graph $\H$, and a collection ${\mathcal{Z}}$ of vertex-disjoint subsets of $V(\H)$. For each $Z\in {\mathcal{Z}}$, $\H[Z]$ is a grid, and $E(Z,V(\H)\setminus Z)$ consists of a set $M_Z$ of matching edges. Each such edge connects a vertex in the first row of $Z$ to a distinct vertex in $T_{\H}(Z)$, and these edges form a matching between the first row of $Z$ and $T_{\H}(Z)$. Abusing the notation, we denote the bound on the cost of the strong optimal solution to $\pi(\H,\emptyset,{\mathcal{Z}})$ by $\mathsf{OPT}$ from now on, and the number of vertices in $\H$ by $n$.
For each $Z\in {\mathcal{Z}}$, we use $Z$ to denote both the set of vertices itself, and the grid $\H[Z]$.
We assume throughout the rest of the section that $\mathsf{OPT}\cdot d_{\mbox{\textup{\footnotesize{max}}}}^6< \sqrt n$: otherwise, if
$\mathsf{OPT}\cdot d_{\mbox{\textup{\footnotesize{max}}}}^6\geq \sqrt n$, then the set $E'$ of all edges of $\H$ that do not participate in grids $Z\in {\mathcal{Z}}$, is a feasible weak canonical solution for problem $\pi(\H,\emptyset,{\mathcal{Z}})$. It is easy to see that $|E'|\leq O(\mathsf{OPT}^2\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}))$: this is clearly the case if $|E'|\leq 4n$; otherwise, if $|E'|>4n$, then by Theorem~\ref{thm: large average degree large crossing number}, $\mathsf{OPT}=\Omega(n)$, and so $|E'|=O(n^2)=O(\mathsf{OPT}^2)$.

We use two parameters: $\rho=O(\mathsf{OPT}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n))$ and $m^*=O(\mathsf{OPT}^3\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n))$, whose exact values we set later.
The algorithm consists of $2\rho\log n$ iterations. The input to iteration $h$ is a collection $G_1,\ldots,G_{k_h}$ of $k_h\leq \mathsf{OPT}$ sub-graphs of $\H$, together with bounding boxes $X_i\subseteq G_i$ for all $1\leq i\leq k_h$. We denote $H_i=G_i\setminus V(X_i)$ and $n(H_i)=|V(H_i)|$. Additionally, we have collections $\edges1,\ldots,\edges{h-1}$ of edges of $\H$, where for each $1\leq h'\leq h-1$, set $\edges{h'}$ has been computed in iteration $h'$.
We say that $(G_1,X_1),\ldots,(G_{k_h},X_{k_h})$, and $\edges1,\ldots,\edges{h-1}$  is a \emph{valid} input to iteration $h$, iff the following invariants hold:

\label{start invariants for the whole algorithm-------------------------------------------------------------}

\begin{properties}{V}
\item For all $1\leq i,j\leq k_h$, graphs $H_i$ and $H_j$ are completely disjoint. \label{invariant 1: disjointness}

\item For all $1\leq i\leq k_h$, $G_i\subseteq \H\setminus (\edges 1,\ldots,\edges{h-1})$, and $H_i$ is the sub-graph of $\H$ induced by $V(H_i)$. In particular, no edges $e\subseteq V(H_i)$ belong to $\edges 1,\ldots,\edges{h-1}$. Moreover, every edge $e\in E(\H)$ belongs to either $\bigcup_{h'=1}^h\edges{h'}$ or to $\bigcup_{i=1}^{k_h}G_i$.
\label{invariant 2: proper subgraph}

\item For all $Z\in {\mathcal{Z}}$, for all $1\leq i\leq k_h$, either $Z\cap V(H_i)=\emptyset$, or $Z\subseteq V(H_i)$. Let ${\mathcal{Z}}_i=\set{Z\in {\mathcal{Z}}\mid Z\subseteq V(H_i)}$.\label{invariant 2: canonical}

\item For all $1\leq i\leq k_h$, there is a strong solution $\phi_i$ to $\pi(G_i,X_i,{\mathcal{Z}}_i)$, with $\sum_{i=1}^{k_h}\operatorname{cr}_{\phi_i}(G_i)\leq \mathsf{OPT}$. \label{invariant 3: there is a cheap solution}

\item If we are given {\bf any} weak solution  $E_i'$ to problem $\pi(G_i,X_i,{\mathcal{Z}}_i)$, for all $1\leq i\leq k_h$, and denote $\tilde{E}^{(h)}=\bigcup_{i=1}^{k_h}E_i$, then $\edges1\cup\cdots\edges {h-1}\cup \tilde{E}^{(h)}$ is a feasible weak solution to problem $\pi(\H,\emptyset,{\mathcal{Z}})$.\label{invariant 4: any weak solution is enough}

\item For each $1\leq h'<h$, and $1\leq i\leq k_h$, the number of edges in $\edges{h'}$ incident on vertices of $H_i$ is at most $m^*$, and $|\edges{h'}|\leq \mathsf{OPT} \cdot m^*$. Moreover, no edges in grids $Z\in {\mathcal{Z}}$ belong to $\bigcup_{h'=1}^{h-1}\edges {h'}$.\label{invariant 4.5: number of edges removed so far}

\item Let $n_h=(1-1/\rho)^{(h-1)/2}\cdot n$. For each $1\leq i\leq k_h$, either  $n(H_i)\leq n_h$, or $X_i=\emptyset$ and $n(H_i)\leq n_{h-1}$. \label{invariant 5: bound on size}
\end{properties}
\label{end invariants for the whole algorithm-------------------------------------------------------------}

The input to the first iteration consists of a single graph, $G_1=\H$, with the bounding box $X_1=\emptyset$. It is easy to see that all invariants hold for this input. We end the algorithm at iteration $h^*$, where $n_{h^*}\leq (m^*\cdot \rho\cdot \log n)^2$. Clearly, $h^*\leq 2\rho\log n$, from Invariant~(\ref{invariant 5: bound on size}). Let ${\mathcal{G}}$ be the set of all instances that serve as input to iteration $h^*$. We need the following theorem, whose proof appears in Appendix.

\begin{theorem}\label{thm: stopping condition}
There is an efficient algorithm, that, given any problem $\pi(G,X,{\mathcal{Z}}')$, where $V(G\setminus X)$ is canonical for ${\mathcal{Z}}'$, and $\pi(G,X,{\mathcal{Z}}')$ has a strong solution of cost $\overline{\mathsf{OPT}}$, finds a weak feasible solution to $\pi(G,X,{\mathcal{Z}}')$ of cost $O(\overline{\mathsf{OPT}}\cdot \sqrt{n'}\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n')+\overline{\mathsf{OPT}}^3)$, where $n'=|V(G\setminus X)|$, and $d_{\mbox{\textup{\footnotesize{max}}}}$ is the maximum degree in $G$.
\end{theorem}

For each $1\leq i\leq k_{h^*}$, let $\edges{h^*}_i$ be the weak solution from Theorem~\ref{thm: stopping condition}, and let $\edges{h^*}=\bigcup_{i=1}^{k_{h^*}}\edges{h^*}_i$. Let $\mathsf{OPT}_i$ denote the cost of the strong optimal solution to $\pi(G_i,X_i,{\mathcal{Z}}_i)$. Then $|\edges{h^*}|=\sum_{i=1}^{k_{h^*}}O(\mathsf{OPT}_i\cdot \sqrt{n(H_i)}\cdot\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)+\mathsf{OPT}_i^3)$. Since $n(H_i)\leq n_{h^*-1}\leq 2n_{h^*}$ for all $i$, this is bounded by $\sum_{i=1}^{k_{h^*}}O(\mathsf{OPT}_i\cdot m^*\cdot \rho\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\log n)+\mathsf{OPT}_i^3)\leq O(\mathsf{OPT}\cdot m^*\cdot \rho\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \log n)+\mathsf{OPT}^3)$, as $\sum_{i=1}^{k_{h^*}}\mathsf{OPT}_i\leq \mathsf{OPT}$ from Invariant~(\ref{invariant 3: there is a cheap solution}). The final solution is $E^*=\bigcup_{h=1}^{h^*}\edges{h}$, and

\[\begin{split}
|E^*|&\leq \sum_{h=1}^{h^*-1}|\edges{h}|+|\edges{h^*}|\\
&\leq (2\rho\log n)(\mathsf{OPT}\cdot m^*)+O(\mathsf{OPT}\cdot m^*\cdot \rho\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}} \cdot \log n)+\mathsf{OPT}^3)\\
&=O(\mathsf{OPT}^5\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)).
\end{split}\]

We say that the execution of iteration $h$ is \emph{successful}, iff it either produces a valid input to the next iteration, together with the set $\edges{h}$ of edges, or finds a nasty canonical set in $\H$. We show how to execute each iteration, so that it is successful with probability at least $(1-1/\rho)$, if all previous iterations were successful. If any iteration returns a nasty canonical set, then we stop the algorithm and return this vertex set as an output. Since there are at most $2\rho\log n$ iterations, the probability that all iterations are successful is at least $(1-1/\rho)^{2\rho\log n}\geq 1/\operatorname{poly}(n)$.
In order to complete the proof of Theorem~\ref{thm: alg summary}, it is now enough to show an algorithm for executing each iteration, such that, given a valid input to the current iteration, the algorithm either finds a nasty canonical set in $\H$, or returns a valid input to the next iteration, with probability at least $\frac 1 \rho$.  We do so in the next section.

\section{Iteration Execution}\label{sec: iteration}
\label{------------------------------------------------iteration execution-----------------------------------------------------------------------}

Throughout this section, we denote $n=|V(\H)|$, $\phi$ is the optimal canonical solution for the {\sf Minimum Crossing Number}\xspace problem on $\H$, and $\mathsf{OPT}$ is its cost.
We start by setting the values of the parameters $\rho$ and $m^*$. The value of the parameter $\rho$ depends on two other parameters, that we define later. Specifically, we will define two functions $\lambda: \mathbb{N}\rightarrow {\mathbb R}$, $N:\mathbb{N}\rightarrow {\mathbb R}$:

\[\lambda(n')=\Omega\left(\frac 1{\log n'\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2}\right )\]

and

\[N(n')=O(d_{\mbox{\textup{\footnotesize{max}}}}\sqrt{n'\log n'})\]

for all $n'>0$. Also, recall that $\alpha^*=\Omega\left(\frac 1 {\log^{3/2}n\cdot \log\log n}\right )$ is the well-linkedness parameter from Theorem~\ref{thm: well-linked-general}. We need the value of $\rho$ to satisfy the following two inequalities:

\begin{equation}\label{eq: value of rho 1}
\forall 0<n'\leq n\quad \quad \rho>\frac{25\cdot 2^{24}d_{\mbox{\textup{\footnotesize{max}}}}^6\cdot N^2(n')}{n'\cdot \lambda^2(n')\cdot (\alpha^*)^2}
\end{equation}

\begin{equation}\label{eq: value of rho 2}
\forall 0<n'\leq n\quad \quad  \rho >\frac{9\mathsf{OPT}}{\lambda(n')}
\end{equation}

Substituting the values of $N(n'),\lambda(n')$ and $\alpha^*$ in the above inequalities, we get that it is sufficient to set:

\[\rho=\Theta(\log n\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2)\max\set{d_{\mbox{\textup{\footnotesize{max}}}}^{10}\log^5 n(\log\log n)^2,\mathsf{OPT}}=O\left (\mathsf{OPT}\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\log n)\right ).\]

The value of parameter $m^*$ is:

\[m^*=O\left (\frac{\mathsf{OPT}^2\cdot\rho\cdot\log^2n\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2\cdot \ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }{\alpha^*}\right )=O\left (\mathsf{OPT}^3\cdot \operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n\right ))\]

We now turn to describe each iteration $h$. Our goal is to either find a nasty canonical subset of vertices in $\H$, or produce a feasible input to the next iteration, $h+1$.
 Throughout the execution of iteration $h$, we construct a set ${\mathcal{G}}_{h+1}$ of new problem instances, for which Invariants~(\ref{invariant 1: disjointness})--(\ref{invariant 5: bound on size}) hold. We do not need to worry about the number of the instances in ${\mathcal{G}}_{h+1}$ being bounded by $\mathsf{OPT}$, since, from Invariant~(\ref{invariant 3: there is a cheap solution}), the number of instances in ${\mathcal{G}}_{h+1}$, which do not have a solution of cost $0$, is bounded by $\mathsf{OPT}$. Since we can efficiently identify such instances, they will then become the input to the next iteration.
We will also gradually construct the set $\edges h$ of edges, that we remove from the problem instance in this iteration. The iteration is executed on each one of the graphs $G_i$ separately. We fix one such graph $G_i$, for $1\leq i\leq k_h$, and focus on executing iteration $h$ on $G_i$.
We need a few definitions.

\begin{definition}
Given any graph $H$, we say that a simple path $P\subseteq H$ is a $2$-path, iff the degrees of all inner vertices of $P$ are $2$. We say that it is a maximal $2$-path iff it is not contained in any other $2$-path.
\end{definition}

\begin{definition} We say that a connected graph $H$ is \emph{rigid} iff either $H$ is a simple cycle, or, after we replace every maximal $2$-path in $H$ with an edge, we obtain a $3$-vertex connected graph, with no self-loops or parallel edges.
\end{definition}

Observe that if $H$ is rigid, then it has a unique planar drawing. We now define the notion of a valid skeleton.

\begin{definition}
Assume that we are given an instance $\pi=\pi(G,X,{\mathcal{Z}}')$ of the problem, and let $\phi'$ be the optimal strong solution for this instance. Given a subset $\tilde{E}$ of edges of $G$, and a sub-graph $K\subseteq G$, we say that $K$ is a \emph{valid skeleton} for $\pi,\tilde{E},\phi'$, iff the following conditions hold:

\begin{itemize}
\item Graph $K$ is rigid, and the edges of $K$ do not participate in crossings in $\phi'$. Moreover, the set $V(K)$ of vertices is canonical for ${\mathcal{Z}}'$.

\item $X\subseteq K$, and no edges of $\tilde{E}$ belong to $K$.

\item Every connected component of $G\setminus (K\cup \tilde E)$ contains at most $n_{h+1}$ vertices.
\end{itemize}
\end{definition}

Notice that if $K$ is a valid skeleton, then we can efficiently find the drawing $\phi_K'$ induced by $\phi'$ -- this is the unique planar drawing of $K$. Each connected component $C$ of $G\setminus (K\cup \tilde E)$ must then be embedded entirely inside some face $F_C$ of $\phi'$. Once we determine the face $F_C$ for each such component $C$, we can solve the problem recursively on these components, where for each component $C$, the bounding box becomes the boundary of $F_C$. This is the main idea of our algorithm. In fact, we will be able to find a valid skeleton $K_i$ for each instance $\pi(G_i,X_i,{\mathcal{Z}}_i)$ and drawing $\phi_i$, for $1\leq i\leq k_h$, w.h.p., but we cannot ensure that this skeleton will contain the bounding box $X_i$. If there is a large collection of edge-disjoint paths, connecting $K_i$ to $X_i$ in $G_i$, we can still connect $X_i$ to $K_i$, by choosing a small subset of these paths at random. This will give the desired final valid skeleton that contains $X_i$. However, if there is only a small number of such paths, then we cannot find a single valid skeleton that contains $X_i$ (in particular, it is possible that all edges incident on $X_i$ participate in crossings in $\phi_i$, so such a skeleton does not exist). However, in the second case, we can find a small subset $E'_i$ of edges, whose removal disconnects $X_i$ from many vertices of $G_i$. In particular, after we remove $E'_i$ from $G_i$, graph $G_i$ will decompose into two connected components: one containing $X_i$, and at most $n_{h+1}$ other vertices, and another that does not contain $X_i$. The first component is denoted by $G_i^X$, and the second by $G_i'$. The sub-instance defined by $G_i'$ is now completely disconnected from the rest of the graph, and it has no bounding box, so we can add it directly to ${\mathcal{G}}_{h+1}$. For the sub-instance $G_i^X$, we show that $X_i$ is a valid skeleton. The edges in $E_i'$ are then added to $\edges h$. We now define these notions more formally.

Recall that for each $i: 1\leq i\leq k_h$, problem $\pi(G_i,X_i,{\mathcal{Z}}_i)$ is guaranteed to have a strong feasible solution $\phi_i$ of cost at most $\mathsf{OPT}_i$. For each such instance, we will find two subsets of edges $E'_i$, and $E''_i$, where $|E'_i|=O(\mathsf{OPT}^2\cdot \rho\cdot d_{\mbox{\textup{\footnotesize{max}}}})$, and $|E''_i|=O\left (\frac{\mathsf{OPT}^2\cdot\rho\cdot \log^2n\cdotd_{\mbox{\textup{\footnotesize{max}}}}^2\cdot \ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}}}{\alpha^*}\right)$, that will be added to $\edges h$.

Assume first that $X_i\neq \emptyset$. So by Invariant~(\ref{invariant 5: bound on size}), $|V(G_i\setminus X_i)|\leq n_h$.
The graph $G_i\setminus E'_i$ consists of two connected sub-graphs: $G_i^X$, that contains the bounding box $X_i$, and the remaining graph $G'_i$. We will find a subset $E''_i$ of edges and a skeleton $K_i$ for graph $G_i^X$, such that w.h.p.,  $K_i$ is a valid skeleton for the instance $\pi(G_i^X,X_i,{\mathcal{Z}}_i)$, the set $E''_i$ of edges, and the solution $\phi_i$. Therefore, each one of the connected components of $G_i^X\setminus (K_i\cup E''_i)$ contains at most $n_{h+1}$ vertices. We will process these components, to ensure that we can solve them independently, and then add them to set ${\mathcal{G}}_{h+1}$, where they will serve as input to the next iteration. The remaining graph, $G'_i$, contains at most $n_h$ vertices from Invariant~(\ref{invariant 5: bound on size}), and has no bounding box. So we can add $\pi(G_i,\emptyset,{\mathcal{Z}}_i)$ to ${\mathcal{G}}_{h+1}$ directly.

If $X_i=\emptyset$, then we will ensure that $E'_i=\emptyset$, $G'_i=\emptyset$ and $G_i^X=G_i$. Recall that in this case, from Invariant~(\ref{invariant 5: bound on size}), $|V(G_i)|\leq n_{h-1}$. We will find a valid skeleton $K_i$ for $\pi(G_i,X_i,{\mathcal{Z}}_i),E''_i,\phi_i$, and then process the connected components of $G_i\setminus (K_i\cup E''_i)$ as in the previous case, before adding them to set ${\mathcal{G}}_{h+1}$.

The algorithm consists of three steps. Given a graph $G_i\in \set{G_1,\ldots,G_{k_h}}$ with the bounding box $X_i$, the goal of the first step is to either produce a nasty canonical vertex set in the whole contracted graph $\H$, or to find a $\rho$-balanced $\alpha^*$-well-linked partition $(A,B)$ of $V(G_i)$, where $A$ and $B$ are canonical, and $|E(A,B)|$ is small. The goal of the second step is to find the sets $E'_i,E''_i$ of edges and a valid skeleton $K_i$ for instance $\pi(G^X_i,X_i,{\mathcal{Z}}_i)$. In the third step, we produce a new collection of instances, from the connected components of graphs $G_i\setminus (E''_i\cup K_i)$, which, together with the graphs $G_i'$, for $1\leq i\leq k_h$, are then added to ${\mathcal{G}}_{h+1}$, to become the input to the next iteration.

\subsection{Step 1: Partition}\label{sec: step 1}

Throughout this step, we fix some graph $G\in \set{G_1,\ldots,G_{k_h}}$. We denote by $X$ its bounding box, and let $H^0=G\setminus V(X)$. Notice that graph $H^0$ is not necessarily connected. We denote by $H$ the largest connected component of $H^0$, and by ${\mathcal{H}}$ the set of the remaining connected components. We focus on $H$ only in the current step. Let $n'=|V(H)|$. If $n'\leq (m^*\cdot \rho\cdot \log n)^2$, then we can simply proceed to the third step, as the size of every connected component of $H^0$ is bounded by $n'\leq n_{h^*}\leq n_{h+1}$. We then define $E'=E''=\emptyset$, $G^X=G$, $G'=\emptyset$, and we use $X$ as the skeleton $K$ for $G$. It is easy to see that it is a valid skeleton.  Therefore, we assume from now on that:

\begin{equation}\label{eq: upper bound on rho in terms of n'}
n'\geq (m^*\cdot \rho\cdot \log n)^2
\end{equation}

 Recall that from Invariant~(\ref{invariant 2: canonical}), $H$ is canonical w.r.t. ${\mathcal{Z}}$, so we define ${\mathcal{Z}}'=\set{Z\in {\mathcal{Z}}: Z\subseteq H}$.  Throughout this step, whenever we say that a set is canonical, we mean that it is canonical w.r.t. ${\mathcal{Z}}'$.

Recall that the goal of the current step is to produce a partition $(A,B)$ of the vertices of $H$, such that $A$ and $B$ are both canonical, the partition is $\rho$-balanced and $\alpha^*$-well-linked, and $|E(A,B)|$ is small, or to find a nasty canonical vertex set in $\H$. In fact we will define 4 different cases. The first two cases are the easy cases, for which it is easy to find a suitable skeleton, even though we do not obtain a $\rho$-balanced $\alpha^*$-well-linked bi-partition. The third case will give the desired bi-partition $(A,B)$, and the fourth case will produce a partition with slightly different, but still sufficient properties. We then show that if none of these four cases happen, then we can find a nasty canonical set in $\H$.

The first case is when there is some grid $Z\in {\mathcal{Z}}'$ with $|Z|\geq  n'/2$. If this case happens, we continue directly to the second step (this is the simple case where eventually the skeleton will be simply $Z$ itself, after we connect it to the bounding box).
In the rest of this step we assume that for each $Z\in {\mathcal{Z}}'$, $|Z|< n'/2$.
The initial partition is summarized in the next theorem, whose proof appears in Appendix.

\begin{theorem}\label{thm: initial partition}
Assume that for each $Z\in {\mathcal{Z}}'$, $|Z|< n'/2$. Then we can efficiently find a partition $(A,B)$ of $V(H)$, such that:
\begin{itemize}
\item Both $A$ and $B$ are canonical.

\item $|A|, |B|\geq \lambda n'$, for $\lambda=\Omega\left(\frac{1}{\log n'\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2}\right )$ and
 $|E(A,B)|\leq O(d_{\mbox{\textup{\footnotesize{max}}}}\sqrt {n'\log n'})$.

\item Set $A$ is $\alpha^*$-well-linked
\end{itemize}
\end{theorem}

We say that Case 2 happens iff $|E(A,B)|\leq \frac{10^7\mathsf{OPT}^2\cdot \rho\cdot\log^2n\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2\cdot \ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }{\alpha^*}$. If Case 2 happens, we continue directly to Step 2 (this is also a simple case, in which the eventual skeleton is the bounding box $X$ itself, and $E''=E(A,B)$).

Let $N=\Theta(d_{\mbox{\textup{\footnotesize{max}}}}\sqrt{n'\log n'})$, so that $|E(A,B)|\leq N$. Notice that set $B$ has property (P1) in $H$, since set $A$ is connected.
Our next step is to use Theorem~\ref{thm: well-linked-general} to produce an $\alpha^*$-well-linked decomposition ${\mathcal{C}}$ of $B$, where each set of $C\in {\mathcal{C}}$ has property (P1) and is canonical w.r.t. ${\mathcal{Z}}'$, with $\sum_{C\in {\mathcal{C}}}|\operatorname{out}_H(C)|\leq 2N$. It is easy to see that the decomposition will give a slightly stronger property than (P1): namely, for each $C\in {\mathcal{C}}$, for every edge $e\in \operatorname{out}_H(C)$, there is a path $P\subseteq H\setminus C$, connecting $e$ to some vertex of $A$. We will use this property later.

We are now ready to define the third case. This case happens if there is some set $C\in {\mathcal{C}}$, with $|C|\geq n'/\rho$. So if Case 3 happens, we have found two disjoint sets $A,C$ of vertices of $H$, with $|A|,|C|\geq n'/\rho$, both sets being canonical w.r.t. ${\mathcal{Z}}'$	 and $\alpha^*$-well-linked. In the next lemma, whose proof appears in Appendix, we show that we can expand this partition to the whole graph $H$.

\begin{lemma}\label{lemma: decomposition for Case 2}
If Case 3 happens, then we can efficiently find a partition $(A',B')$ of $V(H)$, such that $|A'|,|B'|\geq n'/\rho$, both sets are canonical w.r.t. ${\mathcal{Z}}'$, and $\alpha^*$-well-linked w.r.t. $\operatorname{out}_H(A'),\operatorname{out}_H(B')$, respectively.
\end{lemma}

If Case 3 happens, we continue directly to the second step. We assume  that Case 3 does not happen from now on

Notice that the above decomposition is done in the graph $H$, that is, the sets $C\in {\mathcal{C}}$ are well-linked w.r.t. $\operatorname{out}_H(C)$, and $\sum_{C\in {\mathcal{C}}}|\operatorname{out}_H(C)|\leq 2N$. Property (P1) is also only ensured for $T_H(C)$, and not necessarily for $T_G(C)$. For each $C\in {\mathcal{C}}$, let $\operatorname{out}^X(C)=\operatorname{out}_G(C)\setminus \operatorname{out}_H(C)$, that is, $\operatorname{out}^X(C)$ contains all edges connecting $C$ to the bounding box $X$. We do not have any bound on the size of $\operatorname{out}^X(C)$, and $C$ is not guaranteed to be well-linked w.r.t. these edges. The purpose of the final partitioning step is to take care of this.
This step is only performed if $X\neq \emptyset$.

We perform the final partitioning step on each cluster $C\in {\mathcal{C}}$ separately. We start by setting up an $s$-$t$ min-cut/max-flow instance, as follows. We construct a graph $\tilde{C}$, by starting with $H[C]\cup \operatorname{out}_G(C)$, and identifying all vertices in $T_H(C)$ into a source $s$, and all vertices in $T_G(C)\setminus T_H(C)$ into a sink $t$. Let $F$ be the maximum $s$-$t$ flow in $\tilde{C}$, and let $(\tilde{C}_1,\tilde{C}_2)$ be the corresponding minimum $s$-$t$ cut, with $s\in \tilde{C}_1,t\in \tilde{C}_2$. From Corollary~\ref{corollary: canonical s-t cut}, both $\tilde C_1$ and $\tilde C_2$ are canonical.
We let $C_1$ be the set of vertices of $\tilde{C}_1$, excluding $s$, and $C_2$ is the set of vertices of $\tilde{C}_2$, excluding $t$. Notice that both $C_1$ and $C_2$ are also canonical. We say that $C_1$ is a cluster of type $1$, and $C_2$ is cluster of type $2$. Recall that we have computed a max-flow $F$ connecting $s$ to $t$ in $\tilde{C}$. Since all capacities are integral, and all capacities of edges in $H[C]$ are unit, $F$ consists of a collection ${\mathcal{P}}$ of edge-disjoint paths in the graph $H[C]\cup\operatorname{out}_G(C)$. Each such path $P$ connects an edge in $\operatorname{out}_H(C)$ to an edge in $\operatorname{out}^X(C)$. Path $P$ consists of two consecutive segments: one is completely contained in $C_1$, and the other is completely contained in $C_2$. If the first segment is non-empty, then it defines a path $P_1\subseteq H[C_1]\cup \operatorname{out}_G(C_1)$, connecting an edge in $\operatorname{out}_H(C)$, to an edge in $E(\tilde C_1,\tilde C_2)$. Similarly, if the second segment is non-empty, then it defines a path $P_2\subseteq H[C_2]\cup \operatorname{out}_G(C_2)$, connecting an edge in $E(\tilde C_1,\tilde  C_2)$ to an edge in $\operatorname{out}^X(C)$. Every edge in $E(C_1,C_2)$ participates in one such path $P_1\subseteq H[C_1]\cup\operatorname{out}_G(C_1)$, and one such path $P_2\subseteq H[C_2]\cup\operatorname{out}_G(C_2)$. Similarly, if $e\in \operatorname{out}^X(C)\cap \operatorname{out}_G(C_1)$, then it is also an endpoint of exactly one path $P_1\subseteq H[C_1]\cup\operatorname{out}_G(C_1)$, and if $e\in \operatorname{out}_G(C_2)\setminus \operatorname{out}^X(C)$, then it is an endpoint of exactly one such path $P_2\subseteq H[C_2]\cup\operatorname{out}_G(C_2)$.

\begin{figure}[h]
\scalebox{0.5}{\rotatebox{0}{\includegraphics{step1-last-partition-cut.pdf}}} \caption{Partition of cluster $C$. Edges of $\operatorname{out}_H(C)$ are blue, edges of $\operatorname{out}^X(C)$ are red; edges participating in the min-cut are marked by $*$. The black edges belong to both $E_2(C_1)$ and $E_1(C_2)$.} \label{fig: step 1 last partition}
\end{figure}

For the cluster $C_1$, let $E_1(C_1)=\operatorname{out}_H(C_1)\cap \operatorname{out}_H(C)$, and $E_2(C_1)=\operatorname{out}_G(C_1)\setminus \operatorname{out}_H(C)$. All edges in $E_2(C_1)$ belong to either $E(C_1,C_2)$ or $\operatorname{out}^X(C)$. By the above discussion, we have a collection ${\mathcal{P}}(C_1)$ of edge disjoint paths in $H[C_1]\cup\operatorname{out}_G(C_1)$,  each path connecting an edge in $E_1(C_1)$ to an edge in $E_2(C_1)$, and every edge in $E_2(C_1)$ is an endpoint of a path in ${\mathcal{P}}(C_1)$.
An important property of cluster $C_1$ that we will use later is that if $C_1\neq \emptyset$, then $E_1(C_1)\neq \emptyset$. All edges in $E_1(C_1)$ can reach set $A$ in graph $H\setminus C_1$, and all edges in $E_2(C_1)$ can reach the set $V(X)$ of vertices in the graph $G\setminus C_1$. Moreover, if $E_2(C_1)\neq \emptyset$, then there is a path $P(C_1)$, connecting a vertex of $C_1$ to a vertex of $X$, such that $P(C_1)$ only contains vertices of $C_2$. In particular, it does not contain vertices of any other type-1 clusters.

Similarly, for the cluster $C_2$, let $E_2(C_2)=\operatorname{out}_G(C_2)\cap \operatorname{out}^X(C)$, and $E_1(C_2)=\operatorname{out}_G(C_2)\setminus \operatorname{out}^X(C_2)$. All edges in $E_1(C_2)$ belong to either $E(C_1,C_2)$, or to $\operatorname{out}_H(C)$. From the above discussion, we have a set ${\mathcal{P}}(C_2)$ of edge-disjoint paths in $H[C_2]\cup\operatorname{out}_G(C_2)$, each such path connecting an edge in $E_1(C_2)$ to an edge in $E_2(C_2)$, and every edge in $E_1(C_2)$ is an endpoint of one such path.

Let ${\mathcal T}_1$ be the set of all non-empty clusters of type $1$, and ${\mathcal T}_2$ the set of clusters of type $2$. For the case where $X=\emptyset$, all clusters $C\in {\mathcal{C}}$ are type-$1$ clusters, and ${\mathcal T}_2=\emptyset$.
We are now ready to define the fourth case. We say that Case 4 happens, iff clusters in ${\mathcal T}_2$ contain at least $\lambda n'/2$ vertices altogether.
Notice that Case 4 can only happen if $X\neq \emptyset$. The proof of the next lemma appears in Appendix.

\begin{lemma}\label{lemma: decomposition for Case 3}
If Case 4 happens, then we can find a partition $(A',B')$ of $V(H)$, such that $|A'|,|B'|\geq n'/\rho$, both $A'$ and $B'$ are canonical, and $A'$ is $\alpha^*$-well-linked w.r.t. $E(A',B')$. Moreover, if we denote by $\operatorname{out}^X(B')=\operatorname{out}_G(B')\setminus E(A',B')$, then there is a collection ${\mathcal{P}}$ of edge-disjoint paths in graph $H[B']\cup \operatorname{out}_G(B')$, connecting the edges in $E(A',B')$ to edges in $\operatorname{out}^X(B')$, such that each edge $e\in E(A',B')$ is an endpoint of exactly one such path.\end{lemma}

We will show below that for cases 1---4, we can successfully construct a skeleton and produce an input to the next iteration, with high probability. In the next theorem, whose proof appears in Appendix, we show that if none of these cases happen, then we can efficiently find a nasty canonical set.

\begin{theorem}\label{thm: case 4}
If none of the cases 1--4 happen, then we can efficiently find a nasty canonical set in the original contracted graph $\H$.
\end{theorem}

\subsection{Step 2: Skeleton Construction}\label{subsection: skeleton construction}
Let $(G,X)\in\set{(G_1,X_1),\ldots,(G_{k_h},X_{k_h})}$, let $\phi'$ be the strong solution to problem $\pi(G,X,{\mathcal{Z}}')$, guaranteed by Invariant~(\ref{invariant 3: there is a cheap solution}), and let $\mathsf{OPT}'$ denote its cost. Recall that $H$ is the largest connected component in $G\setminus X$, and ${\mathcal{Z}}'=\set{Z\in {\mathcal{Z}}: Z\subseteq V(H)}$. We say that an edge $e\in E(G)$ is \emph{good} iff it does not participate in any crossings in $\phi'$. Recall that for each $Z\in {\mathcal{Z}}'$, all edges of $G[Z]$ are good.
In the second step we define the subsets $E',E''$ of edges, the two sub-graphs $G^X$ and $G'$ of $G$, and construct a valid skeleton $K$ for $\pi(G^X,X,{\mathcal{Z}}'), E''$ and $\phi'$, for Cases 1---4.
We define a set $T\subseteq E(G)$ of edges, that we refer to as ``terminals'' for the rest of this section, as follows. For Case 1, $T=\emptyset$. For Case 2, $T=E(A,B)$, where $(A,B)$ is the partition of $H$ from Theorem~\ref{thm: initial partition}. For Cases 3 and 4, $T=E(A',B')$, where $(A',B')$ are the partitions of $H$ given by Lemmas~\ref{lemma: decomposition for Case 2} and \ref{lemma: decomposition for Case 3}, respectively. For convenience, we rename $(A',B')$ as $(A,B)$ for these two cases. Since the partition $(A,B)$ of $H$ is canonical for cases 2--4, we are guaranteed that $T$ does not contain any edges of grids $Z\in {\mathcal{Z}}'$.

The easiest case is Case 2. The skeleton $K$ for this case is simply the bounding box $X$, and we set $E''=T$. Recall that $|T|\leq  \frac{10^7\mathsf{OPT}^2\cdot \rho\cdot\log^2n\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2\cdot \ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }{\alpha^*}$ for this case. Since $|A|,|B|\geq n'/\rho$, it is easy to verify that $X$ is a valid skeleton for $G$, $\phi'$ and $E''$. In particular, $|A|,|B|\leq n'(1-\rho)\leq n_{h-1}(1-\rho)\leq n_{h+1}$. We set $E'=\emptyset$, $G^X=G$, and $G'=\emptyset$. From now on we focus on Cases 1, 3 and 4.

We first build an initial skeleton $K'$ of $G$, and a subset $E''$ of edges, such that $K'$ has all the required properties, except that it is possible that $X\not\subseteq K'$. Specifically, we will ensure that $K'$ only contains good edges, is rigid, and every connected component of $H\setminus (K'\cup E'')$ contains at most $n_{h+1}$ vertices. In the end, we will either connect $K'$ to $X$, or find a small subset $E'$ of edges, separating the two sets.

The initial skeleton $K'$ for Case 1 is simply the grid $Z\in{\mathcal{Z}}'$ with $|Z|\geq n'/2$, and we set $E''=\emptyset$. Observe that $K'$ is good, rigid, canonical, and every connected component of $H\setminus K'$ contains at most $n'/2\leq n_{h-1}/2\leq n_{h+1}$ vertices. The construction of the initial skeleton for Cases 3 and 4 is summarized in the next theorem, whose proof is deferred to the Appendix.

\begin{theorem}\label{thm: initial skeleton for Cases 3 and 4}
Assume that Cases 3 or 4 happen. Then we can efficiently construct a skeleton $K'\subseteq G$, such that with probability at least $\left (1-\frac 1{2\rho\cdot \mathsf{OPT}}\right )$, $K'$ is good, rigid, and every connected component of $H\setminus K'$ contains at most $O\left ( \frac{\mathsf{OPT}^2\cdot \rho\cdot \log^2 n\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2 \cdot \ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }{\alpha^*}\right )$ terminals.
\end{theorem}

Let ${\mathcal{C}}$ be the set of all connected components of $H\setminus K'$. Observe that at most one of the components may contain more than $n'/2$ vertices. Let $C$ denote this component, and let $E''$ be the set of terminals contained in $C$, $E''=T\cap E(C)$. Let ${\mathcal{C}}'$ be the set of all connected components of $C\setminus E''$. Then for each $C'\in {\mathcal{C}}'$, $|V(C')|\leq n'(1-\rho)$ must hold: otherwise, $V(C')$ must contain vertices that belong to both $A$ and $B$, and so $E(C')$ must contain at least one terminal. Therefore, the size of every connected component of $H\setminus (K'\cup E'')$ is bounded by $n'(1-\rho)\leq n_{h-1}(1-\rho)\leq n_{h+1}$ from Invariant~(\ref{invariant 5: bound on size}). Recall that the terminals do not belong to the grids $Z\in {\mathcal{Z}}'$.

Observe that it is possible that $V(K')$ is not canonical.
Consider some grid $Z\in{\mathcal{Z}}$, such that $V(Z)\cap V(K')\neq \emptyset$. If $Z\cap K'$ is a simple path, then we will deal with such grids at the end of the third step. Let ${\mathcal{Z}}''(G)$  denote the set of all such grids. Assume now that $Z\cap K'$ is not a simple path. Since graph $K'$ is rigid, it must be the case that there are at least three matching edges from $\operatorname{out}_G(Z)$ that belong to $K'$. In this case, we can simply add the whole grid $Z$ to the skeleton $K'$, and still the new skeleton $K'$ remains good and rigid, and every connected component of $H\setminus (K'\cup E'')$ contains at most $n_{h+1}$ vertices. So from now on we assume that if $V(Z)\cap V(K')\neq \emptyset$ for some $Z\in {\mathcal{Z}}$, then $Z\cap K'$ is a simple path, and so $Z\in {\mathcal{Z}}''(G)$. We denote by $K^+$ the union of $K'$ with all the grids in ${\mathcal{Z}}''(G)$. Clearly, $K^+$ is connected, canonical, but it is not necessarily rigid.

Consider Cases 1, 3 and 4. If $X=\emptyset$, then we define $E'=\emptyset$, $G^X=G$, $G'=\emptyset$ and the final skeleton $K=K'$. It is easy to see that $K$ is a valid skeleton for $\pi(G^X,X,{\mathcal{Z}}'\setminus{\mathcal{Z}}''(G))$, $E''$ and $\phi'$.

Otherwise, if $X\neq \emptyset$, we now try to connect the skeleton $K'$ to the bounding box $X$ (observe that some of the vertices of $X$ may already belong to $K'$). In order to do so, we will try to find a set ${\mathcal{P}}'$ of $24\mathsf{OPT}^2\rho$ vertex-disjoint paths in $G\setminus E''$, connecting the vertices of $X$ to the vertices of $K^+$ (where some of these paths can be simply vertices in $X\cap K^+$). We distinguish between three cases.

The first case is when such a collection of paths does not exist in $G\setminus E''$. Then there must be a set $V'\subseteq V(G)$ of at most $24\mathsf{OPT}^2\rho$ vertices, whose removal from $G\setminus E''$ separates $X$ from $K^+$. Therefore, the size of the edge min-cut separating $X$ from $K^+\setminus X$ in $G\setminus E''$ is at most $24\mathsf{OPT}^2\rhod_{\mbox{\textup{\footnotesize{max}}}}$.
Observe that both $K^+$ and $X$ are canonical w.r.t. ${\mathcal{Z}}'$, and the vertices in $V(X)\cap V(K^+)$ cannot belong to sets $Z\in {\mathcal{Z}}'$, by the definition of ${\mathcal{Z}}'$.
Therefore, from Corollary~\ref{corollary: canonical s-t cut}, there is a subset $E'$ of at most $24\mathsf{OPT}^2\rhod_{\mbox{\textup{\footnotesize{max}}}}$ edges (canonical edge min-cut), whose removal partitions graph $G\setminus E''$ into two connected sub-graphs, $G^X$  containing $X$, and $G'=G\setminus V(G^X)$, and moreover, $V(G_X)$ and $V(G')$ are both canonical, and the edges of $E'$ do not belong to any grids $Z\in {\mathcal{Z}}'$. We add the instance $\pi(G',\emptyset,{\mathcal{Z}}')$ directly to ${\mathcal{G}}_{h+1}$. From Invariant~(\ref{invariant 5: bound on size}), since $X\neq \emptyset$, $|V(G')|\leq n_h$, and since the bounding box of the new instance is $\emptyset$, it is a valid input to the next iteration. For graph $G^X$, we use $X$ as its skeleton. Observe that every connected component of $G^X\setminus (X\cup E'')$ must be either a sub-graph of some connected component of $H\setminus (K'\cup E'')$  (and then its size is bounded by $n_{h+1}$), or it must belong to ${\mathcal{H}}^0$ (and then its size is bounded by $n_{h-1}/2\leq n_{h+1}$). Therefore, $X$ is a valid skeleton for $\pi(G^X,X,{\mathcal{Z}}'\setminus {\mathcal{Z}}''(G))$, $E''$, and $\phi'$.

The second case is when there is some grid $Z\in {\mathcal{Z}}''(G)$, such that for any collection ${\mathcal{P}}'$ of $24\mathsf{OPT}^2\rho$ vertex-disjoint paths, connecting the vertices of $X$ to the vertices of $K^+$ in $G$, at least half the paths contain vertices of $\Gamma(Z)$ as their endpoints. Recall that only $2$ edges of $\operatorname{out}_H(Z)$ belong to $K'$. Then there is a collection $E'$ of at most $12d_{\mbox{\textup{\footnotesize{max}}}}\mathsf{OPT}^2\rho+2$ edges in $G\setminus E''$, whose removal separates $V(X)\cup Z$ from $V(K^+)\setminus (Z\cup X)$. Again, we can ensure that the edges of $E'$ do not belong to the grids $Z\in {\mathcal{Z}}'$. Let $G^X$ denote the resulting subgraph that contains $X$, and $G'=G\setminus G^X$. Then both $G^X$ and $G'$ are canonical as before, and we can add the instance  $\pi(G',\emptyset,{\mathcal{Z}}')$ to ${\mathcal{G}}_{h+1}$, as before. In order to build a valid skeleton for graph $G^X$, we consider the subset ${\mathcal{P}}''\subseteq {\mathcal{P}}'$ of $12\mathsf{OPT}^2\rho$ vertex-disjoint paths, connecting the vertices of $X$ to the vertices of $\Gamma(Z)$, and we randomly choose three such paths. We then let the skeleton $K$ of $G^X$ consist of the union of $X$, $Z$, and the three selected paths. It is easy to see that the resulting graph $K$ is rigid, and with probability at least $(1-\frac 1{2\rho\cdot \mathsf{OPT}})$, it only contains good edges. Moreover, every connected component of $G^X\setminus (K\cup E'')$ is either a sub-graph of a connected component of $H\setminus (K'\cup E'')$ (and  may contain at most $n_{h+1}$ vertices), or it belongs to ${\mathcal{H}}^0$ (and then its size is bounded by $n_{h+1}$). Therefore, $K$ is a valid skeleton for $\pi(G^X,X,{\mathcal{Z}}'\setminus {\mathcal{Z}}''(G))$, $E''$, and $\phi'$.

The third case is when we can find the desired collection ${\mathcal{P}}'$ of paths, and moreover, for each grid $Z\in {\mathcal{Z}}''(G)$, at most half the paths in ${\mathcal{P}}'$ contain vertices of $\Gamma(Z)$. We then randomly select three paths from ${\mathcal{P}}'$, making sure that at most two paths containing vertices of $\Gamma(Z)$ are selected for any grid $Z\in {\mathcal{Z}}''(G)$. Since at most $2\mathsf{OPT}$ of the paths in ${\mathcal{P}}'$ are bad, with probability at least $1-1/(2\mathsf{OPT}\rho)$, none of the selected paths is bad. We then define $K$ to be the union of $K'$, $X$, and the three selected paths.
Additionally, if, for some grid $Z\in {\mathcal{Z}}''(G)$, one or two of the selected paths contain vertices in $\Gamma(Z)$, then remove $Z$ from ${\mathcal{Z}}''(G)$, and add it to $K$. It is easy to verify that the resulting skeleton is rigid, and it only contains good edges. Moreover, every connected component of $G\setminus (K\cup E'')$, is either a sub-graph of a connected component of $H\setminus (K'\cup E'')$, or it is a sub-graph of one of the graphs in ${\mathcal{H}}^0$. In the former case, its size is bounded by $n_{h+1}$ as above, while in the latter case, its size is bounded by $|V(G\setminus X)|/2\leq n_{h-1}/2<n_{h-1}(1-\rho)\leq n_{h+1}$. We set $E'=\emptyset$, $G^X=G$, and $G'=\emptyset$.

To summarize this step, we have started with the instance $\pi(G,X,{\mathcal{Z}}')$, and defined two subsets $E',E''$ of edges, with $|E'|\leq O(\mathsf{OPT}^2d_{\mbox{\textup{\footnotesize{max}}}}\rho)$ and $|E''|\leq O\left ( \frac{\mathsf{OPT}^2\cdot \rho\cdot \log^2 n\cdot d_{\mbox{\textup{\footnotesize{max}}}}^2 \cdot \ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }{\alpha^*}\right )$, whose removal disconnects $G$ into two connected sub-graphs: $G^X$ containing $X$, and $G'$. Moreover, both sets $V(G^X)$, $V(G')$ are canonical, and $E',E''$ do not contain edges belonging to grids $Z\in{\mathcal{Z}}'$. We have added instance $\pi(G',\emptyset,{\mathcal{Z}}')$ to ${\mathcal{G}}_{h+1}$, and we have defined a skeleton $K$ for $G^X$. We have shown that $K$ is a valid skeleton for $\pi(G^X,X,{\mathcal{Z}}'\setminus {\mathcal{Z}}''(G))$, $E''$, and $\phi'$. The probability that this step is successful for a fixed graph $G\in\set{G_1,\ldots,G_{k_h}}$ is at least $(1-1/(\rho\cdot  \mathsf{OPT}))$, and so the probability that it is successful across all graphs is at least $(1-1/\rho)$.

We can assume w.l.o.g. that every edge in set $E'$ has one endpoint in $G^X$ and one endpoint in $G'$: otherwise, this edge does not separate $G^X$ from $G'$, and can be removed from $E'$. Similarly, we can assume w.l.o.g. that for every edge $e\in E''$, the two endpoints of $e$ either belong to distinct connected components of $G^X\setminus (K\cup E'')$, or one endpoint belongs to $G^X$, and the other to $G'$. We will use these facts later, to claim that Invariant~(\ref{invariant 2: proper subgraph}) holds for the resulting instances.

\subsection{Step 3: Producing Input to the Next Iteration}\label{sec: step 3}
Recall that so far, for each $1\leq i\leq k_h$, we have found two collections $E_i',E_i''$ of edges, two sub-graphs $G_i^X$ and $G_i'$ with $X_i\subseteq G_i^X$, and a valid skeleton $K_i$ for $\pi(G_i^X,X_i,{\mathcal{Z}}\setminus {\mathcal{Z}}''(G_i))$, $\phi_i$, $E''_i$. The sets $E_i'\cup E_i''$ do not contain any edges of the grids $Z\in {\mathcal{Z}}$, and each edge in $E_i'\cup E''_i$ either connects a vertex of $G_i^X$ to a vertex of $G_i'$, or vertices of two distinct connected components of $G_i^X\setminus (K_i\cup E''_i)$. Recall that $G_i'$ contains at most $n_{h}$ vertices, and there are no edges in $G_i\setminus (E_i'\cup E_{i}'')$ connecting the vertices of $G_i'$ to those of $G_i^X$. Let ${\mathcal{C}}'$ denote the set of all connected components of $G_i^X\setminus (K_i\cup E_i'')$. Then for each $C\in {\mathcal{C}}'$, $|V(C)|\leq n_{h+1}$.

Since graph $K_i$ is rigid, we can find the planar drawing $\phi_i(K_i)$ of $K_i$ induced by $\phi_i$ efficiently. Since all edges of $K_i$ are good for $\phi_i$, each connected component $C\in{\mathcal{C}}'$ is embedded inside a single face $F_C^*$ of $\phi_i$. Intuitively, we would like to find this face $F_C^*$ for each such connected component $C$, and then solve the problem recursively on $C$, together with the bounding box $\gamma(F_C^*)$ --- the boundary of the face $F_C^*$. Apart from the difficulty in identifying the face $F_C^*$, a problem with this approach is that it is not clear that we can solve the problems induced by different connected components separately. For example, if both $C$ and $C'$ need to be embedded inside the same face $F$, then even if we find weak solutions for problems $\pi(C,\gamma(F),{\mathcal{Z}})$ and $\pi(C',\gamma(F),{\mathcal{Z}}')$, it is not clear that these two solutions can be combined together to give a feasible weak solution for the whole problem, since the drawings of $C\cup \gamma(F)$ and $C'\cup \gamma(F)$ may interfere with each other. We will define below the condition under which the two clusters are considered independent and can be solved separately. We will then find an assignment of each cluster $C$ to one of the faces of $\phi_i(K_i)$, and find a further partition of each cluster $C\in {\mathcal{C}}'$, such that all resulting clusters assigned to the same face are independent, and their corresponding problems can therefore be solved separately.

We now focus on some graph $G=G_i^X\in \set{G_1^X,\ldots,G_{k_h}^X}$, and we denote its bounding box by $X$, its skeleton $K_i$ by $K$, and the two sets $E_i',E_i''$ of edges by $E'$ and $E''$ respectively. We let $\phi'$ denote the drawing of $G_i^X$ induced by the drawing $\phi_i$, guaranteed by Invariant~(\ref{invariant 3: there is a cheap solution}).
As before, ${\mathcal{C}}'$ is the set of all connected components of $G\setminus (K\cup E'')$.

While further partitioning the clusters $C\in{\mathcal{C}}'$ to ensure independence, we may have to remove edges that connect the vertices of $C$ to the skeleton $K$. However, such edges do not strictly belong to the cluster $C$. We next perform a simple transformation of the graph $G\setminus (E'\cup E'')$ in order to take care of this technicality.

Consider the graph $G\setminus (E'\cup E'')$. We perform the following transformation: let $e=(v,x)$ be any edge in $E(G)\setminus (E'\cup E'')$, such that $x\in K$, $v\not\in K$. We add an artificial vertex $z_e$, that subdivides $e$ into two edges: an artificial edge $(x,z_e)$, and a non-artificial edge $(v,z_e)$. We denote $x_{z_e}=x$. Similarly, if $e=(x,x')$ is any edge in $E(G)\setminus (E'\cup E'')$, with $x,x'\in K$, then we add two artificial vertices $z_e,z'_e$, that subdivide $e$ into three edges, artificial edges $(x,z_e)$, and $(z'_e,x')$, and a non-artificial edge $(z_e,z'_e)$. We denote $x_{z_e}=x$, and $x_{z_{e}'}=x'$. If edge $e$ belonged to any grids $Z\in {\mathcal{Z}}$ (which can happen if $Z\in {\mathcal{Z}}''(G)$), then we consider all edges obtained from sub-divviding $e$ also a part of $Z$. Let $\tilde{G}$ denote the resulting graph, $\Gamma$ the set of all these artificial vertices, and let $E_{\tilde{G}}(\Gamma,K)$ be the set of all artificial edges in $\tilde G$. Let $\tilde{\phi}$ be the drawing of $\tilde{G}$ induced by $\phi'$. Notice that we can assume w.l.o.g. that the edges of $E_{\tilde G}(\Gamma,K)$ do not participate in any crossings in $\tilde{\phi}$. We use this assumption throughout the current section.

For any sub-graph $C$ of $\tilde G\setminus K$, we denote by $\Gamma(C)=\Gamma\cap V(C)$, and $\operatorname{out}_K(C)$ is the subset of artificial edges adjacent to the vertices of $C$, that is, $\operatorname{out}_K(C)=E_{\tilde G}(\Gamma_C,K)$. We also denote by $C^+=C\cup \operatorname{out}_K(C)$, and by $\delta(C)$ the set of endpoints of the edges in $\operatorname{out}_K(C)$ that belong to $K$.
Let ${\mathcal{C}}$ the set of all connected components of $\tilde G\setminus K$. We next formally define the notion of independence of clusters. Eventually, we will find a further partition of each one of the clusters $C\in {\mathcal{C}}$, so that the resulting clusters are independent, and can be solved separately in the next iteration.

Let $\phi_K'$ be the drawing of $K$ induced by $\phi'$. Recall that this is the unique planar drawing of $K$, that can be found efficiently. Let ${\mathcal{F}}$ be the set of faces of $\phi_K'$. For each face $F\in {\mathcal{F}}$, let $\gamma(F)$ denote the set of edges and vertices lying on its boundary. Since $K$ is rigid, $\gamma(F)$ is a simple cycle. Since all edges of $K$ are good for $\phi'$, for every component $C\in {\mathcal{C}}$, $C^+$ is embedded completely inside some face $F^*_C$ of ${\mathcal{F}}$ in the drawing $\tilde {\phi}$, and so $\delta(C)\subseteq \gamma(F)$ must hold. Therefore, there are three possibilities: either there is a unique face $F_C\in {\mathcal{F}}$, such that $\delta(C)\subseteq \gamma(F_C)$. In this case we say that $C$ is of type 1, and  $F_C=F^*_C$ must hold; or there are two faces $F_1(C),F_2(C)$, whose both boundaries contain $\delta(C)$, so  $F^*_C\in\set{F_1(C),F_2(C)}$. In this case we say that $C$ is of type 2. The third possibility is that $|\delta(C)|\leq 1$. In this case we say that $C$ is of type 3, and we can embed $C$ inside any face whose boundary contains the vertex $\delta(C)$. The embedding of such clusters does not affect other clusters. For convenience, when $C$ is of type 1, we denote $F_1(C)=F_2(C)=F_C$, and if it is of type 3, then we denote $F_1(C)=F_2(C)=F$, where $F$ is any face of ${\mathcal{F}}$ whose boundary contains $\delta(C)$.

We now formally define when two clusters $C,C'\in {\mathcal{C}}$ are independent. Let $C,C'\in {\mathcal{C}}$ be any two clusters, such that there is a face $F\in {\mathcal{F}}$, with $\delta(C),\delta(C')\subseteq \gamma(F)$. The set $\delta(C)$ of vertices defines a partition $\Sigma$ of $\gamma(F)$ into segments, where every segment $\sigma\in \Sigma$ contains two vertices of $\delta(C)$ as its endpoints, and does not contain any other vertices of $\delta(C)$. Similarly, the set $\delta(C')$ of vertices defines a partition $\Sigma'$ of $\gamma(F)$.

\begin{definition}
We say that the two clusters $C,C'$ are \emph{independent}, iff $\delta(C)$ is completely contained in some segment $\sigma'\in \Sigma'$. Notice that in this case, $\delta(C')$ must also be completely contained in some segment $\sigma\in \Sigma$.
\end{definition}

Our goal in this step is to assign to each cluster $C\in {\mathcal{C}}$, a face $F(C)\in\set{F_1(C),F_2(C)}$, and to find a partition ${\mathcal{Q}}(C)$ of the vertices of the cluster $C$. Intuitively, each such cluster $Q\in{\mathcal{Q}}(C)$ will become an instance in the input to the next iteration, with $\gamma(F(C))$ as its bounding box.
Suppose we are given such an assignment $F(C)$ of faces, and the partition ${\mathcal{Q}}(C)$ for each $C\in {\mathcal{C}}$. We will use the following notation.
For each $C\in {\mathcal{C}}$,
let $E^*(C)$ denote the set of edges cut by ${\mathcal{Q}}(C)$, that is, $E^*(C)=\bigcup_{Q\neq Q'\in {\mathcal{Q}}(C)}E_{\tilde{G}}(Q,Q')$, and let $E^*=\bigcup_{C\in {\mathcal{C}}}E^*(C)$. For each $Q\in {\mathcal{Q}}(C)$, we denote by $X_Q=\gamma(F(C))$, the boundary of the face inside which $C$ is to be embedded. For each face $F\in {\mathcal{F}}$, we denote by ${\mathcal{Q}}(F)=\bigcup_{C:F(C)=F}{\mathcal{Q}}(C)$ the set of all clusters to be embedded inside $F$, and we denote by ${\mathcal{Q}}=\bigcup_{C\in {\mathcal{C}}}{\mathcal{Q}}(C)$.
Abusing the notation, for each cluster $Q\in {\mathcal{Q}}$, we will refer to $Q$ both as the set of vertices, and as the sub-graph $\tilde G[Q]$ induced by it.
As before, we denote  $Q\cup \operatorname{out}_K(Q)$ by $Q^+$.
The next theorem shows that it is enough to find an assignment of every cluster $C\in {\mathcal{C}}$ to a face $F(C)\in \set{F_1(C),F_2(C)}$, and a partition ${\mathcal{Q}}(C)$ of the vertices of $C$, such that all the resulting clusters assigned to every face of ${\mathcal{F}}$ are independent.

\begin{theorem}\label{thm: no conflict case}
Suppose we are given, for each cluster $C\in {\mathcal{C}}$, a face $F(C)\in \set{F_1(C),F_2(C)}$, and a partition ${\mathcal{Q}}(C)$ of the vertices of $C$.
Moreover, assume that for every face $F\in {\mathcal{F}}$, every pair $Q,Q'\in {\mathcal{Q}}(F)$ of clusters is independent, and for each $Z\in {\mathcal{Z}}$, $E^*\cap E(Z)=\emptyset$.
Then:

\begin{itemize}
\item For each $Q\in {\mathcal{Q}}$, there is a strong solution to the problem $\pi(Q^+\cup X_Q,X_Q,{\mathcal{Z}})$, such that the total cost of these solutions, over all $Q\in {\mathcal{Q}}$, is bounded by $\operatorname{cr}_{\tilde \phi}(\tilde G)\leq \operatorname{cr}_{\phi'}(G)$.

\item For each $Q\in {\mathcal{Q}}$, let $E^{**}_Q$ be any feasible weak solution to the problem $\pi(Q^+\cup X_Q,X_Q,{\mathcal{Z}})$, and let $E^{**}=\bigcup_{Q\in {\mathcal{Q}}}E^{**}_Q$. Then $E'\cup E''\cup E^*\cup E^{**}$ is a feasible weak solution to problem $\pi(G,X,{\mathcal{Z}})$.
\end{itemize}
\end{theorem}

We remark that this theorem does not require that the sets $C\in {\mathcal{C}}$ are canonical vertex sets.

\begin{proof}
Fix some $Q\in {\mathcal{Q}}$, and let $\tilde{\phi}_{Q^+}$ be the drawing of $Q^+\cup X_Q$ induced by $\tilde{\phi}$. Recall that the edges of the skeleton $K$ do not participate in any crossings in $\tilde \phi$, and every pair $Q,Q'\in {\mathcal{Q}}$ of graphs is completely disjoint. Therefore, $\sum_{Q\in {\mathcal{Q}}}\operatorname{cr}_{\tilde \phi_{Q^+}}(Q^+)\leq \operatorname{cr}_{\tilde \phi}(\tilde G)$.  Observe that every edge of $\tilde G$ belongs either to $K$, or to $E^*$, or to $Q^+$ for some $Q\in {\mathcal{Q}}$. Therefore, it is now enough to show that for each $Q\in {\mathcal{Q}}$, $\tilde \phi_{Q^+}$ is a feasible strong solution to problem $\pi(Q^+\cup X_Q,X_Q,{\mathcal{Z}})$. Since $\phi'$ is canonical, so is $\tilde \phi_{Q^+}$. It now only remains to show that $Q^+$ is completely embedded on one side (that is, inside or outside) of the cycle $X_Q$ in $\tilde \phi_{Q^+}$. Let $C\in {\mathcal{C}}$, such that $Q\in {\mathcal{Q}}(C)$. Recall that $C$ is a connected component of $\tilde G\setminus K$. Since $K$ is good, $C$ is embedded completely inside one face in ${\mathcal{F}}$. In particular, since $X_Q$ is the boundary of one of the faces in ${\mathcal{F}}$, all vertices and edges of $C$ (and therefore of $Q$) are completely embedded on one side of $X_Q$. Therefore, $X_Q$ can be viewed as the bounding box in the embedding $\tilde \phi_{Q^+}$.

We now prove the second part of the theorem. For each $Q\in {\mathcal{Q}}$, let $E^{**}_Q$ be any feasible weak solution to the problem $\pi(Q^+\cup X_Q,X_Q,{\mathcal{Z}})$, and let $E^{**}=\bigcup_{Q\in {\mathcal{Q}}}E^{**}_Q$. We first show that $E'\cup E''\cup E^*\cup E^{**}$ is a feasible weak solution to the problem $\pi(\tilde G,X,{\mathcal{Z}})$.

Let $F\in {\mathcal{F}}$ be any face of $\phi'_K$. For each $Q\in {\mathcal{Q}}(F)$, let $\tilde Q=Q\setminus E^{**}_Q$, and let $\tilde Q^+=Q^+\setminus E^{**}_Q$. Since $E^{**}_Q$ is a weak solution for instance $\pi(Q^+\cup X_Q,X_Q,{\mathcal{Z}})$, there is a planar drawing $\psi_{Q}$ of $\tilde{Q}^+\cup X_Q$, inside the bounding box $X_Q=\gamma(F)$. It is enough to show that for each face $F\in {\mathcal{F}}$, we can find a planar embedding of graphs $\tilde{Q}^+$, for all $Q\in{\mathcal{Q}}(F)$ inside $\gamma(F)$.

Fix an arbitrary ordering ${\mathcal{Q}}(F)=\set{Q_1,\ldots,Q_r}$. We now gradually construct a planar drawing of the graphs $\tilde{Q}_j^+$ inside $\gamma(F)$. For convenience, we will also be adding new artificial edges to this drawing. We perform $r$ iterations, and the goal in iteration $j: 1\leq j\leq r$ is to add the graph $\tilde{Q}_j^+$ to the drawing. We will maintain the following invariant: at the beginning of every iteration $j$, for each $j'\geq j$, there is a face $F'$ in the current drawing, such that $\delta(Q_j)\subseteq \gamma(F')$.

In the first iteration, we simply use the drawing $\psi_{Q_1}$ of $\tilde{Q}_1^+\cup \gamma(F)$. The vertices of $\delta(Q_1)$ define a partition $\Sigma_1$ of $\gamma(F)$ into segments, such that every segment contains two vertices of $\delta(Q_1)$ as its endpoints, and no other vertices of $\delta(Q_1)$. For each such segment $\sigma$, we add a new artificial edge $e_{\sigma}$ connecting its endpoints to the drawing. All such edges can be added without creating any crossings.
 Since every pair of clusters in ${\mathcal{Q}}(F)$ is independent, for each graph $Q_j$, $j> 1$, the vertices of $\delta(Q_j)$ are completely contained in one of the resulting segments $\sigma\in \Sigma_1$. The face $F'$ of the current drawing, whose boundary consists of $\sigma$ and $e_{\sigma}$ then has the property that $\delta(Q_j)\subseteq \gamma(F')$.

 Consider now some iteration $j+1$, and let $F'$ be the face of the current drawing, such that $\delta(Q_{j+1})\subseteq \gamma(F')$. We add the drawing $\psi_{Q_{j+1}}$ of $\tilde Q_{j+1}^+\cup \gamma(F)$, with $\gamma(F')$ replacing $\gamma(F)$ as the bounding box. We can do so since $\delta(Q_j)\subseteq \gamma(F')$. We can therefore add this drawing, so that no crossings with edges that already belong to the drawing are introduced. The bounding box $\gamma(F')$ is then sub-divided into the set $\Sigma'$ of sub-segments, by the vertices of $\delta(Q_j)$. Again, for each such segment $\sigma'$, we add an artificial edge $e_{\sigma'}$, connecting its endpoints, to the drawing, inside the face $F'$, such that no crossings are introduced. Since there are no conflicts between clusters in ${\mathcal{Q}}(F)$, for each $Q_{j'}$, with $j'>j+1$, such that $\delta(Q_{j'})\subseteq \gamma(F')$, there is a segment $\sigma'\in \Sigma'$, containing all vertices of $\delta(Q_{j'})$. The corresponding new face $F''$, formed by $\sigma'$ and the edge $e_{\sigma'}$ will then have the property that $\delta(Q_{j'})\subseteq \gamma(F'')$.

 We have thus shown that $\tilde{G}\setminus (E^*\cup E^{**})$ has a planar drawing. The same drawing induces a planar drawing for $G\setminus (E'\cup E''\cup E^*\cup E^{**})$.
\end{proof}

In the rest of this section, we will show an efficient algorithm to find the assignment of the faces of ${\mathcal{F}}$ to the clusters $C\in {\mathcal{C}}$, and the partition ${\mathcal{Q}}(C)$ of each such cluster, satisfying the requirements of Theorem~\ref{thm: no conflict case}. Our goal is also to ensure that $|E^*|$ is small, as these edges are eventually removed from the graph. If two clusters $C,C'\in {\mathcal{C}}$, with $\delta(C),\delta(C')\subseteq \gamma(F)$ for some $F\in {\mathcal{F}}$ are not independent, then we say that they have a conflict. The process of partitioning both clusters into sub-clusters to ensure that the sub-clusters are independent is called conflict resolution. The next theorem shows how to perform conflict resolution for a pair of clusters. The proof of this theorem is due to Yury Makarychev~\cite{Yura}. We provide it here for completeness.

\begin{theorem}\label{thm: conflict resolution for 2 clusters}
Let $C,C'\in {\mathcal{C}}$, such that both $C$ and $C'$ are embedded inside the same face $F\in {\mathcal{F}}$ in $\tilde{\phi}$. Then
we can efficiently find a subset $E_{C,C'}\subseteq E(C)$ of edges, $|E_{C,C'}|\leq 30 \operatorname{cr}_{\tilde\phi}(E(C),E(C'))$, such that if ${\mathcal{C}}'$ denotes the collection of all connected components of $C\setminus E_{C,C'}$, then for every cluster $Q\in {\mathcal{C}}'$, $Q$ and $C'$ are independent. Moreover, $E_{C,C'}$ does not contain any edges of the grids $Z\in {\mathcal{Z}}$.
\end{theorem}

\begin{proof}

We say that a set $\tilde{E}$ of edges is valid iff it satisfies the condition of the theorem. For simplicity, we will assign weights $w_e$ to edges as follows: edges that belong to grids $Z\in {\mathcal{Z}}$ have infinite weight, and all other edges have weight $1$.
We first claim that there is a valid set of weight at most $\operatorname{cr}_{\tilde{\phi}}(C, C')$.
Indeed, let $\tilde{E}$ be the set of edges of $C$, that are crossed by the edges of $C'$ in $\tilde \phi$. Clearly,
$|\tilde E| \leq \operatorname{cr}_{\tilde{\phi}}(C,C')$, and this set does not contain any edges in grids $Z\in {\mathcal{Z}}$, or edges adjacent to the vertices of $K$ (this was our assumption when we defined $\tilde\phi$). Let ${\mathcal{C}}'$ be the set of all connected components of $C\setminus \tilde E$, and  consider some cluster $Q\in {\mathcal{C}}'$. Assume for contradiction, that $Q$ and $C'$ are not independent. Then there are four vertices $a,b,c,d\in \gamma(F)$, whose ordering along $\gamma(F)$ is $(a,b,c,d)$, and $a,c\in \delta(Q)$, while $(b,d)\in \delta(C')$. But then there must be a path $P\subseteq Q\cup\operatorname{out}_K(Q)$ connecting $a$ to $c$, and a path $P'\subseteq C'\cup \operatorname{out}_K(C')$, connecting $b$ to $d$, as both $Q$ and $C'$ are connected graphs. Moreover, since $Q$ and $C'$ are completely disjoint, the two paths must cross in $\tilde{\phi}$. Recall that we have assumed that the artificial edges adjacent to $K$ do not participate in any crossings in $\tilde{\phi}$. Therefore, the crossing is between an edge of $Q$ and an edge of $C'$. This is impossible, since we have removed all edges that participate in such crossings from $C$.

We now show how to  \textit{efficiently} find a valid set $\tilde E$ of edges, of weight at most
$30 \operatorname{cr}_{\tilde{\phi}}(E(C),E(C'))$.
Let $\Sigma' = \{\sigma'_1,\sigma'_2,\dots, \sigma'_k\}$ be the set of segments of $\gamma(F)$,
defined by $\delta(C')$, in the circular order. Throughout the rest of the proof we identify $k+1$ and $1$.

Consider the set $\Gamma(C)$ of vertices. We partition this set into a number of subsets, as follows.
For $1\leq i\leq k$, let $\Gamma_i\subseteq \Gamma(C)$ denote the subset of vertices $z\in \Gamma(C)$, for which $x_z$ lies strictly
inside the segment $\sigma_i'$. Let $\Gamma_{i,i+1}\subseteq \Gamma(C)$ denote the subset of vertices $z\in \Gamma(C)$, for which $x_z$ is the vertex separating segments $\sigma'_i$ and $\sigma'_{i+1}$.

We now restate the problem of finding a valid cut $E_{C,C'}$ as an assignment problem.
We need to assign each vertex of $C$ to one of the segments $\sigma'_1, \dots, \sigma'_k$ so that
\begin{itemize}
\item every vertex in $\Gamma_i$ is assigned to the segment $\sigma'_i$;
\item every vertex in $\Gamma_{i,i+1}$ is assigned to either  $\sigma'_i$ or $\sigma'_{i+1}$.
\end{itemize}

We say that an edge of $C$ is cut by such an assignment, iff its endpoints are assigned to different segments.
Given any such assignment, whose weight is finite, let $\tilde E$ be the set of cut edges. We prove that set $\tilde E$ is valid. Since the weight of $\tilde E$ is finite, it cannot contain edges of grids $Z\in {\mathcal{Z}}$.
Let ${\mathcal{C}}'$ be the collection of all connected components of $C\setminus \tilde E$. It is easy to see that for each $Q\in {\mathcal{C}}'$, $Q$ and $C'$ is independent. This is since for all edges in $\operatorname{out}_K(Q)$, their endpoints that belong to $K$ must all be contained inside a single segment $\sigma'$ of $\Sigma'$.

On the other hand, every finite-weight valid set $\tilde E$ of edges corresponds to a valid assignment. Let ${\mathcal{C}}'$ be the set of all connected components of $C\setminus \tilde E$, and let $Q\in {\mathcal{C}}'$. Since there are no conflicts between $Q$ and $C'$, all vertices of $\delta(Q)$ that serve as endpoints of the set $\operatorname{out}_K(Q)$ of edges, must be contained inside a single segment $\sigma'\in \Sigma'$. If the subset of $\delta(Q)$ contains a single vertex, there can be two such segments of $\Sigma'$, and we choose any one of them arbitrarily; if this subset of $\delta(Q)$ is empty, then we choose an arbitrary segment of $\Sigma'$. We then assign all vertices of $Q$ to $\sigma'$. Since $\tilde E$ does not contain any edges  that are adjacent to the vertices of $K$ (as such edges are not part of $E(C)$), we are guaranteed that every vertex in $\Gamma_i$ is assigned to the segment $\sigma'_i$, and every vertex in $\Gamma_{i,i+1}$ is assigned to either $\sigma'_i$ or $\sigma'_{i+1}$, for all $1\leq i\leq k$.

We now show how to approximately solve the assignment problem, and therefore the original problem,
using linear programming. We will ensure that the weight of the solution $E_{C,C'}$ is at most $30$ times the optimum, and so $|E_{C,C'}|\leq 30 \operatorname{cr}_{\tilde \phi}(E(C),E(C'))$.

For each vertex $u$ of $C$
and segment $\sigma'_i$ we introduce an indicator variable $y_{u,i}$, for assigning $u$ to segment $\sigma'_i$. All variables for vertex $u$ form a vector
$y_u = (y_{u,1}, \dots, y_{u,k}) \in {\mathbb R}^k$.
We denote the standard basis of ${\mathbb R}^k$ by $e_1,\dots, e_k$.
In the intended integral solution, $y_u = e_i$ if $u$ is assigned to $\sigma'_i$; that is,
$y_{u,i} = 1$ and $y_{u,j} = 0$ for $j\neq i$. Equip the space ${\mathbb R}^k$ with the $\ell_1$ norm
$\|y_u\|_1 = \sum_{i=1}^k |y_{u,i}|$. We solve the following linear program.
\begin{align*}
\text{minimize } &&\frac{1}{2} \sum_{e=(u,v)\in E(C)} w_e\cdot  \|y_u - y_v\|_1\\
\text{subsject to }&& \\
&& \|y_u\|_1 = 1 &&& \forall u \in V(C);\\
&& y_{u,i} = 1 &&& \forall 1\leq i\leq k, \forall u \in \Gamma_i;\\
&& y_{u,i} + y_{u,i+1} = 1 &&& \forall 1\leq i\leq k,\forall u \in \Gamma_{i,i+1};\\
&& y_{u,i} \geq 0 &&& \forall u \in V(C), \forall 1\leq i\leq k.
\end{align*}

Let $\mathsf{OPT}_{LP}$ be the value of the optimal solution of the LP. For all $1\leq i\leq k$, $r\in (1/2,3/5)$, define balls $B_i^r = \{u: y_{u,i} \geq r\}$ and
$B_{i,i+1}^r = \{u: u\not\in B_i^r\cup B_{i+1}^r; y_{u,i}+y_{u,i+1} \geq 5r/3\}$.
Note that since, for each $u\in V(C)$, at most one coordinate $y_{u,i}$ can be greater than $\ensuremath{\frac{1}{2}}$, whenever $r\geq \ensuremath{\frac{1}{2}}$, the balls $B_i^r$ and $B_j^r$ are
disjoint for all $i\neq j$. Similarly, balls $B_{i,i+1}^r$ and $B_{j,j+1}^{r}$ are disjoint for $i\neq j$ when $r \geq 1/2$: this is since, if $u\in B_{i,i+1}^r$, then $y_{u,i}+y_{u,i+1}\geq 5/6$ must hold, while $y_{u,i},y_{u,i+1}<\ensuremath{\frac{1}{2}}$. Therefore, $y_{u,i},y_{u,i+1}>1/3$ must hold, and there could be at most two coordinates $1\leq j\leq k$, for which $y_{u,j}>1/3$.

For each value of $r: 1/2\leq r/\leq 3/5$, we let $E^r$ denote all edges that have exactly one endpoint in the balls $B_i^r$, and $B_{i,i+1}^r$, for all $1\leq i\leq k$. We choose $r\in (1/2,3/5)$ that minimizes $|E^r|$, and we let $E_{C,C'}$ denote the set $E^r$ for this value of $r$.
 We assign all
vertices in balls $B_i^r$ and $B_{i,i+1}^r$ to the segment $\sigma'_i$. We assign all unassigned vertices
to an arbitrary segment. We need to verify that this assignment is valid; that is, vertices
from $\Gamma_i$ are assigned to $\sigma'_i$ and vertices from $\Gamma_{i,i+1}$
are assigned to either $\sigma'_i$ or $\sigma'_{i+1}$, for all $1\leq i\leq k$. Indeed, if $u\in\Gamma_i$, then $y_{u,i} = 1$, and so $u\in B^r_i$; similarly, if $u\in\Gamma_{i,i+1}$ then $y_{u,i} + y_{u,i+1} = 1$, and so $u\in B^r_i\cup B^r_{i+1}\cup B^r_{i,i+1}$.

Finally, we need to show that the cost of the assignment is at most $30 \mathsf{OPT}_{LP}$. In fact,
we show that if we choose $r\in (1/2,3/5)$ uniformly at random, then the expected cost is at most $30\mathsf{OPT}_{LP}$.
Consider an edge $e=(u,v)$. We compute the probability that $e\in B^r_i$, for each $1\leq i\leq k$. This is the probability that $y_{u,i}\geq r$, but $y_{v,i}<r$ (or vice versa if $y_{v,i}<y_{u,i}$). This probability is bounded by $10|y_{u,i}-y_{v,i}|$. Similarly, the probability that $u\in B^r(i,i+1)$ but $v\not \in B^r(i,i+1)$ is bounded by the probability that $y_{u,i}+y_{u,i+1}\geq 5r/3$, but $y_{v,i}+y_{v,i+1}< 5r/3$, or vice versa. This probability is at most $6\cdot \frac 5 3 ((y_{u,i}+y_{u,i+1})-(y_{v,i}+y_{v,i+1}))\leq 10(|y_{u,i}-y_{v,i}|+|y_{u,i+1}-y_{v,i+1}|)$. Therefore, overall, the probability that $e=(u,v)$ belongs to the cut is at most:

\[\sum_{i=1}^k10 |y_{u,i}-y_{v,i}|+\sum_{i=1}^k 10(|y_{u,i}-y_{v,i}|+|y_{u,i+1}-y_{v,i+1}|)\leq 10 \norm{y_u-y_v}_1+20\norm{y_u-y_v}_1=30\norm{y_u-y_v}_1\]

\end{proof}

We now show how to find the assignment $F(C)$ of faces of ${\mathcal{F}}$ to all clusters $C\in {\mathcal{C}}$, together with the partition ${\mathcal{Q}}(C)$ of the vertices of $C$. We will reduce this problem to an instance of the min-uncut problem. Recall that the input to the min-uncut problem is a collection $X$ of Boolean variables, together with a collection $\Psi$ of constraints. Each constraint $\psi\in \Psi$ has non-negative weight $w_{\psi}$, and involves exactly two variables of $X$. All constraints $\psi\in \Psi$ are required to be of the form $x\neq y$, for $x,y\in X$.
The goal is to find an assignment to all variables of $X$, to minimize the total weight of unsatisfied constraints. Agarwal et. al.~\cite{ACMM} have shown an $O(\sqrt{\log n})$-approximation algorithm for Min Uncut.

Fix any pair $C,C'\in {\mathcal{C}}$ of clusters, and a face $F\in {\mathcal{F}}$, such that $\delta(C),\delta(C')\subseteq \gamma(F)$.  Let $E'_{C,C'}$ denote the union of the sets $E_{C,C'}$ and $E_{C',C}$ of edges from Theorem~\ref{thm: conflict resolution for 2 clusters}, and let $w_{C,C'}=|E'(C,C')|$, $w_{C,C'}\leq 60\operatorname{cr}_{\tilde{\phi}}(E(C),E(C'))$.

For each face $F\in {\mathcal{F}}$, we denote by ${\mathcal{C}}(F)\subseteq {\mathcal{C}}$ the set of all clusters $C\in {\mathcal{C}}$, of the first type, for which $\delta(C)\subseteq \delta(F)$. Recall that for each such cluster, $F^*_C=F$ must hold.
Let $E'(F)=\bigcup_{C,C'\in {\mathcal{C}}(F)}E'_{C,C'}$, and let $w_F=|E'(F)|$.

Let ${\mathcal{P}}$ be the set of all maximal $2$-paths in $K$. For every path $P\in {\mathcal{P}}$, we denote by ${\mathcal{C}}(P)\subseteq {\mathcal{C}}$ the set of all type-2 clusters $C$, for which $\delta(C)\subseteq P$. Let $F_1(P),F_2(P)$ be the two faces of $K$, whose boundaries contain $P$. Recall that for each $C\in {\mathcal{C}}(P)$, $F^*_C\in \set{F_1(P),F_2(P)}$.

For every $C\in {\mathcal{C}}(P)$, $F\in \set{F_1(C),F_2(C)}$, let $w_{C,F}=\sum_{C'\in {\mathcal{C}}(F)}w_{C,C'}$. If we decide to assign $C$ to face $F_1(P)$, then we will pay $w_{C,F_1(P)}$ for this assignment, and similarly, if $C$ is assigned to face $F_2(P)$, we will pay  $w_{C,F_2(P)}$.

We now set up an instance of the min-uncut problem, as follows. The set of variables $X$ contains, for each path $P\in {\mathcal{P}}$, for each $F\in \set{F_1(P),F_2(P)}$, a Boolean variable $y_{P,F}$, and for each path $P\in {\mathcal{P}}$ and cluster $C\in {\mathcal{C}}(P)$ a Boolean variable $y_C$. Intuitively, if $y_C=y_{P,F_1(P)}$, then $C$ is assigned to $F_1(P)$, and if $y_C=y_{P,F_2(P)}$, then $C$ is assigned to $F_2(P)$. The set $\Psi$ of constraints contains constraints of three types: first, for each path $P\in {\mathcal{P}}$, we have the constraint $y_{P,F_1(P)}\neq y_{P,F_2(P)}$ of infinite weight. For each $P\in {\mathcal{P}}$, for each pair $C,C'\in {\mathcal{C}}(P)$ of clusters, there is a constraint $y_C\neq y_{C'}$, of weight $w_{C,C'}$. Finally, for each $P\in {\mathcal{P}}$, $F\in \set{F_1(P),F_2(P)}$, and for each $C\in {\mathcal{C}}(P)$, we have a constraint $y_C\neq y_{P,F}$ of weight $w_{C,F}$.

\begin{claim}
There is a solution to the min-uncut problem, whose cost, together with $\sum_{F\in {\mathcal{F}}}w_F$, is bounded by $60\operatorname{cr}_{\tilde{\phi}}(G)$.
\end{claim}

\begin{proof}
We simply consider the optimal solution $\tilde{\phi}$.
For each path $P\in {\mathcal{P}}$, we assign $y_{P,F_1(P)}=0$ and $y_{P,F_2(P)}=1$. For each cluster $C\in {\mathcal{C}}(P)$, if $F^*(C)=F_1(P)$, then we set $y_C=y_{P,F_1(P)}$, and otherwise we set $y_C=y_{P,F_2(P)}$. From Theorem~\ref{thm: conflict resolution for 2 clusters}, for every pair $C,C'$ of clusters with $F^*_C=F^*_{C'}$, $w_{C,C'}\leq 60\operatorname{cr}_{\tilde{\phi}}(C,C')$.
\end{proof}

We can therefore find an $O(\sqrt{\log n})$-approximate solution to the resulting instance of the min-uncut problem, using the algorithm of~\cite{ACMM}. This solution naturally defines an assignment of faces to clusters. Namely, if $C$ is a type-1 cluster, then we let $F(C)=F$, where $F$ is the unique face with $\delta(C)\subseteq \gamma(F)$. If $C$ is a type-2 cluster, and $C\in {\mathcal{C}}(P)$, for some path $P\in {\mathcal{P}}$, then we assign $C$ to $F_1(P)$ if $y_C=y_{P,F_1(P)}$, and we assign it to $F_2(C)$ otherwise. If $C$ is a type-3 cluster, then we assign it to any face that contains the unique vertex in $\delta(C)$.

For each face $F$, let ${\mathcal{C}}'(F)$ denote all clusters $C$ that are assigned to $C$. Let $\tilde E(F)$ denote the union of the sets $E'_{C,C'}$ of edges for all $C,C'\in {\mathcal{C}}'(F)$, and let $\tilde E=\bigcup_{F\in{\mathcal{F}}}\tilde E(F)$.

For each cluster $C\in {\mathcal{C}}$, we now obtain a partition ${\mathcal{Q}}'(C)$ of its vertices that corresponds to the connected components of graph $C\setminus \tilde E$. For each $Q\in {\mathcal{Q}}'(C)$, we let $Q$ denote both the set of vertices in the connected component of $C\setminus \tilde{E}$, and the sub-graph of $\tilde{G}$ induced by $Q$.
From Theorem~\ref{thm: conflict resolution for 2 clusters}, we are guaranteed that for every face $F\in {\mathcal{F}}$, for all $C,C'\in {\mathcal{C}}'_F$, if $Q\in {\mathcal{Q}}'(C)$ and $Q'\in {\mathcal{Q}}'(C')$, then $Q$ and $Q'$ are independent.

It is however possible that for some $C\in {\mathcal{C}}$, there is a pair $Q,Q'\in {\mathcal{Q}}'(C)$ of clusters, such that there is a conflict between $Q$ and $Q'$. In order to avoid this, we perform the following grouping procedure: For each $F\in{\mathcal{F}}$, for each $C\in {\mathcal{C}}'_F$, while there is a pair $Q,Q'\in {\mathcal{Q}}(C)$ of clusters that are not independent, remove $Q,Q'$ from ${\mathcal{Q}}'(C)$, and replace them with $Q\cup Q'$.
For each $C\in {\mathcal{C}}$, let ${\mathcal{Q}}(C)$ be the resulting partition of the vertices of $C$. Clearly, each pair $Q,Q'\in {\mathcal{Q}}(C)$ is independent.

\begin{claim}
For each $F\in {\mathcal{F}}$, for each pair $C,C'\in {\mathcal{C}}'(F)$ of clusters, and for each $Q\in {\mathcal{Q}}(C), Q'\in {\mathcal{Q}}(C')$, clusters $Q$ and $Q'$ are independent.\end{claim}

\begin{proof}
Consider the partitions ${\mathcal{Q}}'(C)$, ${\mathcal{Q}}'(C')$, as they change throughout the grouping procedure. Before we have started the grouping procedure, every pair $Q\in {\mathcal{Q}}'(C)$, $Q'\in {\mathcal{Q}}'(C')$ was independent. Consider the first step in the grouping procedure, such that this property held for ${\mathcal{Q}}'(C),{\mathcal{Q}}'(C')$ before this step, but does not hold anymore after this step. Assume w.l.o.g. that the grouping step was performed on a pair $Q_1,Q_2\in {\mathcal{Q}}'(C)$. Since no other clusters in ${\mathcal{Q}}'(C)$ or ${\mathcal{Q}}'(C')$ were changed, there must be a cluster $Q'\in {\mathcal{Q}}'(C')$, such that both pairs $Q_1,Q'$ and $Q_2,Q'$ are independent, but $Q_1\cup Q_2$ and $Q'$ are not independent. We now show that this is impossible.

Let $\Sigma$ be the partitioning of $\gamma(F)$ defined by the vertices of $\delta(Q')$. Since $Q_1$ and $Q'$ are independent, there is a segment $\sigma\in \Sigma$, such that $\delta(Q_1)\subseteq \sigma$. Similarly, since $Q_2$ and $Q'$ are independent, there is a segment $\sigma'\in \Sigma$, such that $\delta(Q_2)\subseteq \sigma'$. However, since $Q_1$ and $Q_2$ are not independent, $\sigma=\sigma'$ must hold. But then all vertices of $\delta(Q_1\cup Q_2)$ are contained in the segment $\sigma\in \Sigma$, contradicting the fact that $(Q_1\cup Q_2)$ and $Q'$ are not independent.
\end{proof}

To summarize, we have shown how to find an assignment $F(C)\in \set{F_1(C),F_2(C)}$ for every cluster $C\in {\mathcal{C}}$, and a partition ${\mathcal{Q}}(C)$ of the vertices of every cluster $C$, such that for every face $F\in {\mathcal{F}}$, every pair $Q,Q'\in {\mathcal{Q}}(F)$ of clusters is independent. Moreover, if $E^*$ denotes the subset of edges $E_{\tilde{G}}(Q,Q')$ for all $Q,Q'\in {\mathcal{Q}}$, then we have ensured that $|E^*|\leq O(\sqrt{\log n})\operatorname{cr}_{\tilde {\phi}}(\tilde{G})=O(\sqrt{\log n})\operatorname{cr}_{\phi'}(G)$, and set $E^*$ does not contain edges of grids $Z\in {\mathcal{Z}}$, or artificial edges. Therefore, the conditions of Theorem~\ref{thm: no conflict case} hold.

We now define the set $\edges h(G)$, as follows: $\edges h(G)=E'\cup E''\cup E^*$.
Recall that $|E'|\leq O(\mathsf{OPT}^2\rhod_{\mbox{\textup{\footnotesize{max}}}})$, $|E''|\leq O\left(\frac{\mathsf{OPT}^2\cdot\rho\cdot\log^2n\cdotd_{\mbox{\textup{\footnotesize{max}}}}^2\cdot\ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }{\alpha^*}\right )$, and $|E^*|\leq O(\sqrt{\log n})\operatorname{cr}_{\phi'}(G)$. Therefore,

\[|\edges h(G)|\leq  O\left(\frac{\mathsf{OPT}^2\cdot\rho\cdot\log^2n\cdotd_{\mbox{\textup{\footnotesize{max}}}}^2\cdot\ensuremath{\beta_{\mbox{\textup{\footnotesize{FCG}}}}} }{\alpha^*}\right )+O(\sqrt{\log n})\operatorname{cr}_{\phi'}(G)\leq m^*.\]

 We also set $\edges h=\bigcup_{G\in\set{G_1^X,\ldots,G_{k_h}^X}}\edges h(G)$, so $|\edges h|\leq m^*\cdot \mathsf{OPT}$ as required.

We now define a collection ${\mathcal{G}}_{h+1}$ of instances. Recall that for all $1\leq i\leq k_h$, this collection already contains the instance $\pi(G_i',\emptyset,{\mathcal{Z}})$. Let $G=G_i^X$, and $Q\in {\mathcal{Q}}$.
Let $Q'$ denote the subset of vertices of $Q$ without the artificial vertices, and let $H_Q$ be the sub-graph of $\H$ induced by $Q\cup X_Q$. We then add the instance $\pi_G(H_Q,X_Q,{\mathcal{Z}})$ to ${\mathcal{G}}_{h+1}(G)$.
This finishes the definition of the set ${\mathcal{G}}'_{h+1}$. From Theorem~\ref{thm: no conflict case}, for each $1\leq i\leq k_h$, there is a strong solution to each resulting sub-instance of $G_i^X$, such that the total cost of these solutions is at most $\operatorname{cr}_{\phi_i}(G_i^X)$. Clearly, $\phi_i$ also induces a strong solution to instance $\pi(G_i',\emptyset,{\mathcal{Z}})$ of cost $\operatorname{cr}_{\phi_i}(G_i')$. Therefore, there is a strong solution for each instance in ${\mathcal{G}}_{h+1}$ of total cost at most $\sum_{i=1}^{k_h}\operatorname{cr}_{\phi_i}(G_i)\leq \mathsf{OPT}$, and so the number of instances in ${\mathcal{G}}_{h+1}$, for which $\emptyset$ is not a feasible weak solution is bounded by $\mathsf{OPT}$. We let ${\mathcal{G}}'_{h+1}\subseteq {\mathcal{G}}_{h+1}$ denote the set of all instances for which $\emptyset$ is not a feasible solution. Observe that we can efficiently verify whether $\emptyset$ is a feasible solution for a given instance, so we can compute ${\mathcal{G}}'_{h+1}$ efficiently. We now claim that ${\mathcal{G}}'_{h+1}$ is a valid input to the next iteration, except that it may not satisfy Invariant~(\ref{invariant 2: canonical}) due to the grid sets ${\mathcal{Z}}''(G)$ -- we deal with this issue at the end of this section.

 We have already established Invariant~(\ref{invariant 3: there is a cheap solution}) in the above discussion.
 Also, from Theorem~\ref{thm: no conflict case}, if we find a weak feasible solution $\tilde{E}_H$ for each instance $H\in {\mathcal{G}}_{h+1}$, then the union of these solutions, together with $\edges h$, gives a weak feasible solution to all instances $\pi(G_i,X_i,{\mathcal{Z}}_i)$ for $1\leq i\leq k_h$, thus giving Invariant~(\ref{invariant 4: any weak solution is enough}).
In order to establish Invariant~(\ref{invariant 4.5: number of edges removed so far}), observe that the number of edges in $\edges h$, incident on any new instance is bounded by the maximum number of edges in $\edges h$ that belong to any original instance $G_1,\ldots,G_{k_h}$, which is bounded by $m^*$, and the total number of edges in $\edges h$ is bounded by $m^*\cdot \mathsf{OPT}$. Invariant~(\ref{invariant 5: bound on size}) follows from the fact that for each $1\leq i\leq k_h$, $|V(G_i')|\leq n_h$, and these graphs have empty bounding boxes. All sub-instances of $G_i^X$ were constructed by further partitioning the clusters in $G_i^X\setminus (K_i\cup E'')$, and each such cluster contains at most $n_{h+1}$ vertices. Invariant~(\ref{invariant 1: disjointness}) is immediate, as is Invariant~(\ref{invariant 2: proper subgraph}) (recall that we have ensured that all edges in $E',E'',E^*$ connect vertices in distinct sub-instances). Finally, if we assume that ${\mathcal{Z}}''(G)=\emptyset$ for all $G\in \set{G_1,\ldots,G_{k_h}}$, then the resulting sub-instances are canonical, as we have ensured that the edges in sets $E',E'',E^*$ do not belong to the grids $Z\in {\mathcal{Z}}$, thus giving Invariant~(\ref{invariant 2: canonical}). Therefore, we have shown how to produce a valid input to the next iteration, for the case where ${\mathcal{Z}}''(G)=\emptyset$ for all $G\in \set{G_1,\ldots,G_{k_h}}$. It now only remains to show how to deal with the grids in sets ${\mathcal{Z}}''(G)$.

\paragraph{Dealing with grids in sets ${\mathcal{Z}}''(G)$}
Let $G\in \set{G_1^X,\ldots,G_{k_h}^X}$, and let $Z\in {\mathcal{Z}}''(G)$. Recall that this means that $Z\cap K$ is a simple path, that we denote by $P_Z$, and in particular, $K$ contains exactly two edges of $\operatorname{out}(Z)$, that we denote by $e_Z$ and $e'_Z$.

The difficulty in dealing with such grids is that, on the one hand, we need to ensure that all new sub-instances are canonical, so we would like to add such grids to the skeleton $K$. On the other hand, since $Z\cap K$ is a simple path, graph $K\cup Z$ is not rigid, and has 2 different planar drawings (obtained by ``flipping'' $Z$ around the axis $P_Z$), so we cannot claim that we can efficiently find the optimal drawing $\phi'_{K\cup Z}$ of $K\cup Z$. Our idea in dealing with this problem is that we use the conflict resolution procedure to establish which face of the skeleton $K$ each such grid $Z\in{\mathcal{Z}}''(G)$ must be embedded in. Once this face is established, we can simply add $Z$ to $K$. Even though the resulting skeleton is not rigid, its drawing is now fixed.

More specifically, let $Z\in {\mathcal{Z}}''(G)$ be any such grid, and let $v,v'$ be the two vertices in the first row of $Z$ adjacent to the edges $e_z$ and $e'_z$, respectively. We start by replacing the path $P_Z$ in the skeleton $K$, with the unique path connecting $v$ and $v'$ that only uses the edges of the first row of $Z$. Let $P'_Z$ denote this path. We perform this transformation for each $Z\in {\mathcal{Z}}''(G)$. The resulting skeleton $K$ is still rigid and good. It is now possible that the size of some connected component of $G\setminus (K\cup E'')$ becomes larger. However, since we eventually add all vertices of all such grids $Z\in {\mathcal{Z}}''(G)$ to the skeleton, this will not affect the final outcome of the current iteration.

We then run the conflict resolution procedure exactly as before, and obtain the collection ${\mathcal{G}}_{h+1}$ of new instances as before. Consider some such instance $\pi(H_Q,X_Q,{\mathcal{Z}})$, and assume that $H_Q$ is a sub-graph of $G\in\set{G_1^X,\ldots,G^X_{k_h}}$. Let $Q=H_Q\setminus X_Q$. From the above discussion, $Q$ is canonical w.r.t. ${\mathcal{Z}}\setminus {\mathcal{Z}}''(G)$. The only problem is that for some grids $Z\in {\mathcal{Z}}''(G)$, $Q$ may contain the vertices of $Z\setminus P'_Z$. This can only happen if $P'_Z$ belongs to the bounding box $X_Q$. Recall that we are guaranteed that there is a strong solution to instance $\pi(H_Q,X_Q,{\mathcal{Z}})$, and the total cost of all such solutions over all instances in ${\mathcal{G}}_{h+1}$ is at most $\mathsf{OPT}$. In particular, the edges of $Z$ do not participate in crossings in this solution. Therefore, we can simply consider the grid $Z$ to be part of the skeleton, remove its vertices from $Q$, and update the bounding box of the resulting instance if needed.
In other words, the conflict resolution procedure, by assigning every cluster $C\in {\mathcal{C}}$ to a face of ${\mathcal{F}}$, has implicitly defined a drawing of the graph $K\cup(\bigcup_{Z\in{\mathcal{Z}}''(G)}Z)$. Even though this drawing may be different from the drawing induced by $\phi'$, we are still guaranteed that the resulting sub-problems all have strong feasible solutions of total cost bounded by $\mathsf{OPT}$. The final instances in ${\mathcal{G}}'_{h+1}$ are now guaranteed to satisfy all Invariants~(\ref{invariant 1: disjointness})--(\ref{invariant 5: bound on size}).

\section{Conclusions} \label{sec: conclusions}
We have shown an efficient randomized algorithm to find a drawing of any graph ${\mathbf{G}}$ in the plane with at most $O\left ((\optcro{{\mathbf{G}}})^{10}\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)\right )$ crossings. We did not make an effort to optimize the powers of $\mathsf{OPT},d_{\mbox{\textup{\footnotesize{max}}}}$ and $\log n$ in this guarantee, or the constant hidden in the $O(\cdot)$ notation, and we believe that they can be improved. We hope that the technical tools developed in this paper will help obtain better algorithms for the {\sf Minimum Crossing Number}\xspace problem. A specific possible direction is obtaining efficient algorithms for $\rho$-balanced $\alpha$-well-linked bi-partitions. In particular, an interesting open question is whether there is an efficient algorithm, that, given an $n$-vertex graph $G$ with maximum degree $d_{\mbox{\textup{\footnotesize{max}}}}$, finds a $\rho$-balanced $\alpha$-well-linked bi-partition of $G$, for $\rho,\alpha=\operatorname{poly}(d_{\mbox{\textup{\footnotesize{max}}}}\cdot \log n)$. In fact it is not even clear whether such a bi-partition exists in every graph.
We note that the dependence of $\rho$ on $d_{\mbox{\textup{\footnotesize{max}}}}$ is necessary, for example, in the star graph. This question appears to be interesting in its own right, and its positive resolution would greatly simplify our algorithm and improve its performance guarantee. We also note that if we only require that one of the two sets in the bi-partition is well-linked, then there is an efficient algorithm for finding such bi-partitions, similarly to the proof of Theorem~\ref{thm: initial partition}.

\paragraph{Acknowledgements.} The author thanks Yury Makarychev and Anastasios Sidiropoulos for many fruitful discussions, and for reading earlier drafts of the paper.
\label{------------------------------------------------Start Appendix------------------------------------------------------------------------}