Largest Red Blue Separating Rectangles Revisited

Largest Red Blue Separating Rectangles Revisited
Bogdan Armaselu, Ovidiu Daescu, Chenglin Fan, Benjamin Raichel
Department of Computer Science, University of Texas at Dallas
smax
is the boundary of the subset of points in R2 that dominates ≤ k points of P (hence ST (P ) = ST0 (P )). Note
smin
that by flipping one or both of the inequalities used to
define the dominance relation, we can define up to four
W
E
“orientations” for a staircase. A staircase is valid for
one of the four corner regions defined by smin , if the orientation of the dominance relation is defined such that
all of smin is dominated by any point in the region.
S
SW
SE
We now define the problem we reduce to.
Figure 1: smin , smax , and the regions they define.
Problem 1.2. Input: Two axis aligned rectangles smin
and smax such that smin is contained in smax , and a
1 Problem Description and Results valid staircase for each one of the four corner regions
Let R be a set of n red points and let B be a set of m defined by smin and restricted within smax .
blue points such that no blue point is inside the mini- Goal: Find the maximum area axis aligned rectangle
mum axis-aligned rectangle enclosing R. The following such that it contains smin , is contained in smax , and
problem has been addressed in [AD16].
does not contain any point of any staircase inside it.
Problem 1.1. Find the maximum area rectangle that
First we sketch the reduction of Problem 1.1 to Probcontains all red points an no blue points.
lem 1.2, described in [AD16]. Let smin denote the minHere we consider extensions of this problem to the imum enclosing rectangle of the red set R, which any
case of outliers, to avoiding geometric objects other solution must contain, and let smax be defined as above.
Now consider one of the corner regions
than points, and in future work to many other variants.
Problem 1.1 is solved by first reducing it to a sim- NE,SE,SW,NW, for example the region NE. Let
pler problem that we describe next. Let smin be the p = (px , py ) be the corner in NE of any arbitrary
minimum axis-aligned rectangle enclosing R. Extend- axis aligned rectangle containing smin . Note that the
ing the four line segments defining smin into full lines interior of the intersection of this rectangle with NE
defines a partition of the plane into 9 regions: four side is precisely the subset of points in NE dominated by
regions, N,E,S,W, four corner regions NE,SE,SW,NW, p. Our solution cannot contain any blue points, hence
and smin itself (see Figure 1). Given a set of points our solution corner p cannot dominate any point in
B (blue set), for any region r, let Br denote the sub- BN E . Furthermore, observe that the corner p of the
set of B contained in r. Let smax be the axis-aligned rectangle dominates a point of BN E if and only if
rectangle defined by the two points with the smallest the rectangle contains a point lying on ST (BN E ) (i.e.
and largest x-coordinate in regions E and W, and the the only relevant points are those on the staircase).
two points with the smallest and largest y-coordinate Hence we seek the largest area rectangle avoiding the
in regions N and S. Obviously smax ⊃ smin , and we can staircase in each one of the corner regions, which is
precisely the form of Problem 1.2.
clip the side and corner regions to smax .
Problem 1.2 can be solved in time O(t), where t is
Given distinct points p = (px , py ) and q = (qx , qy ),
we say that p dominates q if px > qx and py > qy . the total descriptive complexity of the staircases by
Given a finite point set P , define the staircase of P , modifying the algorithm in [KMNS12]. It is not hard
denoted ST (P ), to be the boundary of the subset of to argue that the above reduction implies that these
points in R2 that does not dominate any point of P . staircases have complexity t = O(m). As computing a
Similarly, the kth level staircase of P , denoted STk (P ), staircase takes Θ(m log m) time (sorting and sweeping;
NW
N
NE
1
given region r, let kr be the number of outliers assigned
to r. First, consider one of the side regions, for example
E. As before, the intersection with E of an axis aligned
rectangle containing smin is a vertical strip. Unlike
Problem 1.1, this time we are allowed to contain up
to kE points from BE . Hence the right side of smax
is defined by the (kE + 1)th smallest x-coordinate of a
point in BE .
Now consider one of the corner regions, for example NE. Let p = (px , py ) be the corner in NE of any
arbitrary axis aligned rectangle containing smin . Note
that the number of points from BN E that the interior
of this rectangle contains is precisely the number of
BN E points dominated by p. Hence in our solution p
can dominate at most kN E points from BN E . Furthermore, the corner p of our solution dominates more than
kN E points of BN E if and only if our solution contains
a point lying on STk (BN E ). The following lemma implies that the kth level staircase looks like a regular
staircase (i.e. level 0) of some point set and hence we
can reduce to Problem 1.2.
Lemma 1.5. Let P be a set of m points. Then for any
integer k ≥ 0, there exists a set Q of O(m) points such
that STk (P ) = ST0 (Q). Moreover, STk (P ) (and hence
ST0 (Q)) can be computed in O(m log m) time.
sorting is lower bound), this implies Problem 1.1 can
be solved in O(n + m log m) time with O(m + n) space.
Note that Problem 1.2 is never directly stated in
previous work. By extracting a clear statement of this
problem, here we are able to solve several extensions of
Problem 1.1, again by reducing to Problem 1.2.
Problem 1.3. Input: A set R of n red points and a
set B of m blue axis aligned rectangles.
Goal: Find the maximum area rectangle containing all
red points and not intersecting any blue rectangle.
We reduce Problem 1.3 to Problem 1.1, the correctness of which follows from the logic of the above reduction from Problem 1.1 to Problem 1.2.
Consider a side region, say E. Let BE be the subset
of blue rectangles which intersect E. As the intersection with the region E of any axis aligned rectangle
containing smin is a vertical strip, such a solution rectangle intersects a rectangle b ∈ BE if and only if that
rectangle contains (one of) the leftmost point(s) in b.
Hence we can replace each blue rectangle in BE with
any point on its left boundary that lies in the region E,
and so again the right side of smax will be determined
by the leftmost point in this set.
Now consider one of the corner regions, for example
NE. Let BN E be the subset of blue rectangles contained
in the regions NE. (Any rectangle intersecting but not
contained in NE is ignored as it is handle by a corresponding side region.) Let p be the corner in NE of any
axis aligned rectangle containing smin , and let b be any
rectangle in BN E . Note that this rectangle with corner
p intersects b if and only if p dominates the lower left
corner of b. Hence if we replace each blue rectangle in
BN E with its lower left corner, the same reduction to
the staircase of these points as above will work.
Note that finding the largest empty rectangle among
arbitrary obstacles takes O(n log2 n) time [NSB94].
By the same argument as for Problem 1.1, we have:
Theorem 1.6. Problem 1.3 can be solved in O(n +
m log(m)) time. Problem 1.4 can be solved in O(n +
m log(m)) time for a given distribution of the k outliers
within the regions. The space is O(n+m) in both cases.
References
[AD16]
B. Armaselu and O. Daescu. Maximum
area rectangle separating red and blue
points. In Proc. 28th Canadian Conf. on
Comput. Geom., pages 244–251, 2016.
Problem 1.4. Input: A set of n red points, a set of [KMNS12] H. Kaplan, S. Mozes, Y. Nussbaum, and
m blue points, and an integer parameter k ≥ 0.
M. Sharir. Submatrix maximum queries in
Goal: Find the maximum area rectangle that contains
monge matrices and monge partial matriall red points and contains ≤ k blue points.
ces, and their applications. In Proc. 23rd
Annual ACM-SIAM Symp. on Discrete AlLet k be the number of allowed outliers (k is asgorithms, pages 338–355, 2012.
sumed to be very small relative to m). We will assume we know how k is divided among the 8 regions [NSB94] S.C Nandy, A. Sinha, and B.B. BhatN,E,S,W,NE,SE,SW,NW. There are O(k 7 ) ways to
tacharya. Location of the largest empty
place k items into 8 distinct bins, hence trying all parrectangle among arbitrary obstacles. In
titions of k increases the final running time by O(k 7 ).
Proc. Conf. on Found. Soft. Tech. and
To reduce Problem 1.4 to Problem 1.2, we mimic the
Theor. CS, pages 159–170, 1994.
above reduction of Problem 1.1 to Problem 1.2. For a
2