Computing The Packedness of Curves

by   Sepideh Aghamolaei, et al.
Sharif Accelerator

A polygonal curve P with n vertices is c-packed, if the sum of the lengths of the parts of the edges of the curve that are inside any disk of radius r is at most cr, for any r>0. Similarly, the concept of c-packedness can be defined for any scaling of a given shape. Assuming L is the diameter of P and δ is the minimum distance between points on disjoint edges of P, we show the approximation factor of the existing O(log (L/δ)/ϵn^3) time algorithm is 1+ϵ-approximation algorithm. The massively parallel versions of these algorithms run in O(log (L/δ)) rounds. We improve the existing O((n/ϵ^3)^4/3n/ϵ) time (6+ϵ)-approximation algorithm by providing a (4+ϵ)-approximation O(n(log^2 n)(log^2 1/ϵ)+n/ϵ) time algorithm, and the existing O(n^2) time 2-approximation algorithm improving the existing O(n^2log n) time 2-approximation algorithm. Our exact c-packedness algorithm takes O(n^5) time, which is the first exact algorithm for disks. We show using α-fat shapes instead of disks adds a factor α^2 to the approximation. We also give a data-structure for computing the curve-length inside query disks. It has O(n^6log n) construction time, uses O(n^6) space, and has query time O(log n+k), where k is the number of intersected segments with the query shape. We also give a massively parallel algorithm for relative c-packedness with O(1) rounds.



There are no comments yet.


page 1

page 2

page 3

page 4


Fast Fréchet Distance Between Curves With Long Edges

Computing Fréchet distance between two curves takes roughly quadratic ti...

How Packed Is It, Really?

The congestion of a curve is a measure of how much it zigzags around loc...

Rectangular Partitions of a Rectilinear Polygon

We investigate the problem of partitioning a rectilinear polygon P with ...

Tangled Splines

Extracting shape information from object bound- aries is a well studied ...

Subtrajectory Clustering: Finding Set Covers for Set Systems of Subcurves

We study subtrajectory clustering under the Fréchet distance. Given one ...

Dispersing Facilities on Planar Segment and Circle Amidst Repulsion

In this paper we consider the problem of locating k obnoxious facilities...

Computing Maximum Independent Set on Outerstring Graphs and Their Relatives

A graph G with n vertices is called an outerstring graph if it has an in...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In 2012, Driemel et al. [9] introduced the realistic assumption of -packed curve as the curve for which the length of the curve within any disk of radius is at most (Definition 1), but without providing any algorithms for computing the -packedness of a curve or providing a solution to the problem of whether a given curve is -packed or not.

Definition 1 (-packed curve [9])

Let be a polygonal curve. If the length of within any disk of radius is upper bounded by , is -packed.

To simplify the explanations, we also define the following property:

Definition 2 (Packedness of a disk)

The packedness of a disk with respect to a curve is the length of inside , divided by the radius of .

After introducing this notation, fairly good approximation algorithms for -packed curves have been presented. Driemel et al. [9] have shown that if two curves are -packed, a -approximation of their Fréchet distance can be achieved in time. Bringmann and Künnemann further improved this running time to  [5]. Several other studies [6, 8, 10, 14, 2, 12] are justified and still rely on this assumption that the input curves are -packed.

Surprisingly, the problem of computing the minimum for which a curve is -packed remained open until recently when Aghamolaei et al. [2] formalized the problem (Definition 3) and gave an algorithm for approximating the minimum .

Definition 3 (Minimum for -packedness of a curve [2])

For a given polygonal curve of vertices, our objective is to compute the minimum value for which is -packed.

Aghamolaei et al. [2] provided a data structure called aggregated query diagram (AQD) for computing the length of the curve inside all translations of a query shape. The authors designed a -approximation algorithm for disks by approximating a disk with a regular polygon, and a -approximation algorithm for computing the -packedness within any convex polygon (without rotation), both with running time . Both algorithms in [2] rely on this observation that computing the -packedness of a curve by considering all the squares centred at a vertex of a curve gives a 2-approximation of the optimal solution.

Definition 4 (Aggregated Query Diagram (AQD)[2])

For a set of line segments and a polygonal shape , a partitioning of the plane with a set at each , is called an aggregated query diagram if for any point , the query shape with representative point intersects the subset of segments, and is minimized.

The number of the cells in an AQD that is created for a convex shape of complexity m is , and its total complexity is . Also, it takes time to construct the corresponding AQD of .

Later in [11], the authors provided approximation algorihtms for axis-aligned square queries, that were claimed to be a 2-approximation algorithm with running time in , and a -approximation algorithm with running time in . However, the algorithms of [11] compute the maximum packedness of disks centered at the vertices of the curve, which has an unbounded approximation factor with the -packedness of the curve.

We generalize the problem of computing the packedness of disks on the vertices of a curve to the packedness of the curve with respect to any arbitrary set of points:

Definition 5 (-Relative -Packedness)

For a set of points and a curve , if for any disk of centered at a point of , the length of the path inside the disk divided by its radius is at most , the curve is called an -relative -packed curve.

The notion of the -packedness can be generalized to any convex polygon of fixed orientation, where is the radius of . Then a uniform scaling of determines the uniform changes to the different radius of . In the following, we generalize the notion of -packedness to objects other than .

Definition 6 (Shape-Restricted -packed curve)

Let be a polygonal curve. Let the diameter of a convex shape be , and let define the radius of . If the length of within any placement of is upper bounded by , is shape-restricted -packed.


  • We prove that there exist curves for which the -packedness and the -relative -packedness with being the set of vertices of the curve, are not within any constant factor of each other.

  • We introduce an time exact algorithm for computing the minimum for which a given curve is -packed.

  • We show that there are no constant-factor approximation algorithms that solve the problem in sub-quadratic time in the worst-case and only use intersection informations to solve the problem.

1.1 A Summary of The Results

Continuous search algorithms [2] exist for this problem. In these algorithms, a continuous range of radii is searched and for each of them the set of disks of that radius with the maximum length inside it is determined. The maximum of all these values is reported as the solution. As computing the disk with maximum length of the path inside it, for a fixed radius, can be computed in polynomial time, the time complexity of these algorithms depends on their search range: the minimum and maximum candidate values for the radius of the disk. So, the time complexity is .

Table 2 summarizes the results on this problem.

Shape Algorithm Time Reference
circle -app Section 2.4
convex polygon (fixed complexity) -app [2]
circle -app [2]
circle exact Theorem 4.1
Table 1: A summary of results on computing -packedness of curves. is the length of the curve, and is the distance between the closest pair of points from different edges.
Shape Approximation Time Reference
-cube [11]
square [11]
Table 2: A summary of results on computing -relative -packedness of curves.

2 Extending Previous Works

2.1 The Black-Box Versions of The Algorithms of [2]

Some of the subroutines of the algorithms in [2] are used in a black-box manner and can be replaced by other routines. Here, we discuss those subroutines and their analysis.

Point-Location among Curves and Length Query

For a set of segments and a shape , the length query asks for finding the total sum of the lengths of the parts of the segments that lie inside   [2].

The time complexity of the length query using the algorithm of [2] is and using the algorithm of [1] is . In [2], the length query problem is converted into a point-location among a set of curves, by taking the Minkowski sum of the input polygonal curve with the query shape.

By substituting the time complexity of the point-location query in the AQD. Other point-location algorithms in a set of curves also exist [13, 15], but they either provide no theoretical guarantees or their theoretical guarantee is worse than the algorithm that we used.

A naive algorithm for computing a length query is to compute the length of every segment of the curve inside the query shape, and sum them. This takes a linear time in the number of edges of the curve, if the query shape has a constant complexity.

Popular Places

The objective of this problem is to find a translation that has the maximum coverage length of the curve.

Definition 7 (Maximum-Length Popular Places [2])

For a set of line segments and a polygonal shape , and two positive numbers (integer) and , the objective is to find a translation of such that at least segments are intersected by , and the length of the part of the intersecting segment inside is at least .

There also exists a definition for the popular places problem based on the number of the segments that are intersecting with the translations of an object [4].

Solving a popular places problem has two steps: (i) computing the AQD, and (ii) point location on the cells of AQD. Let denote the size of AQD.

AQD for disks

In [2], first, the Minkowski sum of the curve and the square of that radius is computed, then the results are divided into a set of line segments and a set of circles, finally the intersection of the line-segments is computed via line-sweeping and the intersection of disks of radius with the segments centered at the vertices of the path is computed by checking every (disk,edge) pair to see if they intersect. The number of intersections between the segments is , so, computing the length of the curve inside each of them by scanning the edges of the curve takes , resulting in time.


The algorithm has two steps:

  1. In the first step we compute a range for the candidate of the solution.

    • In the presented algorithm in [1], the range of radius is continues and varies from to , where is the closest pair distance between the points on different edges.

    • In Algorithm of Section 4, the range of search is discrete. This range is determined by events.

  2. In the second step, we check the packedness of the candidates from the first step. We can use any of the existing algorithms.

    • For each value of (from a discrete or continues range), we solve the popular places problem on .

    • For each event, we compute the length query.


  • Let denote the preprocessing time and be the size of an AQD data-structure in the arrangement of a set of curves. Note that the arrangement of the Minkowski sum of the shapes with the input curve has complexity , assuming the query shape has constant complexity.

    The time complexity of the length query algorithm is which is the number of candidate values checked to get a -approximation of the radius, times the time complexity of computing the AQD and checking its cells for the solution.

  • Let be the query time of a length query. The running time of the discrete algorithm is the number of events times the time complexity of computing the length query for each event, which is .

    For a set of disks, (see Section 4), and using the naive algorithm for length query , resulting in the time complexity .

Higher Dimensions

For a set of curves in , since the Minkowski sum is well defined in  [7], the AQD can be constructed by considering the intersection of a set of polyhedras. Then one can compute the cell with the maximum coverage lengths in in the worst case.

Parallel Computation

In the massively parallel computations (MPC) [3] data is distributed among a set of machines that process it during a set of parallel rounds and communicate with each other after each round.

The time complexity of the parallel version of computing the -packedness in MPC rounds is the logarithm of the range of the candidate radii checked by the algorithm which is , since the popular places problem can be solved in polynomial time after partitioning among the machines, if the condition that the number of intersections of the curve with a vertical line is at most  [2]. In [2], the round complexity is .

2.2 Approximating -packedness for Arbitrary Convex Polygons and Disks


The authors first compute a data structure called AQD, that is the arrangement of the Minkowski sum of the polygon with the input curves [2]. Then, they consider all the cells to find the one with the most coverage length of the curve. This algorithm takes time.


In [2], the authors approximate any disk that is a candidate of the -packedness by two regular polygons, one is inscribed in , and the other is circumscribing , i.e. the length of the curve within is bounded by the length of the curve inside the largest inscribed regular -gon in and the length of the curve inside the smallest circumscribing regular -gon of . If we set , the radius of the circumscribing circle of the regular -gon would be at most times the radius of the inscribed circle.

The running time of the -approximation in [2] equals , that is computed by the time cost of the search on the range of the radius, times the time complexity of solving the maximum length query problem for each radius (Algorithm 1 in this paper, Algorithm 3 in [2]).

1:A curve , a constant
2:The minimum for which is -packed
4: compute the length of the curve .
6:for  do
8:      a regular polygon with vertices
9:     cost= the maximum length query in the AQD of .
11:end for
Algorithm 1 Approximating -Packedness for Disks [2]

The complexity of the shape is . So, computing the maximum length query takes time, which takes the maximum of the length queries in the AQD cells. The running time of the algorithm is . For constant and , this is .

2.3 -Relative -Packedness

Approximating -relative -packedness for Squares and Hyper Cubes

Let be an axis-aligned square, and let denote the side length of . Let denote the -cube that determines the -packedness of . Suppose is the set of vertices of . Lemma 7 in [11] states that there exists a -cube centred at a vertex of , such that the length of the curve inside is at least times of the length of the curve inside , and gives a -approximation of the -packedness. It is proved in Theorem 3.1 that there exist some curves for which the computed -packedness with shapes centred at the vertices of are not within any constant factor of the real -packedness. Consequently, based upon Theorem 3.1, Lemma 7 of [11] gives a 2-approximation only for -relative -packed curves. We note that Theorem 3.1 implies that Lemma 12 in [11] also gives a -approximation for the -relative -packed curves, and not for general curves.

Theorem 2.1

Let be a polygonal curve, and let be any -cube centred at a vertex of . If the length of the curve inside is at least times of the length of the curve inside for any , then is -relative -packed.

Theorem 2.2

Let be a polygonal curve, and let be any square centred at a vertex of in one of the squares in a pair of the WSPD. If there exists a square for which the length of the curve inside is at least times of the length of the curve inside for any , then is -relative -packed.

Lemma 5 in [2] states that if a curve has length at most within all the disks of radius centred at a point of , then is -packed. The proof is done via the observation that any disk of radius that intersects and is a candidate to determine the -packedness, can be covered by a disk of radius centred at a point of , where its centre is in the intersection of two disks. This is correct since in the statement of the Lemma the -packedness assumption must be hold for any point on . Lemma 7 in [11] has been proved using a similar idea, but by only considering the vertices of .

2.4 Line Sweeping for Computing Packedness via Continuous Search

When the ratio , the continuous search algorithm outperforms the polynomial ones. So, we discuss this problem as well.

The sweeping events for the case where the center of the disk lies on the curve are when the disk intersects with an edge, or stops intersecting with it. The number of such events is , so sweeping over them takes time (similar to the construction of the AQD) and computing the length takes another time, in the worst-case.

Using the continuous search of [2] for approximating the minimum for which a given curve is -packed, we sweep the curve with a disk of that radius.

3 Relative Packedness of a Curve with Respect to a Point-Set

Theorem 3.1

There exist curves for which the -packedness and the -relative -packedness with being the set of vertices of the curve, are not within any constant factor of each other.


We show the result by using a counter-example. Build a regular -gon inside a circle of radius centered at , with vertices ordered in clockwise order. Let be the polygonal path that connects each to and to for . For , this path is shown in Figure 1.

Figure 1: The polygonal path of Theorem 3.1 and a disk centered at a vertex of the curve.

is an -packed curve, since the length of the curve inside any ball centered at is times its radius. For a vertex , let be the circle of radius centered at . The length of the curve inside this disk is . To get a contradiction, it is enough to set such that , which happens for .

The extension of the statement to the squares is obvious; one can consider the arbitrary big scale of the path, and consider the packedness of the square centered at , where the diameter of the square that is centered at is smaller than the largest edge of the path. Assuming is the diameter of a square that is centered at a vertex of the path. Then the same argument also holds for the squares.

4 A Polynomial-Time Exact Algorithm for -Packedness

The critical part of computing the -packedness is to find a circle that maximizes the ratio of the length of the curve inside it, to its radius. We give a polynomial set of disks that need to be checked in order to find the disk that gives the optimal value.

In [2], the authors show that determining the set of intersected segments (edges of the curve) by the candidate disk is enough to find it exactly. So, we focus on finding that set.

Observation 1

Any circle that has a point from each of the three segments contains the closest point of those segments to each other, and vise versa.

Let denote the smallest circle containing points , and . The indicator function is if condition is true, and otherwise.

1:for each  do
2:      the closest points of and to each other.
4:     for  do
5:          the point on segment with the smallest .
7:     end for
8:end for
Algorithm 2
Lemma 1

The recurrence relation of Algorithm 2 finds events for each pair of segments and .


Using induction on the number of segments, at step , we consider the segments .

The circle determined by and as the endpoints of its diameter is the base case. Based on creftypecap 1, since and are known, there are two cases:

  • determines a circle that was not given by any subset of , i.e. it is a new event.

  • determines the circle intersecting , i.e. there is no circle that intersect and but not any of .

This is all the possibilities of the segments being intersected, which is what the recurrence in the algorithm computes.

Similarly, the other endpoint of the segments can be considered for removing the segment from the set of intersected segments, and the number of events is still , since the number of involved endpoints in computing the events has changed from to .

Theorem 4.1

The number of events is .


Choosing two segments and has possibilities, and using Lemma 1, there are events for each of them. This is . Each event is counted at most via subroutines, which is .

For any of the computed events, we check in time which segments of are intersecting with the circle, and the algorithm runs in time.

5 Lower Bound

Theorem 5.1

There are no constant-factor approximation algorithms that solve the problem in subquadratic time in the worst-case and only use intersection informations to solve the problem.


Consider the example in Figure 2, which shows a path symmetric with respect to the center of two concentric circles of radii and , which is sandwiched between the circles, and . Because of the symmetric structure of the path, the events of each point are the same as any other point , in that the set of segments intersecting the event disk of after shifting by give the segments of the events of . So, the events of one vertex have no priority over other vertices. By changing the radius , and the built path accordingly, the set of events remains the same, since disks of any radius are checked. However, the solution changes from happening for a point on the circle of radius to a point on the circle of radius . By randomly perturbing some of the vertices by a small amount while keeping them on the same circle as before, the events do not change, however, their packedness does.

Figure 2: The polygonal path of Theorem 5.1.

The topology of the events does not change, when the solution changes. So, only algorithms that use a length threshold can distinguish these cases, without computing all the events. By scaling the shape, this threshold will also fail, unless it depends on a property of the curve, that is not affected by our transformation (changing the radius of ). In the worst-case the number of events is (see Lemma 1), which is the lower bound on the time complexity of intersection-based algorithms.

6 Open Problems

Another definition of finding popular places is to find a translation and scaling of the query shape with the maximum number of points, instead of the length of a curve. The same definition of event used for computing the -packedness can be used to solve this problem, which is the set of points that uniquely locate the shape. Also, the problem of finding the point with the maximum ply in a given set of equal disks and convex polygons without rotation can be solved using the same set of events.


  • [1] S. Aghamolaei. Point-location in the arrangement of curves. arXiv preprint arXiv:2007.11451, 2020.
  • [2] S. Aghamolaei, V. Keikha, M. Ghodsi, and A. Mohades. Windowing queries using Minkowski sum and their extension to MapReduce. Journal of Supercomputing, 2020.
  • [3] P. Beame, P. Koutris, and D. Suciu. Communication steps for parallel query processing. Journal of the ACM (JACM), 64(6):1–58, 2017.
  • [4] M. Benkert, B. Djordjevic, J. Gudmundsson, and T. Wolle. Finding popular places. International Journal of Computational Geometry & Applications, 20(01):19–42, 2010.
  • [5] K. Bringmann and M. Künnemann. Improved approximation for Fréchet distance on c-packed curves matching conditional lower bounds. In International Symposium on Algorithms and Computation, pages 517–528. Springer, 2015.
  • [6] D. Chen, A. Driemel, L. J. Guibas, A. Nguyen, and C. Wenk. Approximate map matching with respect to the Fréchet distance. In 2011 Proceedings of the Thirteenth Workshop on Algorithm Engineering and Experiments (ALENEX), pages 75–83. SIAM, 2011.
  • [7] A. Deza and L. Pournin. Diameter, decomposability, and minkowski sums of polytopes. arXiv preprint arXiv:1806.07643, 2018.
  • [8] A. Driemel and S. Har-Peled. Jaywalking your dog: computing the Fréchet distance with shortcuts. SIAM Journal on Computing, 42(5):1830–1866, 2013.
  • [9] A. Driemel, S. Har-Peled, and C. Wenk. Approximating the Fréchet distance for realistic curves in near linear time. Discrete & Computational Geometry, 48(1):94–127, 2012.
  • [10] A. Driemel and A. Krivošija. Probabilistic embeddings of the fréchet distance. In International Workshop on Approximation and Online Algorithms, pages 218–237. Springer, 2018.
  • [11] J. Gudmundsson, Y. Sha, and S. Wong. Approximating the packedness of polygonal curves. arXiv preprint arXiv:2009.07789, 2020.
  • [12] J. Gudmundsson and M. Smid. Fast algorithms for approximate Fréchet matching queries in geometric trees. Computational Geometry, 48(6):479–494, 2015.
  • [13] I. Hanniel and D. Halperin. Two-dimensional arrangements in cgal and adaptive point location for parametric curves. In International Workshop on Algorithm Engineering, pages 171–182. Springer, 2000.
  • [14] S. Har-Peled and B. Raichel. The Fréchet distance revisited and extended. ACM Transactions on Algorithms (TALG), 10(1):1–22, 2014.
  • [15] S. Har-Peled and M. Sharir. Online point location in planar arrangements and its applications. Discrete & Computational Geometry, 26(1):19–40, 2001.