Minimum Perimeter-Sum Partitions in the Plane

Abstract: Let $P$ be a set of $n$ points in the plane. We consider the problem of partitioning $P$ into two subsets $P_1$ and $P_2$ such that the sum of the perimeters of $\text{CH}(P_1)$ and $\text{CH}(P_2)$ is minimized, where $\text{CH}(P_i)$ denotes the convex hull of $P_i$. The problem was first studied by Mitchell and Wynters in 1991 who gave an $O(n^2)$ time algorithm. Despite considerable progress on related problems, no subquadratic time algorithm for this problem was found so far. We present an exact algorithm solving the problem in $O(n \log^2 n)$ time and a $(1+\varepsilon)$-approximation algorithm running in $O(n + 1/\varepsilon^2\cdot\log^2(1/\varepsilon))$ time.

\section{Introduction}
The clustering problem is to partition a given data set into clusters (that is, subsets)
according to some measure of optimality. We are interested in clustering problems where the
data set is a set~$P$ of points in Euclidean space. Most of these clustering problems fall into
one of two categories: problems where the maximum cost of a cluster is given
and the goal is to find a clustering consisting of a minimum number of clusters,
and problems where the number of clusters is given and the goal is to find
a clustering of minimum total cost. In this paper we consider a basic problem of
the latter type, where we wish to find a bipartition~$(P_1,P_2)$ of a planar point set~$P$.
Bipartition problems are not only interesting in their own right,
but also because bipartition algorithms can form the basis of hierarchical clustering methods.

There are many possible variants of the bipartition problem on planar point sets,
which differ in how the cost of a clustering is defined.
A variant that received a lot of attention is the 2-center problem~\cite{c-99,d-84,e-97,jk-94,s-97},

where the cost of a partition~$(P_1,P_2)$ of the given point set~$P$ is
defined as the maximum of the radii of the smallest enclosing disks of~$P_1$ and~$P_2$.
Other cost functions that have been studied include the maximum diameter of the two
point sets~\cite{abky-88}
and the sum of the diameters~\cite{h-92};
see also the survey by Agarwal and Sharir~\cite{as-98} for some more variants.
\medskip

A natural class of cost function considers the size of the convex hulls $\ch(P_1)$ and $\ch(P_2)$
of the two subsets, where the size of $\ch(P_i)$ can either be defined as the area of~$\ch(P_i)$
or as the perimeter $\mathrm{per}(P_i)$ of~$\ch(P_i)$. (The perimeter of~$\ch(P_i)$
is the length of the boundary~$\partial\hspace*{0.5mm}{\ch(P_i)}$.) This class of cost functions
was already studied in~1991 by Mitchell and Wynters~\cite{mw-91}.
They studied four problem variants: minimize the sum of the perimeters, the maximum of
the perimeters, the sum of the areas, or the maximum of the areas.
In three of the four variants the convex hulls $\ch(P_1)$ and
$\ch(P_2)$ in an optimal solution may intersect~\cite[full version]{mw-91}---only
in the \emph{minimum perimeter-sum problem} the optimal bipartition is guaranteed
to be a so-called \emph{line partition}, that is, a solution with disjoint convex hulls.
For each of the four variants they gave an $O(n^3)$ algorithm that uses $O(n)$ storage and that computes computes an optimal line partition; for all except the minimum area-maximum problem they also gave an $O(n^2)$ algorithm that uses $O(n^2)$ storage. Note that (only) for the minimum perimeter-sum problem the computed solution is an optimal bipartition.
Around the same time, the minimum-perimeter sum problem was studied for partitions
into~$k$ subsets for $k>2$; for this variant Capoyleas~\emph{et al.}}%\xspace~\cite{crw-91}
presented an algorithm with running time $O(n^{6k})$.
Mitchell and Wynters mentioned the improvement of the space requirement of the quadratic-time
algorithm as an open problem, and they stated the existence of a subquadratic
algorithm for any of the four variants as the most prominent open problem.

Rokne~\emph{et al.}}%\xspace~\cite{rww-92} made progress on the first question, by presenting an
$O(n^2\log n)$ algorithm that uses only~$O(n)$ space for the line-partition version of
each of the four problems. Devillers and Katz~\cite{dk-99} gave algorithms for the min-max variant
of the problem, both for area and perimeter, which run in $O((n+k)\log^2 n)$ time.
Here $k$ is a parameter that is only known to be in $O(n^2)$, although Devillers and Katz
suspected that $k$ is subquadratic. They also gave linear-time algorithms for these problems
when the point set~$P$ is in convex position and given in cyclic order.
Segal~\cite{s-02} proved an $\Omega(n\log n)$ lower bound for the min-max problems.
Very recently, and apparently unaware of some of the earlier work on these problems,
Bae~\emph{et al.}}%\xspace~\cite{bcess-2016} presented an $O(n^2\log n)$ time algorithm for the
minimum-perimeter-sum problem and an $O(n^4\log n)$ time algorithm
for the minimum-area-sum problem (considering all partitions, not only line partitions).
Despite these efforts, the main question is still open: is it possible to obtain
a subquadratic algorithm for any of the four bipartition problems based
on convex-hull size?

\subsection{Our contribution}
We answer the question above affirmatively by presenting a subquadratic algorithm
for the minimum perimeter-sum bipartition problem in the plane.

As mentioned, an optimal solution $(P_1,P_2)$ to the minimum perimeter-sum
bipartition problem must be a line partition.
A straightforward algorithm would generate all $\Theta(n^2)$ line partitions
and compute the value $\mathrm{per}(P_1)+\mathrm{per}(P_2)$ for each of them. If the latter
is done from scratch for each partition, the resulting algorithm runs
in~$O(n^3 \log n)$ time. The algorithms by Mitchell and Wynters~\cite{mw-91}
and Rokne~\emph{et al.}}%\xspace~\cite{rww-92} improve on this by using that the
different line bipartitions can be generated in an ordered way, such that subsequent
line partitions differ in at most one point. Thus the convex hulls do not have to be recomputed
from scratch, but they can be obtained by updating the convex hulls of the previous bipartition.
To obtain a subquadratic algorithm a fundamentally new approach is necessary:
we need a strategy that generates a subquadratic number of candidate partitions,
instead considering all line partitions. We achieve this as follows.

We start by proving that an optimal bipartition~$(P_1,P_2)$ has the following
property: either there is a set of~$O(1)$ canonical orientations such that
$P_1$ can be separated from $P_2$ by a line with a canonical orientation,
or the distance between $\ch(P_1)$ and $\ch(P_2)$ is~$\Omega(\min(\mathrm{per}(P_1),\mathrm{per}(P_2))$.
There are only $O(1)$ bipartitions of the former type, and finding the
best among them is relatively easy. The bipartitions of the second type are
much more challenging. We show how to employ a compressed quadtree to generate a
collection of $O(n)$ canonical 5-gons---intersections of axis-parallel rectangles and
canonical halfplanes---such that the smaller of $\ch(P_1)$ and $\ch(P_2)$
(in a bipartition of the second type) is contained in one of the 5-gons.

It then remains to find the best among the bipartitions of the second type.
Even though the number of such bipartitions is linear, we cannot afford
to compute their perimeters from scratch. We therefore design a data structure
to quickly compute $\mathrm{per}(P\cap Q)$, where $Q$ is a query canonical 5-gon.
Brass~\emph{et al.}}%\xspace~\cite{bkssv-raq-13} presented such a data structure for the case
where $Q$ is an axis-parallel rectangle. Their structure uses $O(n\log^2 n)$ space
and has $O(\log^5 n)$ query time; it can be extended to handle canonical 5-gons
as queries, at the cost of increasing the space usage to $O(n\log^3 n)$ and the query time
to~$O(\log^7 n)$. Our data structure improves upon this: it has $O(\log^4 n)$ query time for
canonical 5-gons (and $O(\log^3 n)$ for rectangles) while using the same
amount of space. Using this data structure to find the best bipartition
of the second type we obtain our main result: an exact algorithm for the
minimum perimeter-sum bipartition problem that runs in $O(n\log^4 n)$~time.
As our model of computation we use the real RAM (with the capability of taking square roots) so that we can compute the exact perimeter of a convex polygon---this is necessary to compare the costs of two competing clusterings. We furthermore make the (standard) assumption that the model of computation allows us to compute a compressed quadtree of $n$ points in $O(n\log n)$ time; see footnote 2 on page~8.

Besides our exact algorithm, we present a linear-time $(1+\varepsilon)$-approximation algorithm.
Its running time is $O(n+T(1/\varepsilon^2))=O(n + 1/\varepsilon^2\cdot \log^4 (1/\varepsilon))$, where $T(1/\varepsilon^2)$ is the running time of an exact algorithm on an instance of size $1/\varepsilon^2$.

\section{The exact algorithm}\label{se:exact-alg}
In this section we present an exact algorithm for the minimum-perimeter-sum partition
problem.  We first prove a separation property that an optimal solution must
satisfy, and then we show how to use this property to develop a fast algorithm.

Let $P$ be the set of $n$ points in the plane for which we want to solve the
minimum-perimeter-sum partition problem. An optimal
partition $(P_1,P_2)$ of~$P$ has the following two basic properties:
$P_1$ and $P_2$ are non-empty, and the convex hulls $\ch(P_1)$ and $\ch(P_2)$
are disjoint~\cite[full version]{mw-91}. In the remainder, whenever we talk about a partition of $P$,
we refer to a partition with these two properties.

\subsection{Geometric properties of an optimal partition}\label{subse:geometric}
Consider a partition $(P_1,P_2)$ of~$P$. Define
$\ensuremath{\mathcal{P}}_1:=\ch(P_1)$ and $\ensuremath{\mathcal{P}}_2:=\ch(P_2)$ to be the convex hulls of $P_1$
and $P_2$, respectively, and let $\ell_1$ and $\ell_2$ be the two inner common tangents of~$\ensuremath{\mathcal{P}}_1$ and~$\ensuremath{\mathcal{P}}_2$.
The lines $\ell_1$ and $\ell_2$ define four wedges: one containing $P_1$,
one containing~$P_2$, and two empty wedges. We call the opening angle of the
empty wedges the \emph{separation angle} of $P_1$ and $P_2$. Furthermore, we
call the distance between $\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$ the
\emph{separation distance} of $P_1$ and~$P_2$.
\begin{theorem}\label{th:separation-property}
Let $P$ be a set of $n$ points in the plane, and let $(P_1,P_2)$ be a partition of $P$
that minimizes $\mathrm{per}(P_1) + \mathrm{per}(P_2)$. Then the separation angle of $P_1$ and $P_2$
is at least $\pi/6$ or the separation distance is at least
$c_{\sep} \cdot \min(\mathrm{per}(P_1),\mathrm{per}(P_2))$, where $c_{\sep}:= 1/250$.
\end{theorem}
The remainder of this section is devoted to proving Theorem~\ref{th:separation-property}.
To this end let $(P_1,P_2)$ be a partition of $P$
that minimizes $\mathrm{per}(P_1) + \mathrm{per}(P_2)$.
Let $\ell_3$ and $\ell_4$ be the outer common tangents of
$\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$. We define~$\alpha$ to be the angle between $\ell_3$
and $\ell_4$. More precisely, if $\ell_3$ and $\ell_4$ are parallel
we define $\alpha := 0$, otherwise we define $\alpha$ as the opening angle
of the wedge defined by $\ell_3$ and $\ell_4$ containing $\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$.
We denote the separation angle of $P_1$ and $P_2$ by~$\beta$; see Fig.~\ref{fig:exact}.
\begin{figure}
\begin{center}
\includegraphics{figures/exact}
\end{center}
\caption{The angles $\alpha$ and $\beta$.}
\label{fig:exact}
\end{figure}

The idea of the proof is as follows. Suppose that the separation
distance and the separation angle~$\beta$ are both relatively small. Then the region $A$
in between $\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$  and bounded from the bottom by $\ell_3$ and
from the top by $\ell_4$ is relatively narrow.
But then the left and right parts of $\partial\hspace*{0.5mm} A$ (which are contained in $\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_1$ and $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_2$) would be longer than the bottom and
top parts of $\partial\hspace*{0.5mm} A$ (which are contained in $\ell_3$ and $\ell_4$),
thus contradicting that $(P_1,P_2)$ is an optimal partition.
To make this idea precise, we first prove that if the separation angle~$\beta$ is small, then the angle $\alpha$
between $\ell_3$ and $\ell_4$ must be large. Second, we show that there is a value $f(\alpha)$ such that
the distance between $\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$ is at least $f(\alpha)\cdot \min(\mathrm{per}(P_1),\mathrm{per}(P_2))$.
Finally we argue that this implies that if the separation angle is smaller than $\pi/6$, then (to avoid the
contradiction mentioned above) the separation distance must be relatively large.
Next we present our proof in detail.

Let $c_{ij}$ be the intersection point between $\ell_i$ and $\ell_j$, where~$i<j$.
If $\ell_3$ and $\ell_4$ are parallel,
we choose $c_{34}$ as a point at infinity on $\ell_3$.
Assume without loss of generality that neither $\ell_1$ nor $\ell_2$
separate $\ensuremath{\mathcal{P}}_1$ from $c_{34}$, and that
$\ell_3$ is the outer common tangent such that $\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$ are
to the left of $\ell_3$ when traversing $\ell_3$
from $c_{34}$ to an intersection
point in $\ell_3\cap \ensuremath{\mathcal{P}}_1$.
Assume furthermore that
$c_{13}$ is closer to $c_{34}$ than $c_{23}$.

For two lines, rays, or segments
$r_1,r_2$, let $\angle(r_1,r_2)$ be the angle we need to rotate $r_1$ in
counterclockwise direction until $r_1$ and $r_2$ are parallel.
For three points $a,b,c$, let $\angle (a,b,c):=\angle (ba,bc)$.
For $i=1,2$ and $j=1,2,3,4$, let $s_{ij}$ be a point in $P_i\cap \ell_j$.
Let $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_i$ denote the boundary of $\ensuremath{\mathcal{P}}_i$ and
$\per{\ensuremath{\mathcal{P}}_i}$ the perimeter of $\ensuremath{\mathcal{P}}_i$. Furthermore, let $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_i(x,y)$ denote the
portion of $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_i$ from $x\in\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_i$ counterclockwise to $y\in\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_i$,
and $\perPart{\ensuremath{\mathcal{P}}_i}xy$ denote the length of $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_i(x,y)$.

\begin{lemma}\label{bigAngles} We have
$\alpha+3\beta\geq\pi$.
\end{lemma}
\begin{proof}
Since $\per {\ensuremath{\mathcal{P}}_1}+\per {\ensuremath{\mathcal{P}}_2}$ is minimum, we know that
\[
    \perPart {\ensuremath{\mathcal{P}}_1}{s_{13}}{s_{14}}+\perPart {\ensuremath{\mathcal{P}}_2}{s_{24}}{s_{23}}
    \ \leq\  \Psi,
\]
where
$\Psi:=
\mathrm{dist}{s_{13}}{s_{23}}+\mathrm{dist}{s_{14}}{s_{24}}$.
Furthermore, we know that
$s_{11},s_{12}\in\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_1(s_{13},s_{14})$ and
$s_{21},s_{22}\in\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_1(s_{24},s_{23})$. We thus have
\[
    \perPart {\ensuremath{\mathcal{P}}_1}{s_{13}}{s_{14}}+\perPart{\ensuremath{\mathcal{P}}_2}{s_{24}}{s_{23}}
    \ \geq\ \Phi,
\]
where
$
\Phi:=
\mathrm{dist}{s_{13}}{s_{11}}+\mathrm{dist}{s_{11}}{s_{12}}+\mathrm{dist}{s_{12}}{s_{14}}+
\mathrm{dist}{s_{24}}{s_{21}}+\mathrm{dist}{s_{21}}{s_{22}}+\mathrm{dist}{s_{22}}{s_{23}}$.
Hence, we must have
\begin{equation}\label{ineq}
\Phi\ \leq\ \Psi.
\end{equation}
Now assume that $\alpha+3\beta<\pi$. We will show that this assumption,
together with inequality~(\ref{ineq}), leads to a contradiction, thus proving the lemma.
To this end we will argue that if \eqref{ineq} holds, then
it must also hold when
(i) $s_{21}$ or $s_{22}$ coincides with $c_{12}$, and
(ii) $s_{11}$ or $s_{12}$ coincides with $c_{12}$.
To finish the proof it then suffices to observe that that if (i) and (ii) hold,
then $\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$ touch in $c_{12}$ and so
\eqref{ineq} contradicts the triangle inequality.
\medskip

It remains to argue that if \eqref{ineq} holds, then we can create
a situation where \eqref{ineq} holds and (i) and (ii) hold as well.
To this end we ignore that the points $s_{ij}$ are specific points in the
set~$P$ and allow the point~$s_{ij}$ to move on the tangent~$\ell_j$,
as long as the movement preserves~\eqref{ineq}.
Moving $s_{13}$ along $\ell_3$ away from $s_{23}$ increases
$\Psi$ more than it increases $\Phi$, so \eqref{ineq} is preserved.
Similarly, we can move $s_{14}$ away from $s_{24}$, $s_{23}$ away from
$s_{13}$, and $s_{24}$ away from $s_{14}$.

We first show how to create a situation where (i) holds, and \eqref{ineq} still holds as well.
Let $\gamma_{ij}:= \angle(\ell_i,\ell_j)$. We consider two cases.
\begin{itemize}}%{\begin{itemize}\setlength{\itemsep}{-\parskip}
\item \emph{Case~(A): $\gamma_{32}<\pi-\beta$.}

    Note that $\angle (xs_{23},\ell_2)\geq \gamma_{32}$
    for any $x\in s_{22}c_{12}$. However, by moving
    $s_{23}$ sufficiently far away we can make $\angle (xs_{23},\ell_2)$
    arbitrarily close to $\gamma_{32}$, and we can ensure that
    $\angle (xs_{23},\ell_2) <\pi-\beta$ for any point~$x\in s_{22}c_{12}$.
    We now let the point $x$ move at unit speed from $s_{22}$ towards $c_{12}$.
    To be more precise, let $T:=\mathrm{dist}{s_{22}}{c_{12}}$, let
    $\mathbf v$ be the unit vector with direction from $c_{23}$ to $c_{12}$,
    and for any $t\in[0,T]$ define $x(t):= s_{22}+t\cdot \mathbf v$.
    Note that $x(0)=s_{22}$ and $x(T)=c_{12}$.

    Let $a(t):= \mathrm{dist}{x(t)}{s_{23}}$ and
    $b(t):= \mathrm{dist}{x(t)}{s_{21}}$.
    Lemma \ref{movingPoint} in the appendix gives that
    \[
    a'(t)=-\cos(\angle(x(t)s_{23},\ell_2)) \mbox{ and }
    b'(t)=\cos(\angle(\ell_2,x(t)s_{21})).
    \]
    Since $\angle (x(t)s_{23},\ell_2) <\pi-\beta$ for any value
    $t\in[0,T]$, we get $a'(t)< -\cos(\pi-\beta)$.
    Furthermore, we have $\angle(\ell_2,x(t)s_{21})\geq \pi-\beta$ and hence
    $b'(t)\leq \cos(\pi-\beta)$.
    Therefore, $a'(t)+b'(t)< 0$ for any $t$ and we conclude that
    $a(T)+b(T)\leq a(0)+b(0)$. This is the same as
    $\mathrm{dist}{s_{21}}{c_{12}}+\mathrm{dist}{c_{12}}{s_{23}}\leq
    \mathrm{dist}{s_{21}}{s_{22}}+\mathrm{dist}{s_{22}}{s_{23}}$,
    so \eqref{ineq} still holds when we substitute $s_{22}$ by~$c_{12}$.
\item \emph{Case~(B): $\gamma_{32}\geq\pi-\beta$.} \\[2mm]
    Using our assumption $\alpha+3\beta<\pi$ we get $\gamma_{32}> \alpha+2\beta$.
    Note that $\gamma_{14}=\pi-\gamma_{32}+\alpha+\beta$.
    Hence, $\gamma_{14}<\pi-\beta$.
    By moving $s_{24}$ and $s_{21}$, we can in a similar way as in Case~(A)
    argue that \eqref{ineq} still holds when we substitute $s_{21}$ by $c_{12}$.
\end{itemize}
We conclude that in both cases we can ensure~(i) without violating~\eqref{ineq}.

Since $\gamma_{42}\leq \gamma_{32}$ and $\gamma_{13}\leq\gamma_{14}$,
we likewise have $\gamma_{42}<\pi-\beta$ or
$\gamma_{13}<\pi-\beta$. Hence, we can substitute
$s_{11}$ or $s_{12}$ by $c_{12}$ without violating~\eqref{ineq},
thus ensuring (ii) and finishing the proof.
\end{proof}

Let $\textrm{dist}(\ensuremath{\mathcal{P}}_1,\ensuremath{\mathcal{P}}_2):=\textrm{min}_{(p,q)\in \ensuremath{\mathcal{P}}_1\times \ensuremath{\mathcal{P}}_2}\mathrm{dist} pq$
denote the separation distance between $\ensuremath{\mathcal{P}}_1$ and~$\ensuremath{\mathcal{P}}_2$. Recall that $\alpha$
denotes the angle between the two common outer tangents of
$\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$; see Fig.~\ref{fig:exact}
\begin{lemma}\label{distanceLemma} We have
\begin{equation}\label{distIneq}
\textrm{dist}(\ensuremath{\mathcal{P}}_1,\ensuremath{\mathcal{P}}_2)\ \geq\ f(\alpha) \cdot \per {\ensuremath{\mathcal{P}}_1},
\end{equation}
where $f\colon [0,\pi]\longrightarrow\mathbb R$ is the increasing function
\[
    f(\varphi)
    \ :=\
    \frac{\sin (\varphi/4)}{1+\sin (\varphi/4)}
    \cdot
    \frac{\sin (\varphi/2)}{1+\sin (\varphi/2)}
    \cdot
\frac{1-\cos (\varphi/4)}2.
\]
\end{lemma}
\begin{proof}
The statement is trivial if $\alpha=0$ so assume $\alpha>0$.
Let $p\in \ensuremath{\mathcal{P}}_1$ and $q\in \ensuremath{\mathcal{P}}_2$ be points so that
$\mathrm{dist} pq=\textrm{dist}(\ensuremath{\mathcal{P}}_1,\ensuremath{\mathcal{P}}_2)$ and assume
without loss of generality that $pq$ is a horizontal segment with $p$
being its left endpoint.
Let $\ellvert 1$ and $\ellvert 2$
be vertical lines containing $p$ and $q$, respectively.
Note that $\ensuremath{\mathcal{P}}_1$ is in the closed half-plane to the left of $\ellvert 1$ and
$\ensuremath{\mathcal{P}}_2$ is in the closed half-plane to the right of $\ellvert 2$.
Recall that $s_{ij}$ denotes a point on $\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_i \cap\ell_j$.
\begin{figure}
\begin{center}
\includegraphics{figures/distanceLemma}
\end{center}
\caption{Illustration for the proof of Lemma~\protect\ref{distanceLemma}.}
\label{fig:distanceLemma}
\end{figure}

\mypara{Claim:} There exist two convex polygons $\ensuremath{\mathcal{P}}'_1$ and $\ensuremath{\mathcal{P}}'_2$
satisfying the following conditions:
\myenumerate{
\item
$\ensuremath{\mathcal{P}}'_1$ and $\ensuremath{\mathcal{P}}'_2$ have the same outer common tangents as $\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$, namely $\ell_3$ and $\ell_4$.
\label{prop:a}

\item
$\ensuremath{\mathcal{P}}'_1$ is to the left of $\ellvert 1$ and $p\in\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}'_1$; and
$\ensuremath{\mathcal{P}}'_2$ is to right of $\ellvert 2$ and $q\in\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}'_2$.
\label{prop:b}

\item
$\per{\ensuremath{\mathcal{P}}'_1}=\per{\ensuremath{\mathcal{P}}_1}$.
\label{prop:c}

\item
$\per{\ensuremath{\mathcal{P}}'_1}+\per{\ensuremath{\mathcal{P}}'_2}\leq\per{\ch(\ensuremath{\mathcal{P}}'_1\cup\ensuremath{\mathcal{P}}'_2)}$.
\label{prop:d}

\item
There are points $s'_{ij}\in\ensuremath{\mathcal{P}}'_i\cap\ell_j$ for all $i\in\{1,2\}$ and $j\in\{3,4\}$
such that $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}'_1(s'_{13},p)$, $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}'_1(p,s'_{14})$,
$\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}'_2(s'_{24},q)$, and $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}'_2(q,s'_{23})$ each consist
of a single line segment.
\label{prop:e}

\item
Let $s'_{2j}(\lambda):= s'_{2j}-(\lambda,0)$
and let $\ell'_j(\lambda)$ be the line through $s'_{1j}$ and
$s'_{2j}(\lambda)$ for $j\in\{3,4\}$.
Then $\angle(\ell'_3(\mathrm{dist} pq),\ell'_4(\mathrm{dist} pq))\geq\alpha/2$.
\label{prop:f}
}

\begin{proof}[Proof of the claim]
Let $\ensuremath{\mathcal{P}}_1':=\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2':=\ensuremath{\mathcal{P}}_2$, and let
$s_{ij}'$ be a point in $\ensuremath{\mathcal{P}}_i'\cap\ell_j$ for all $i\in\{1,2\}$ and $j\in\{3,4\}$.
We show how to modify $\ensuremath{\mathcal{P}}_1'$ and $\ensuremath{\mathcal{P}}_2'$ until they
have all the required conditions. Of course,
they already satisfy conditions \ref{prop:a}--\ref{prop:d}.
We first show how to obtain condition \ref{prop:e}, namely
that $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_1'(s_{13}',p)$
and $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_1'(p,s_{14}')$---and similarly $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_2'(s_{24}',q)$
and $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_1'(q,s_{23}')$---each consist of a single line segment,
as depicted in Fig.~\ref{fig:distanceLemma}.
To this end, let $v_{ij}$ be the intersection point $\ellvert i\cap \ell_j$ for
$i\in\{1,2\}$ and $j\in\{3,4\}$. Let $s'\in s_{14}'v_{14}$ be the point such that
$\perPart{\ensuremath{\mathcal{P}}_1'}{p}{s_{14}'}=\mathrm{dist} p{s'}+\mathrm{dist}{s'}{s_{14}'}$. Such a point exists since
\[
    \mathrm{dist} p{s_{14}'}
    \ \leq\ \perPart{\ensuremath{\mathcal{P}}_1'}{p}{s_{14}'}
    \ \leq\ \mathrm{dist} p{v_{14}}+\mathrm{dist}{v_{14}}{s_{14}'}.
\]
We modify $\ensuremath{\mathcal{P}}_1'$ by substituting $\partial\hspace*{0.5mm}  \ensuremath{\mathcal{P}}_1'(p,s_{14}')$ with
the segments $ps'$ and $s's_{14}'$. We can now redefine
$s_{14}':= s'$ so that $\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_1'(p,s_{14}')=ps_{14}'$ is a line segment.
We can modify $\ensuremath{\mathcal{P}}_1'$ in a similar way to ensure that
$\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_1'(s_{13}',p)=s_{13}'p$, and we can modify $\ensuremath{\mathcal{P}}_2'$ to ensure
$\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_2'(s_{24}',q)=s_{24}'q$ and $\partial\hspace*{0.5mm} \ensuremath{\mathcal{P}}_2'(q,s_{23}')=qs_{23}'$.
Note that these modifications preserve conditions
\ref{prop:a}--\ref{prop:d} and that condition \ref{prop:e} is now
satisfied.

The only condition that $(\ensuremath{\mathcal{P}}_1',\ensuremath{\mathcal{P}}_2')$ might not satisfy is condition \ref{prop:f}.
Let $s_{2j}'(\lambda):= s_{2j}'-(\lambda,0)$ and let
$\ell_j(\lambda)$ be the line through $s_{2j}'(\lambda)$ and $s_{1j}'$ for
$j\in\{3,4\}$.
Clearly, if the slopes of $\ell_3$ and $\ell_4$ have different signs (as in Fig.~\ref{fig:distanceLemma}),
the angle
$\angle(\ell_3(\lambda),\ell_4(\lambda))$ is increasing for
$\lambda\in[0,\mathrm{dist} pq]$, and condition \ref{prop:f} is satisfied.
However, if the slopes of $\ell_3$ and $\ell_4$ have the same sign, the angle
might decrease.

Consider the case where both slopes are positive---the other case
is analogous.
Changing $\ensuremath{\mathcal{P}}_2'$ by
substituting $\partial\hspace*{0.5mm}\ensuremath{\mathcal{P}}_2'(s_{23}',s_{24}')$ with the line segment
$s_{23}'s_{24}'$ makes $\per{\ensuremath{\mathcal{P}}_1'}+\per{\ensuremath{\mathcal{P}}_2'}$ and
$\per{\ch(\ensuremath{\mathcal{P}}_1'\cup\ensuremath{\mathcal{P}}_2')}$ decrease equally much and hence
condition \ref{prop:d} is preserved.
This clearly has no influence on the other conditions. We thus assume that
$\ensuremath{\mathcal{P}}_2'$ is the triangle $qs_{23}'s_{24}'$.
Consider what happens if we move $s_{23}'$
along the line $\ell_3$ away from $c_{34}$ with unit speed.
Then $\mathrm{dist}{s_{13}'}{s_{23}'}$ grows with speed exactly $1$ whereas
$\mathrm{dist}{q}{s_{23}'}$ grows with speed at most $1$. We therefore
preserve condition
\ref{prop:d}, and the other conditions are likewise not affected.

We now move
$s_{23}'$ sufficiently far away so that
$\angle(\ell_3,\ell_3(\mathrm{dist} pq))\leq\alpha/4$.
Similarly, we move $s_{24}'$ sufficiently far away from
$c_{34}$ along $\ell_4$ to ensure that
$\angle(\ell_4,\ell_4(\mathrm{dist} pq))\leq\alpha/4$.
It then follows that
$\angle(\ell_3(\mathrm{dist} pq),\ell_4(\mathrm{dist} pq))\geq
\angle(\ell_3,\ell_4)-\alpha/2=\alpha/2$, and condition \ref{prop:f} is
satisfied.
\end{proof}

Note that condition \ref{prop:b} in the claim implies that
$\textrm{dist}(\ensuremath{\mathcal{P}}'_1,\ensuremath{\mathcal{P}}'_2)=\textrm{dist}(\ensuremath{\mathcal{P}}_1,\ensuremath{\mathcal{P}}_2)=\mathrm{dist} pq$,
and hence inequality \eqref{distIneq} follows from
condition \ref{prop:c} if we manage to prove
$\textrm{dist}(\ensuremath{\mathcal{P}}'_1,\ensuremath{\mathcal{P}}'_2)\geq f(\alpha)\cdot\per{\ensuremath{\mathcal{P}}'_1}$.
Therefore,
with a slight abuse of notation, we assume from now on that
$\ensuremath{\mathcal{P}}_1$ and $\ensuremath{\mathcal{P}}_2$ satisfy the conditions in the claim,
where the points $s_{ij}$ play the role as
$s'_{ij}$ in conditions \ref{prop:e} and \ref{prop:f}.

We now consider a copy of $\ensuremath{\mathcal{P}}_2$ that is translated horizontally to the left over a distance~$\lambda$; see Fig.~\ref{fig:distanceLemma}. Let
$s_{24}(\lambda)$, $s_{23}(\lambda)$, and $q(\lambda)$ be the translated
copies of $s_{24}$, $s_{23}$, and $q$, respectively, and let
$\ell_j(\lambda)$ be the line through $s_{1j}$ and $s_{2j}(\lambda)$
for $j\in\{3,4\}$. Furthermore, define
\[
    \Phi(\lambda)
    \ := \ \mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p}+
    \mathrm{dist}{s_{23}(\lambda)}{q(\lambda)}+\mathrm{dist}{s_{24}(\lambda)}{q(\lambda)}
\]
and
\[
    \Psi(\lambda)
    \ := \ \mathrm{dist}{s_{13}}{s_{23}(\lambda)}+\mathrm{dist}{s_{14}}{s_{24}(\lambda)}.
\]
Note that $\Phi(\lambda)=\Phi$ is constant.
By conditions \ref{prop:d} and \ref{prop:e}, we know that
\begin{equation}\label{ineq3}
\Phi\ \leq\ \Psi(0).
\end{equation}

Note that $q(\mathrm{dist} pq)=p$. We now apply Lemma \ref{simpleDiff} from the appendix to get
\begin{equation}\label{ineq4}
\Phi-\Psi(\mathrm{dist} pq)
\ \geq\
\sin(\delta/2) \cdot \frac{1-\cos(\delta/2)}{1+\sin(\delta/2)}\cdot
(\mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p}),
\end{equation}
where $\delta:=\angle(\ell_3(\mathrm{dist} pq),\ell_4(\mathrm{dist} pq))$.
By condition \ref{prop:f}, we know that $\delta\geq\alpha/2$.
The function
$\delta \longmapsto \sin(\delta/2)\cdot \frac{1-\cos(\delta/2)}{1+\sin(\delta/2)}$
is increasing for $\delta\in[0,\pi]$ and hence

inequality~\eqref{ineq4} also holds for $\delta=\alpha/2$.

When $\lambda$ increases from $0$ to $\mathrm{dist} pq$
with unit speed,
the value $\Psi(\lambda)$ decreases with speed at most~$2$, i.e.,
$\Psi(\lambda)\geq\Psi(0)-2\lambda$.
Using this and inequalities \eqref{ineq3} and \eqref{ineq4}, we get
    \[
    2\mathrm{dist} pq \ \geq \ \Psi(0)-\Psi(\mathrm{dist} pq)\ \geq\ \Phi-\Phi+
    \sin(\alpha/4) \cdot \frac{1-\cos(\alpha/4)}{1+\sin(\alpha/4)}\cdot
(\mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p}),
\]
and we conclude that
\begin{equation}\label{ineq5}
\mathrm{dist} pq\ \geq\
\frac 12\cdot\sin(\alpha/4)\cdot\frac{1-\cos(\alpha/4)}{1+\sin(\alpha/4)}\cdot
(\mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p}).
\end{equation}

By the triangle inequality,
$\mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p}\geq \mathrm{dist}{s_{13}}{s_{14}}$.
Furthermore, for a given length of $s_{13}s_{14}$,
the fraction
$\mathrm{dist}{s_{13}}{s_{14}} / (\mathrm{dist}{s_{14}}{c_{34}}+\mathrm{dist}{c_{34}}{s_{13}})$
is minimized when $s_{13}s_{14}$ is perpendicular to the angular bisector of
$\ell_3$ and $\ell_4$. (Recall that $c_{34}$ is the intersection point of the
outer common tangents $\ell_3$ and $\ell_4$; see Fig.~\ref{fig:distanceLemma}.)
Hence
\begin{equation}\label{ineqs13}
    \mathrm{dist}{s_{13}}{s_{14}}
    \ \geq\
    \sin(\alpha/2)\cdot\left(\mathrm{dist}{s_{14}}{c_{34}}+\mathrm{dist}{c_{34}}{s_{13}}\right).
\end{equation}

We now conclude
\[
\begin{array}{lllr}
\mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p}
    &  = & \frac{\sin(\alpha/2)}{1+\sin(\alpha/2)} \cdot \Big( \frac{\mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p}}{\sin(\alpha/2)} + \mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p} \Big) \\[2mm]
    &  \geq & \frac{\sin(\alpha/2)}{1+\sin(\alpha/2)}
              \cdot \Big( \frac{\mathrm{dist}{s_{13}}{s_{14}}}{\sin(\alpha/2)} + \mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p} \Big)
              & \mbox{\hspace*{-7mm}by the triangle inequality} \\[2mm]
    & \geq & \frac{\sin(\alpha/2)}{1+\sin (\alpha/2)}
             \cdot \Big( \mathrm{dist}{s_{14}}{c_{34}}+\mathrm{dist}{c_{34}}{s_{13}}+\mathrm{dist}{s_{13}}{p}+\mathrm{dist}{s_{14}}{p} \Big)
             & \mbox{\hspace{10mm}by \eqref{ineqs13}} \\[2mm]
    & \geq & \frac{\sin(\alpha/2)}{1+\sin(\alpha/2)}\cdot\per{\ensuremath{\mathcal{P}}_1},
\end{array}
\]
where the last inequality follows because $\ensuremath{\mathcal{P}}_1$ is fully contained in the
quadrilateral~$s_{14},c_{34},x_{13},p$.
The statement~\eqref{distIneq} in the lemma now follows from \eqref{ineq5}.
\end{proof}
We are now ready to prove Theorem~\ref{th:separation-property}.
\begin{proof}[Proof of Theorem~\ref{th:separation-property}]
If the separation angle of $P_1$ and $P_2$ is at least $\pi/6$, we are done.
Otherwise,
Lemma \ref{bigAngles} gives that $\alpha>\pi/2$,
and Lemma \ref{distanceLemma} gives that
$\textrm{dist}(\ensuremath{\mathcal{P}}_1,\ensuremath{\mathcal{P}}_2)\ \geq\ f(\pi/2) \cdot \per {\ensuremath{\mathcal{P}}_1} \geq
(1/250)\cdot\min(\per{\ensuremath{\mathcal{P}}_1},\per{\ensuremath{\mathcal{P}}_2})$.
\end{proof}

\subsection{The algorithm}\label{subse:alg}
Theorem~\ref{th:separation-property} suggests to distinguish two cases when computing
an optimal partition: the case where the separation angle is
large (namely at least $\pi/6$) and the case where the separation distance is
large (namely at least $c_{\sep}\cdot \min (\mathrm{per}(P_1),\mathrm{per}(P_2))$).
As we will see, the first case can be handled in
$O(n \log n)$ time and the second case in
$O(n\log^4 n)$ time, leading to the following theorem.
\begin{theorem}\label{th:main}
Let $P$ be a set of $n$ points in the plane. Then we can compute a partition $(P_1,P_2)$
of $P$ that minimizes $\mathrm{per}(P_1)+\mathrm{per}(P_2)$ in $O(n\log^4 n)$ time
using $O(n\log^3 n)$ space.
\end{theorem}

To find the best partition when the separation angle is at least $\pi/6$, we observe that in this
case there is a separating line whose orientation is $j\cdot \pi/7$ for some $0\leq j<7$.
For each of these orientations we can scan over the points with a line~$\ell$ of the given orientation,
and maintain the perimeters of the convex hulls on both sides. This takes $O(n\log n)$ time in total;
see Appendix~\ref{sec:sep}.

Next we show how to compute the best partition with large separation distance.
We assume without loss of generality that $\mathrm{per}(P_2)\leq \mathrm{per}(P_1)$.
It will be convenient to treat the case where $P_2$ is a singleton separately.
\begin{lemma}\label{le:singleton}
The point $p\in P$ minimizing $\mathrm{per}(P\setminus \{p\})$
can be computed in $O(n\log n)$ time.
\end{lemma}
\begin{proof
The point~$p$ we are looking for must be a vertex of~$\ch(P)$.
First we compute $\ch(P)$ in $O(n\log n)$ time~\cite{bcko-cgaa-08}.
Let $v_0,v_1,\ldots,v_{m-1}$ denote the vertices of~$\ch(P)$ in counterclockwise order.
Let $\Delta_i$ be the triangle with vertices $v_{i-1} v_i v_{i+1}$
(with indices taken modulo~$m$) and let
$P_i$ denote the set of points lying inside~$\Delta_i$,
excluding $v_i$ but including $v_{i-1}$ and $v_{i+1}$.
Note that any point $p\in P$ is present in
at most two sets~$P_i$. Hence, $\sum_{i=0}^m |P_i|= O(n)$.
It is not hard to compute the sets $P_i$ in $O(n\log n)$ time in total.
After doing so, we compute all convex hulls~$\ch(P_i)$
in $O(n\log n)$ time in total. Since
\[
\mathrm{per}(P\setminus\{v_i\})
  = \mathrm{per}(P) - |v_{i-1}v_i| - |v_i v_{i+1}| +  \mathrm{per}(P_i) - |v_{i-1}v_{i+1}|,
\]
we can now find the point $p$ minimizing $\mathrm{per}(P\setminus \{p\})$
in $O(n)$ time.
\end{proof}

It remains to compute the best partition $(P_1,P_2)$ with
$\mathrm{per}(P_2)\leq \mathrm{per}(P_1)$ whose separation distance is
at least~$c_{\sep} \cdot\mathrm{per}(P_2)$ and where $P_2$ is not a singleton.
Let $(P_1^*,P_2^*)$ denote this partition. Define the \emph{size}
of a square\footnote{Whenever we speak of squares, we always mean axis-parallel squares.}~$\sigma$ to be its edge length.
A square $\sigma$
is a \emph{good square} if
(i) $P_2^* \subset \sigma$, and
(ii) $\mathrm{size}(\sigma)\leq c^* \cdot \mathrm{per}(P^*_2)$, where $c^* := 18$.
Our algorithm globally works as follows.
\myenumerate{
\item Compute a set $S$ of $O(n)$ squares such that $S$ contains a good square.
\item For each square $\sigma\in S$, construct a set $H_{\sigma}$ of $O(1)$
      halfplanes such that the following holds: if $\sigma\in S$ is a good square
      then there is a halfplane $h\in H_\sigma$ such that $P^*_2 = P(\sigma\cap h)$,
      where $P(\sigma\cap h) := P\cap (\sigma\cap h)$.
\item For each pair $(\sigma,h)$ with $\sigma\in S$ and $h\in H_\sigma$, compute
      $\mathrm{per}(P\setminus P(\sigma\cap h)) + \mathrm{per}(P(\sigma\cap h))$, and
      report the partition $(P\setminus P(\sigma\cap h), P(\sigma\cap h))$
      that gives the smallest sum.
}
\mypara{Step 1: Finding a good square.}
To find a set $S$ that contains a good square, we first construct a set
$S_{\base}$ of so-called \emph{base squares}. The set $S$ will then be obtained
by expanding the base squares appropriately.

We define a base square~$\sigma$ to be \emph{good} if
(i) $\sigma$ contains at least one point from $P^*_2$, and
(ii) $c_1 \cdot\mathrm{diam}(P^*_2) \leq \mathrm{size}(\sigma) \leq c_2 \cdot\mathrm{diam}(P^*_2)$,
where $c_1 := 1/4$ and $c_2:= 4$
and $\mathrm{diam}(P^*_2)$ denotes the diameter of~$P^*_2$.
Note that $2\cdot\mathrm{diam}(P^*_2)\leq\per{P^*_2}\leq 4\cdot\mathrm{diam}(P^*_2)$.
For a square~$\sigma$, define $\expand{\sigma}$ to be the square
with the same center as $\sigma$ and whose size is
$\left(1+2/c_1\right)\cdot\mathrm{size}(\sigma)$.
\begin{lemma}\label{le:base-square}
If $\sigma$ is a good base square then $\expand{\sigma}$ is a good square.
\end{lemma}
\begin{proof
The distance from any point in $\sigma$ to the boundary of $\expand{\sigma}$
is at least
\[
\frac{\mathrm{size}(\expand{\sigma})-\mathrm{size}(\sigma)}{2}
    \ \geq\ \mathrm{diam}(P^*_2).
\]
Since $\sigma$ contains a point from $P^*_2$,
it follows that
$P^*_2\subset\expand{\sigma}$.
Since $\mathrm{size}(\sigma) \leq c_2 \cdot \mathrm{diam}(P^*_2)$, we have
\[
\mathrm{size}(\expand{\sigma})
    \ \leq \ (2/c_1+1)\cdot c_2 \cdot\mathrm{diam}(P^*_2)
    \ = \ 36 \cdot \mathrm{diam}(P^*_2)
    \ \leq\ c^*\cdot \mathrm{per}(P^*_2).
\]
\end{proof}

To obtain $S$ it thus suffices to construct a set $S_{\base}$ that contains a good base square.
To this end we first build a compressed quadtree for $P$. For completeness we briefly
review the definition of compressed quadtrees; see also Fig.~\ref{fi:base-squares-types}~(left).

Assume without loss of generality that $P$ lies in the interior of the unit square $U:= [0,1]^2$.
Define a \emph{canonical square} to be any square that
can be obtained by subdividing~$U$ recursively into quadrants.
A \emph{compressed quadtree}~\cite{h-11} for $P$ is a hierarchical subdivision of $U$,
defined as follows.
In a generic step of the recursive process we are given a
canonical square $\sigma$ and the set $P(\sigma) := P\cap \sigma$ of
points inside~$\sigma$.
(Initially $\sigma =U$ and $P(\sigma)=P$.) \\
\begin{itemize}}%{\begin{itemize}\setlength{\itemsep}{-\parskip}
\item If $|P(\sigma)|\leq 1$ then the recursive process stops and $\sigma$
      is a square in the final subdivision.
\item Otherwise there are two cases.
      Consider the four quadrants of $\sigma$.
      The first case is that at least two of these quadrants contain points from $P(\sigma)$.
      (We consider the quadrants to be closed on the left and bottom side,
       and open on the right and top side, so a point is contained in a unique quadrant.)
      In this case we partition $\sigma$ into its four quadrants---we call this
      a \emph{quadtree split}---and recurse on each quadrant.
      The second case is that all points from $P(\sigma)$ lie inside the same quadrant.
      In this case we compute the smallest canonical square, $\sigma'$, that
      contains $P(\sigma)$ and we partition $\sigma$ into two regions: the
      square $\sigma'$ and the so-called \emph{donut region}~$\sigma\setminus \sigma'$.
      We call this a \emph{shrinking step}. After a shrinking step we only
      recurse on the square $\sigma'$, not on the donut region. \\
\end{itemize}
A compressed quadtree for a set of $n$ points can be computed in $O(n\log n)$ time
in the appropriate model of computation\footnote{In particular we need to be able to compute
the smallest canonical square containing two given points in~$O(1)$ time. See the book by
Har-Peled~\cite{h-11} for a discussion.}\label{fn:quadtree}~\cite{h-11}.
The idea is now as follows. Let $p,p'\in P^*_2$ be a pair of points defining~$\mathrm{diam}(P_2^*)$.
The compressed quadtree hopefully allows us to zoom in until we have a square in the
compressed quadtree that contains $p$ or $p'$ and whose size is roughly equal to~$|pp'|$.
Such a square will be then a good base square.
Unfortunately this does not always work since $p$ and $p'$
can be separated too early. We therefore have to proceed more carefully:
we need to add five types of base squares to $S_{\base}$, as explained next and illustrated in
Fig.~\ref{fi:base-squares-types}~(right).
\begin{figure}
\begin{center}
\includegraphics[width=1.0\textwidth]{figures/base-square-types}
\end{center}
\caption{A compressed quadtree and some of the base squares generated from it.
In the right figure, only the points are shown that are relevant
for the shown base squares.}
\label{fi:base-squares-types}
\end{figure}

\begin{description}
\item[(B1)] Any square $\sigma$ that is generated during the recursive construction---note
      that this not only refers to squares in the final subdivision---is put into~$S_{\base}$.
\item[(B2)] For each point $p\in P$ we add a square $\sigma_p$ to $S_{\base}$, as follows.
      Let $\sigma$ be the square of the final subdivision that contains~$p$. Then
      $\sigma_p$ is a smallest square

      that contains $p$ and that shares a corner with~$\sigma$.
\item[(B3)] For each square $\sigma$ that results from a shrinking step we add an extra
      square~$\sigma'$ to $S_{\base}$, where $\sigma'$ is the smallest square that contains~$\sigma$ and that shares a corner with the parent square of $\sigma$.
\item[(B4)] For any two regions in the final subdivision that touch each other---we also
      consider two regions to touch if they only share a vertex---we
      add at most one square to $S_{\base}$, as follows.
      If one of the regions is an empty square, we do not add anything
      for this pair. Otherwise we have three cases.
      \begin{description}
      \item[(B4.1)] If both regions are non-empty squares containing
            points~$p$ and $p'$, respectively, then we add a smallest
            enclosing square for the pair of points $p,p'$ to $S_{\base}$.
      \item[(B4.2)] If both regions are donut regions, say $\sigma_1\setminus\sigma_1'$
            and $\sigma_2\setminus\sigma_2'$, then we add a smallest enclosing square
            for the pair $\sigma'_1,\sigma'_2$ to $S_{\base}$.
      \item[(B4.3)] If one region is a non-empty square containing a point $p$
            and the other is a donut region $\sigma\setminus\sigma'$,
            then we add a smallest enclosing square
            for the pair $p,\sigma'$ to $S_{\base}$.

      \end{description}
\end{description}
\begin{lemma}
The set $S_{\base}$ has size $O(n)$ and contains a good base square. Furthermore, $S_{\base}$
can be computed in $O(n\log n)$ time.
\end{lemma}
\begin{proof}
A compressed quadtree has size $O(n)$ so we have $O(n)$ base squares of type~(B1) and~(B3).
Obviously there are $O(n)$ base squares of type~(B2). Finally, the number
of pairs of final regions that touch is $O(n)$---this follows because we have a planar
rectilinear subdivision of total complexity~$O(n)$---and so the number of base squares
of type~(B4) is $O(n)$ as well. The fact that we can compute $S_{\base}$ in $O(n\log n)$ time
follows directly from the fact that we can compute the compressed quadtree in $O(n\log n)$
time~\cite{h-11}.
\medskip

It remains to prove that $S_{\base}$ contains a good base square. We call a square~$\sigma$
\emph{too small} when $\mathrm{size}(\sigma) < c_1 \cdot \mathrm{diam}(P^*_2)$  and \emph{too large} when
$\mathrm{size}(\sigma) > c_2\cdot\mathrm{diam}(P^*_2)$; otherwise we say that $\sigma$ has the \emph{correct size}.
Let $p,p'\in P^*_2$ be two points with $|pp'|=\mathrm{diam}(P^*_2)$, and consider a smallest square

$\sigma_{p,p'}$, in the compressed quadtree that contains both~$p$ and~$p'$.
Note that $\sigma_{p,p'}$ cannot be too small, since $c_1=1/4<1/\sqrt{2}$.
If $\sigma_{p,p'}$ has the correct size, then we are done since it is
a good base square of type~(B1). So now suppose $\sigma_{p,p'}$ is too large.

Let $\sigma_0,\sigma_1,\ldots,\sigma_k$ be the sequence of squares
in the recursive subdivision of $\sigma_{p,p'}$ that contain~$p$;
thus $\sigma_0=\sigma_{p,p'}$ and $\sigma_k$ is a square in the final subdivision.
Define $\sigma'_0,\sigma'_1,\ldots,\sigma'_{k'}$
similarly, but now for~$p'$ instead of~$p$. Suppose that none of these
squares has the correct size---otherwise we have a good base square of type~(B1).
There are three cases.
\begin{itemize}}%{\begin{itemize}\setlength{\itemsep}{-\parskip}
\item \emph{Case~(i): $\sigma_k$ and $\sigma'_{k'}$ are too large.}
      \\[1mm]
      We claim that $\sigma_k$ touches $\sigma'_{k'}$. To see this, assume without loss
      of generality that $\mathrm{size}(\sigma_k)\leq\mathrm{size}(\sigma'_{k'})$. If
      $\sigma_k$ does not touch $\sigma'_{k'}$ then $|pp'| \geq \mathrm{size}(\sigma_k)$,
      which contradicts that $\sigma_k$ is too large.

      Hence, $\sigma_k$ indeed touches $\sigma'_{k'}$. But then we have a base square
      of type~(B4.1) for the pair $p,p'$ and since $|pp'|=\mathrm{diam}(P^*_2)$ this
      is a good base square.

\item \emph{Case~(ii): $\sigma_k$ and $\sigma'_{k'}$ are too small.}
      \\[1mm]
      In this case there are indices $0<j\leq k$ and $0<j'\leq k'$ such that
      $\sigma_{j-1}$ and $\sigma'_{j'-1}$ are too large and $\sigma_{j}$
      and $\sigma'_{j'}$ are too small.
      Note that this implies that both $\sigma_j$ and $\sigma'_{j'}$ result
      from a shrinking step, because $c_1 < c_2/2$ and so the quadrants
      of a too-large square cannot be too small.
      We claim that $\sigma_{j-1}$ touches $\sigma'_{j'-1}$. Indeed, similarly to Case~(i),
      if $\sigma_{j-1}$ and $\sigma'_{j'-1}$ do not touch
      then $|pp'| > \min(\mathrm{size}(\sigma_{j-1}),\mathrm{size}(\sigma'_{j'-1}))$,
      contradicting that both $\sigma_{j-1}$ and $\sigma'_{j'-1}$ are too large.
      We now have two subcases.
      \begin{itemize}}%{\begin{itemize}\setlength{\itemsep}{-\parskip}
      \item The first subcase is that the donut region~$\sigma_{j-1}\setminus\sigma_{j}$
            touches the donut region~$\sigma'_{j'-1}\setminus\sigma_{j'}$. Thus a
            smallest enclosing square for $\sigma_j$ and $\sigma'_{j'}$ has been put
            into $S_{\base}$ as a base square of type~(B4.2). Let $\sigma^*$ denote
            this square. Since the segment~$pp'$ is contained in $\sigma^*$ we have
            \[
            c_1\cdot \mathrm{diam}(P^*_2) \ < \ \mathrm{diam}(P^*_2)/ \sqrt{2} \ = \ |pp'| / \sqrt{2} \ \leq \  \mathrm{size}(\sigma^*).
            \]
            Furthermore, since $\sigma_j$ and $\sigma'_{j'}$ are too small
            we have
            \begin{equation} \label{eq:first-subcase}
            \mathrm{size}(\sigma^*)
            \ \leq \ \mathrm{size}(\sigma_j) + \mathrm{size}(\sigma'_{j'} ) + |pp'|
            \ \leq \ 3\cdot \mathrm{diam}(P^*_2)
            \ < \ c_2\cdot \mathrm{diam}(P^*_2),
            \end{equation}
            and so $\sigma^*$ is a good base square.

      \item The second subcase is that $\sigma_{j-1}\setminus\sigma_{j}$
            does not touch~$\sigma'_{j'-1}\setminus\sigma_{j'}$. This can only
            happen if $\sigma_{j-1}$ and $\sigma'_{j'-1}$ just share a single corner, $v$.

            Observe that $\sigma_j$ must lie in the quadrant of $\sigma_{j-1}$ that
            has $v$ as a corner, otherwise $|pp'|\geq \mathrm{size}(\sigma_{j-1})/2$
            and $\sigma_{j-1}$ would not be too large.

            Similarly,  $\sigma'_{j'}$ must lie in the quadrant of $\sigma'_{j'-1}$ that
            has $v$ as a corner. Thus the base squares of type~(B3) for
            $\sigma_j$ and $\sigma'_{j'}$ both have $v$ as a corner. Take the largest
            of these two base squares, say~$\sigma_j$. For this square~$\sigma^*$ we have
            \[
            c_1\cdot \mathrm{diam}(P^*_2) \ < \ \mathrm{diam}(P^*_2)/2\sqrt{2} \ = \ |pp'| / 2\sqrt{2} \ \leq \ \mathrm{size}(\sigma^*),
            \]
            since $|pp'|$ is contained in a square of twice the size of $\sigma^*$.

            Furthermore, since $\sigma_j$ is too small and $|pv|<|pp'|$ we have
            \begin{equation} \label{eq:second-subcase}
            \mathrm{size}(\sigma^*)
            \ \leq \ \mathrm{size}(\sigma_j) + |pv|
            \ \leq \ (c_1+1)\cdot \mathrm{diam}(P^*_2)
            \ < \ c_2\cdot \mathrm{diam}(P^*_2).
            \end{equation}
            Hence, $\sigma^*$ is a good base square.
      \end{itemize}
\item \emph{Case~(iii): neither (i) nor (ii) applies.} \\[1mm]
      In this case $\sigma_k$ is too small and $\sigma'_{k'}$ is too large (or vice versa).
      Thus there must be an index $0<j\leq k$ such that
      $\sigma_{j-1}$ is too large and $\sigma_{j}$ is too small.
      We can now follow a similar reasoning as in Case~(ii):
      First we argue that $\sigma_j$ must have resulted from
      a shrinking step and that $\sigma_{j-1}$ touches~$\sigma'_{k'}$.
      Then we distinguish two subcases, namely where the
      donut region~$\sigma_j\setminus \sigma_{j-1}$ touches~$\sigma'_{k'}$
      and where it does not touch~$\sigma'_{k'}$.
      The arguments for the two subcases are similar to the subcases in Case~(ii),
      with the following modifications.
      In the first subcase we use base squares of type~(B4.3)
      and in \eqref{eq:first-subcase} the term $\mathrm{size}(\sigma'_{j'})$ disappears;
      in the second subcase we use a type~(B3) base square
      for $\sigma_{j}$ and a type~(B2) base square for $p'$,
      and when the base square for $p'$ is larger than the
      base square for $\sigma_{j}$ then \eqref{eq:second-subcase} becomes
      $\mathrm{size}(\sigma^*) \leq 2\;|p'v| < c_2\cdot \mathrm{diam}(P^*_2)$.
\end{itemize}

\end{proof}

\mypara{Step 2: Generating halfplanes.}
Consider a good square $\sigma \in S$. Let $Q_\sigma$ be a set of $4\cdot c^*/c_{\sep}+1=18001$ points placed equidistantly around the boundary of $\sigma$.
Note that the distance between two neighbouring points in $Q_\sigma$ is
less than $c_{\sep}/c^* \cdot \mathrm{size}(\sigma)$.
For each pair $q_1,q_2$
of points in $Q_\sigma$, add to $H_\sigma$ the two halfplanes defined
by the line through $q_1$ and $q_2$.

\begin{lemma}\label{le:hyperplanes} For any good square $\sigma \in S$, there is a halfplane $h\in H_\sigma$ such that $P^*_2 = P(\sigma\cap h)$.
\end{lemma}
\begin{proof
In the case where $\sigma\cap P^*_1=\emptyset$, two points in $Q_\sigma$ from the same
edge of $\sigma$ define a half-plane $h$ such that $P^*_2 = P(\sigma\cap h)$,
so assume that $\sigma$ contains one or more points from
$P^*_1$.

We know that the separation distance between $P^*_1$ and $P^*_2$ is at least $c_{\sep} \cdot \mathrm{per}(P^*_2)$.
Moreover, $\mathrm{size}(\sigma)\leq c^* \cdot \mathrm{per}(P^*_2)$.
Hence,
there is an empty open strip $O$ with a width of at least $c_{\sep}/c^* \cdot \mathrm{size}(\sigma)$
separating $P^*_2$ from $P^*_1$.
Since $\sigma$ contains a point from $P^*_1$, we know that
$\sigma\setminus O$ consists of two pieces and that
the part of the
boundary of $\sigma$ inside $O$ consists of two disjoint portions $B_1$ and $B_2$
each of length at least $c_{\sep}/c^* \cdot \mathrm{size}(\sigma)$. Hence the sets
$B_1\cap Q_\sigma$ and $B_2\cap Q_\sigma$ contain points $q_1$ and $q_2$,
respectively, that define a half-plane $h$ as desired.
\end{proof}

\mypara{Step 3: Evaluating candidate solutions.}
In this step we need to compute for each pair $(\sigma,h)$ with $\sigma\in S$
and $h\in H_\sigma$, the value $\mathrm{per}(P\setminus P(\sigma\cap h)) + \mathrm{per}(P(\sigma\cap h))$.
We do this by preprocessing $P$ into a data structure that allows us to
quickly compute $\mathrm{per}(P\setminus P(\sigma\cap h))$ and $\mathrm{per}(P(\sigma\cap h))$
for a given pair $(\sigma,h)$.
Recall that the bounding lines of the halfplanes $h$ we must process have
$O(1)$ different orientations. We construct a separate data structure for each
orientation.
\medskip

Consider a fixed orientation~$\phi$.  We build a data structure $\ensuremath{\mathcal{D}}_{\phi}$
for range searching on~$P$ with ranges of the form $\sigma\cap h$, where
$\sigma$ is a square and $h$ is halfplane whose bounding line has orientation~$\phi$.
Since the edges of $\sigma$ are axis-parallel and the bounding line of the
halfplanes~$h$ have a fixed orientation, we can use a standard three-level
range tree~\cite{bcko-cgaa-08} for this. Constructing this tree takes
$O(n\log^2 n)$ time and the tree has $O(n\log^2 n)$ nodes.

Each node $\nu$ of the third-level trees in $\ensuremath{\mathcal{D}}_{\phi}$ is associated with
a \emph{canonical subset}~$P(\nu)$,
which contains the points stored in the subtree rooted at~$\nu$.
We preprocess each canonical subset~$P(\nu)$ as follows.
First we compute the convex hull~$\ch(P(\nu))$. Let $v_1,\ldots,v_k$
denote the convex-hull vertices in counterclockwise order. We store these vertices
in order in an array,
and we store for each vertex~$v_i$ the value $\perPart P{v_1}{v_i}$, that is,
the length of the part of $\partial\hspace*{0.5mm}\ch(P(\nu))$ from $v_1$ to~$v_i$
in counterclockwise order. Note that the convex hull~$\ch(P(\nu))$ can
be computed in $O(|P(\nu)|)$ from the convex hulls at the two children
of $\nu$. Hence, the convex hulls~$\ch(P(\nu))$ (and the
values $\perPart P{v_1}{v_i}$)
can be computed in $\sum_{\nu\in\ensuremath{\mathcal{D}}_\phi} O(|P(\nu)|)=O(n\log^3 n)$~time in
total, in a bottom-up manner.

Now suppose we want to compute $\mathrm{per}(P(\sigma\cap h))$, where the orientation
of the bounding line of~$h$ is~$\phi$. We perform a range query in $\ensuremath{\mathcal{D}}_{\phi}$
to find a set $N(\sigma\cap h)$ of $O(\log^3 n)$ nodes such that
$P(\sigma\cap h)$ is equal to the union of the canonical subsets of
the nodes in~$N(\sigma\cap h)$. Standard range-tree properties guarantee
that the convex hulls $\ch(P(\nu))$ and $\ch(P(\mu))$ of any two
nodes $\nu,\mu \in N(\sigma\cap h)$ are disjoint.
Note that $\ch(P(\sigma\cap h))$ is equal to the convex hull of the set of
convex hulls $\ch(P(\nu))$ with $\nu\in N(\sigma\cap h)$.
Lemma \ref{le:convexhull} in the appendix thus implies
that we can compute $\mathrm{per}(P(\sigma\cap h))$ in $O(\log^4n)$ time.

Observe that $P\setminus P(\sigma\cap h)$ can also be expressed as the
union of $O(\log^3 n)$ canonical subsets with disjoint convex hulls,
since ${\Bbb R}^2 \setminus( \sigma\cap h)$ is the disjoint union of
$O(1)$ ranges of the right type. Hence,
we can compute $\mathrm{per}(P\setminus P(\sigma\cap h))$ in $O(\log^4n)$ time.
We thus obtain the following result, which finishes the proof of Theorem~\ref{th:main}.
\begin{lemma}\label{le:step3prime}
Step 3 can be performed in $O(n\log^4 n)$ time and using $O(n\log^3 n)$ space.
\end{lemma}

\section{The approximation algorithm}\label{se:approx-alg}

\begin{theorem}\label{thm:approx}
Let $P$ be a set of $n$ points in the plane and let $(P_1^*,P_2^*)$ be a partition of~$P$
minimizing $\per{P_1^*}+\per{P_2^*}$. Suppose we have an exact algorithm
for the minimum perimeter-sum problem running in $T(k)$ time for instances with $k$ points. Then for any given $\varepsilon>0$
we can compute a partition $(P_1,P_2)$ of $P$ such that
$\per{P_1}+\per{P_2} \leq (1+\varepsilon) \cdot  \big(\per{P_1^*}+\per{P_2^*}\big)$ in $O(n+T(1/\varepsilon^2))$ time.
\end{theorem}

\begin{proof
Consider the axis-parallel bounding box $B$ of $P$. Let $w$ be the width of~$B$ and let
$h$ be its height. Assume without loss of generality that $w\geq h$.
Our algorithm works in two steps.
\begin{itemize}
\item \emph{Step 1: Check if $\per{P_1^*}+\per{P_2^*}\leq w/16$. If so, compute the exact solution.} \\[2mm]
    We partition $B$ vertically into four strips with width~$w/4$, denoted $B_1$, $B_2$, $B_3$,
    and $B_4$ from left to right. If $B_2$ or $B_3$ contains a point from $P$,
    we have $\per{P_1^*}+\per{P_2^*}\geq w/2>w/16$ and we go to Step~2.
    If $B_2$ and $B_3$ are both empty, we consider two cases.
    \begin{itemize}
    \item \emph{Case~(i): $h\leq w/8$.} \\[2mm]
         In this case we simply return the partition $(P\cap B_1,P\cap B_4)$.
        To see that this is optimal, we first note that any subset $P'\subset P$
        that contains a point from $B_1$ as well as a point from $B_4$
        has $\per{P'}\geq 2\cdot (3w/4)=3w/2$. On the other hand,
        $\per{P\cap B_1}+\per{P\cap B_4} \leq 2\cdot (w/2+ 2h) \leq 3w/2$.
    \item \emph{Case~(ii): $h> w/8$.} \\[2mm]
        We partition $B$ horizontally into four rows with height~$h/4$,
        numbered $R_1$, $R_2$, $R_3$, and $R_4$ from bottom to top.
        If $R_2$ or $R_3$ contains a point from $P$, we have
        $\per{P_1^*}+\per{P_2^*}\geq h/2>w/16$, and we go the Step~2.
        If $R_2$ and $R_3$ are both empty, we overlay the vertical and
        the horizontal partitioning of $B$ to get a
        $4\times 4$ grid of cells $C_{ij}:= B_i\cap R_j$ for $i,j\in\{1,\ldots,4\}$.
        We know that only the corner cells $C_{11},C_{14},C_{41},C_{44}$
        contain points from $P$. If three or four corner cells are non-empty,
        $\per{P_1^*}+\per{P_2^*}\geq 6h/4>w/16$. Hence, we may without loss of
        generality assume that any point of $P$ is in $C_{11}$ or $C_{44}$.
        We now return the partition $(P\cap C_{11},P\cap C_{44})$, which
        is easily seen to be optimal.
    \end{itemize}
\item \emph{Step 2: Handle the case where $\per{P_1^*}+\per{P_2^*}> w/16$.} \\[2mm]
    The idea is to compute a subset~$\widehat{P}\subset P$ of size $O(1/\varepsilon^2)$
    such that an exact solution to the minimum perimeter-sum problem on~$\widehat{P}$
    can be used to obtain a $(1+\varepsilon)$-approximation for the problem on~$P$.

    We subdivide $B$ into $O(1/\varepsilon^2)$ rectangular cells of width and height
    at most~$c:= \varepsilon w / (64\pi\sqrt 2)$.
    For each cell $C$ where $P\cap C$ is non-empty we pick an arbitrary point
    in $P\cap C$, and we let $\widehat P$ be the set of selected points.
    For a point $p\in \widehat P$, let $C(p)$ be the cell containing $p$.
    Intuitively, each point $p\in \widehat P$ represents all the points $P\cap C(p)$.
    Let $(\widehat P_1,\widehat P_2)$ be a partition of
    $\widehat P$ that minimizes $\per{\widehat P_1}+\per{\widehat P_2}$.
    We assume we have an algorithm that can compute such an optimal partition
    in $T(|\widehat{P}|)$ time. For $i=1,2$, define
    \[
    P_i:= \bigcup_{p\in \widehat P_i} P\cap C(p).
    \]
    Our approximation algorithm returns the partition $(P_1,P_2)$.
    (Note that the convex hulls of $P_1$ and $P_2$ are not necessarily disjoint.)
    It remains to prove the approximation ratio.

\begin{figure}
\begin{center}
\includegraphics{figures/approx}
\end{center}
\caption{The crossed points are the points of $\widehat P$.
The left gray region is $\widetilde P_1$ and the right
gray region is $\widetilde P_2$. The left purple-colored polygon is the convex hull of $P_1$
and the right purple-colored polygon is the convex hull of $P_2$.}
\label{fi:coreset}
\end{figure}

    First, note that $\per{\widehat P_1}+\per{\widehat P_2}\leq\per{P_1^*}+\per{P_2^*}$ since
    $\widehat P\subseteq P$.
    For $i=1,2$, let $\widetilde P_i$ consist of all points in the plane (not only points
    in $P$) within a distance of at most $c\sqrt{2}$ from $\ch(\widehat P_i)$.
    In other words, $\widetilde P_i$ is the Minkowksi sum of $\ch(\widehat P_i)$
    with a disk $D$ of radius $c\sqrt{2}$ centered at the origin;
    see Fig.~\ref{fi:coreset}.
    Note that if
    $p\in \widehat P_i$, then $q\in\widetilde P_i$ for any $q\in P\cap C(p)$,
    since any two points in $C(p)$ are at most $c\sqrt{2}$ apart from each other.
    Therefore $P_i\subset \widetilde P_i$ and hence $\per{P_i}\leq \per{\widetilde P_i}$.
    Note also that
    $\per{\widetilde P_i}=\per{\widehat P_i}+2 c\pi\sqrt 2$.
    These observations yield
    \[
    \begin{array}{lll}
    \per{P_1}+\per{P_2}
        & \leq  & \per{\widetilde P_1}+\per{\widetilde P_2} \\
        &   =   & \per{\widehat P_1}+\per{\widehat P_2} + 4 c\pi\sqrt 2 \\
        & \leq  & \per{P_1^*}+\per{P_2^*} + 4 c\pi\sqrt 2 \\
        &  =    & \per{P_1^*}+\per{P_2^*} + 4 \pi\sqrt 2 \cdot \left( \varepsilon w / (64\pi\sqrt 2) \right) \\
        & \leq  & \per{P_1^*}+\per{P_2^*} + \varepsilon w/16 \\
        & \leq  & (1+\varepsilon) \cdot (\per{P_1^*}+\per{P_2^*}).
    \end{array}
    \]
   As all the steps can be done in linear time,
   the time complexity of the algorithm is $O(n+T(n_\varepsilon))$
   for some $n_\varepsilon=O(1/\varepsilon^2)$.
\end{itemize}
\end{proof}

\subparagraph*{Acknowledgements.}
This research was initiated when the first author visited
the Department of Computer Science
at TU Eindhoven during the winter 2015--2016.
He wishes to express his
gratitude to the other authors and the department for their
hospitality.

\bibliographystyle{plain}

\newcommand{\emph{Comput.\ Geom.\ Theory Appl.}}%\xspace}{\emph{Comput.\ Geom.\ Theory Appl.}
\newcommand{\emph{Discr.\ Comput.\ Geom.}}%\xspace}{\emph{Discr.\ Comput.\ Geom.}
\newcommand{\emph{Int.\ J.\ Comput.\ Geom.\ Appl.}}%\xspace}{\emph{Int.\ J.\ Comput.\ Geom.\ Appl.}
\newcommand{\emph{Algorithmica}}%\xspace}{\emph{Algorithmica}
\newcommand{\emph{SIAM J.\ Comput.}}%\xspace}{\emph{SIAM J.\ Comput.}
\newcommand{\emph{J.\ Alg.}}%\xspace}{\emph{J.\ Alg.}
\newcommand{\emph{Inf. Proc. Lett.}}%\xspace}{\emph{Inf. Proc. Lett.}

\newcommand{\socg}[1]{In \emph{Proc.\ #1 ACM Symp.\ Comput.\ Geom.\ (SoCG)}
\newcommand{\soda}[1]{In \emph{Proc.\ #1 ACM-SIAM Symp.\ Discr.\ Alg.\ (SODA)}
\newcommand{\esa}[1]{In \emph{Proc.\ #1 Europ.\ Symp.\ Alg.\ (ESA)}
\newcommand{\walcom}[1]{In \emph{Proc.\ #1 Int.\ Workshop Alg.\ Comput.\ (WALCOM)}
\newcommand{\cccg}[1]{In \emph{Proc.\ #1 Canad.\ Conf.\ Comput.\ Geom.\ (CCCG)}
\newcommand{\wads}[1]{In \emph{Proc.\ #1 Workshop Alg. Data Struct.\ (WADS)}
\newcommand{\cats}[1]{In \emph{Proc.\ #1 Computing: Australasian Theory Symp. (CATS)}