Fréchet Distance in Unweighted Planar Graphs
Abstract
The Fréchet distance is a distance measure between trajectories in or walks in a graph . Given constant-time shortest path queries, the Discrete Fréchet distance between two walks and can be computed in time using a dynamic program. Driemel, van der Hoog, and Rotenberg [SoCG’22] show that for weighted planar graphs this approach is likely tight, as there can be no strongly-subquadratic algorithm to compute a -approximation of unless the Orthogonal Vector Hypothesis (OVH) fails.
Such quadratic-time conditional lower bounds are common to many Fréchet distance variants. However, they can be circumvented by assuming that the input comes from some well-behaved class: There exist -approximations, both in weighted graphs and in , that take near-linear time for -packed or -straight walks in the graph. In there also exists a near-linear time algorithm to compute the Fréchet distance whenever all input edges are long compared to the distance.
We consider computing the Fréchet distance in unweighted planar graphs. We show that there exist no strongly-subquadratic -approximations of the discrete Fréchet distance between two disjoint simple paths in an unweighted planar graph in strongly subquadratic time, unless OVH fails. This improves the previous lower bound, both in terms of generality and approximation factor. We subsequently show that adding graph structure circumvents this lower bound: If the graph is a regular tiling with unit-weighted edges, then there exists an -time algorithm to compute . Our result has natural implications in the plane, as it allows us to define a new class of well-behaved curves that facilitate -approximations of their discrete Fréchet distance in subquadratic time.
Keywords and phrases:
Fréchet distance, planar graphs, lower bounds, approximation algorithmsCopyright and License:
2012 ACM Subject Classification:
Theory of computation Computational geometry ; Theory of computation Design and analysis of algorithms ; Theory of computation Graph algorithms analysisFunding:
This work was supported by the Independent Research Fund Denmark grant 2020-2023 (9131-00044B) “Dynamic Network Analysis”, the Carlsberg Foundation Young Researcher Fellowship CF21-0302 “Graph Algorithms with Geometric Applications”, the VILLUM Foundation grant (VIL37507) “Efficient Recomputations for Changeful Problems”, and the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No 899987.Editors:
Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz HermanSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
The Fréchet distance is a widely used metric for measuring the similarity between trajectories. It is often illustrated through a metaphor: imagine a person walking along one trajectory and their dog following another, connected by a leash. The Fréchet distance is the minimum possible leash length over all synchronized traversals of both trajectories.
This metric has numerous applications, particularly in movement data analysis [10, 18, 24, 15, 5, 13, 25, 33]. It is versatile, having been applied to handwriting recognition [29], coastlines [26], geometric shapes in geographic information systems [16], and trajectories of moving objects such as vehicles, animals, and athletes [28, 30, 6, 13]. We consider the discrete Fréchet distance, where trajectories are modeled as sequences of discrete points.
Alt and Godau [2] were the first to analyse the Fréchet distance from a computational perspective. They considered trajectories as polygonal curves in with and vertices, and compute the continuous Fréchet distance in time. Later, Buchin, Buchin, Meulemans and Mulzer [11] introduced a faster randomized algorithm, achieving a running time of on a real-valued pointer machine and on a word RAM. For the discrete Fréchet distance, Eiter and Mannila [20] presented an time algorithm under constant-time distance computations. Agarwal, Avraham, Kaplan, and Sharir [1] later improved this to in the word RAM.
Driemel, van der Hoog, and Rotenberg [19] initiate the study of Fréchet distance in graphs. They consider as input a (weighted) graph where a trajectory is a walk in the graph. The distance between two vertices is the length of their shortest path. Given a constant-time distance oracle, the discrete Fréchet distance between any two walks in can then be computed in time using the algorithm by Eiter and Mannila [20].
Conditional Lower Bounds.
Several conditional lower bounds exist for computing the Fréchet distance or its constant-factor approximations. These results rely on complexity assumptions such as the Orthogonal Vector Hypothesis (OVH) and the Strong Exponential Time Hypothesis (SETH) [32]. Bringmann [7] established that no algorithm can compute the (discrete or continuous) Fréchet distance between two polygonal curves of vertices in time for any , unless OVH fails. The same lower bound holds for small constant-factor approximations. Bringmann’s proof originally involved self-intersecting curves in the plane, but later work by Bringmann and Mulzer [9] extended the result to intersecting curves in . Buchin, Ophelders, and Speckmann [12] further demonstrated that the same lower bound applies for any better-than-3-approximation algorithm for pairwise disjoint planar curves in , or intersecting curves in .
Bringmann’s lower bound [7] holds also for unbalanced inputs: given two curves with and vertices in the plane, no algorithm can compute the Fréchet distance in time assuming OVH. Driemel, van der Hoog and Rotenberg [19] give a similar lower bound for paths in a weighted planar graph. They prove that, unless OVH fails, no -time algorithm can -approximate the discrete Fréchet distance between arbitrary paths in a weighted planar graph – even if the ratio between smallest and highest weight is bounded by a constant. This lower bound applies only to weighted graphs and does therefore not exclude the existence of a fast algorithm on unweighted planar graphs. A closer inspection of their argument reveals that their proof cannot simply be adapted to the unweighted case by subdividing long edges often enough. In this case, new vertices get introduced to the graph and their arguments break down.
Avoiding lower bounds through well-behaved curves.
These lower bounds can be circumvented if the input is well-behaved. Driemel, Har-peled and Wenk [17] consider three classes of curves in which are well-behaved as long as their corresponding behavioural parameter is low. These are -packed curves [17, 8], -low density curves [17], and -bounded curves [3, 4, 17]. They show algorithms to compute a -approximation between two well-behaved curves whose running time is near-linear in and . Gudmundsson, Mirzanezhad, Mohades, and Wenk consider the special case where all edges of the input curves are long with respect to their Fréchet distance [23]. In this case, the Fréchet distance can be computed in time [23]. Driemel, van der Hoog, and Rotenberg [19] show that if the input are walks in a graph and one of the walks is restricted to a -packed or -straight path, then there exists -approximations that take near-linear time.
Contribution.
Driemel, van der Hoog, and Rotenberg [19] ruled out a strongly subquadratic algorithm for a -approximation between paths in a weighted graph, while the construction by Buchin, Ophelders, and Speckmann [12] rules out a strongly subquadratic algorithm for a -approximation between walks in an unweighted planar graph. We consider the discrete Fréchet distance between paths in an unweighted planar graph. We prove (Theorem 5) that no strongly-subquadratic -approximation algorithm exists unless OVH fails, thereby improving both the generality (and also the approximation factor for planar graphs).
Next, we prove that adding graph structure circumvents this lower bound. If is an unweighted regular tiling of the plane, then there exists an -time algorithm to compute the Fréchet distance , between curves of length and . Our results have natural implications in the plane, for a special class of well-behaved curves (-curves, to be defined). For those, we can compute the Fréchet distance under the metric (respectively, approximate it for any metric) in time (respectively, time). For completeness, we explain the continuous analogy to -curves in the full version of this paper. We also compare this new curve class to existing well-behaved curve classes in the full version.
2 Preliminaries
Let be an unweighted graph where is its vertex set. We define and as two paths in . A path cannot visit a vertex twice. For integers with we denote by the subpath of from to . We define the discrete Fréchet distance between and as follows [19]: A sequence of pairs of indices is a monotone walk if for all we have and . Let be the set of all monotone walks from to . The cost of is the maximum of over , where denotes the length of the shortest path between vertices. is the minimum cost of a walk in .
Decision variant.
We focus on the decision variant where the input includes some and the goal is to output whether . The -free space matrix is the by matrix where is if and otherwise. We follow geometric convention, where denotes the column of (column corresponds to some . Column entries with value correspond to with ). Eiter and Mannila [20] define a directed graph over where there is an edge from to if and only if , and . They prove that if and only if there exists a directed path from to in this graph.
Orthogonal vectors.
Our conditional lower bound reduces from the Orthogonal Vector Hypothesis. The input consists of two ordered sets of -dimensional Boolean vectors of sizes and . We denote for by its ’th component. The OV problem is to find out if some vector of is orthogonal to some vector of .
Definition 1 (Williams [32]).
The orthogonal vector hypothesis (OVH) states that for all , there exists constants and such that the OV problem for vectors of dimension and cannot be solved in time.
We consider each vector in (or ) as a string of bits. We denote by and the concatenation of all strings in and , respectively. A substring of some string is the sequence for some .
Regular tilings.
A regular tiling is an infinite plane graph where each face is a regular polygon and each face has the same degree. There exist exactly three regular tilings [22]: the triangular, square, and hexagonal tiling (Figure 1). Without loss of generality, we assume that our tilings are axis-aligned. A face of is an open region bounded by the edges of , we denote by its closure. The edge length of is the length of any edge. A tiling is unit if its edges have unit length. A path in is a path in its corresponding graph. We always denote by a unit tiling where is a vertex of . For any pair of vertices of , the term denotes the distance in the graph . We assume that we can compute in constant time. Our algorithm considers what we will call a super-tiling of and a natural partition of the edges of and into subpaths.
Definition 2 (Figure 1 (b)).
Given a regular tiling of the plane, a super-tiling of is a regular tiling of the plane whose vertex set is a subset of the vertex set . The boundary vertices are the vertices of that lie on the boundary of some face of .
Definition 3.
Consider a regular tiling , some super-tiling and a path in , we define the breakpoints as all vertices in .
Given a path in a tiling and a super-tiling of , we want to consider how splits into smaller snippets, each snippet “belonging” to a face of . More formally:
Definition 4 (Figure 2).
Consider a regular tiling and a super-tiling of . Given a path in , let . We define the induced subpaths as all subpaths , for consecutive . Note that for each induced subpath, there exists a (not necessarily unique) face in whose closure contains it; we say the induced subpath is assigned to one such face (breaking ties arbitrarily).
Submatrices of .
We show a subquadratic algorithm to decide whether if and are paths in a tiling . We compute a monotone walk from to in by efficiently propagating reachability information across submatrices of . For integers and with and we denote by the submatrix of that consist of all entries for . We define the bottom-left facets of as all entries and . The top-right facets are defined as the entries and .
-curves.
Finally, we introduce a new class of well-behaved curves in the plane. Intuitively, an -curve, for small , is a curve composed of short edges that does not revisit the same region of the plane too frequently. Formally, fix a universal constant . Let be a curve in the plane, and let denote the set of all balls (in Euclidean metric) of radius centred at the vertices of . We say that is an -curve if all its edges have length at most , and any point in the plane lies in at most balls from .
For any given pair , is determined. As decreases, so may . If remains large for small , then many vertices of are densely clustered – i.e., effectively, the curve frequently revisits the same locations. We present an exact algorithm for the Discrete Fréchet distance under the metric with a linear dependency on . We assume that the input specifies a desirable value of , and that this yields a favourable corresponding . Imposing that is constant amounts to requiring that the curve does not revisit any -ball more than a constant number of times – a restriction that somewhat resembles the well-studied -packed curves [17, 19, 8]. In the full version of this paper, we discuss in detail how our new class relates to the prior well-behaved curve classes.
3 A lower bound for paths in an unweighted planar graph
Let be an unweighted planar graph and and be paths in . We show a lower bound, conditioned on OVH, that excludes any strongly subquadratic algorithm to compute a -approximation of . Since we are space-restricted, we present our argument only in the full version of this paper. Here, we assume that the reader is familiar with how these lower bounds are typically constructed [7, 12, 19, 9] and only mention how our construction differs from prior works. We start with some OV instance . We build an unweighted planar graph and two paths and in such that if and only if the OV instance is a yes-instance and otherwise. One novelty of our approach is a preprocessing step, where we transform into an equivalent instance with additional properties:
Lemma 1.
An instance of OV can be preprocessed in time, resulting in a new instance with such that:
-
a yes-instance stays a yes-instance and a no-instance stays a no-instance,
-
for all , and for all , ,
-
if the instance is a no-instance, then the vector is not only non-orthogonal to every , but even non-orthogonal to all consecutive length- substrings of .
This preprocessing significantly simplifies our proofs and may be of independent interest. Previous lower bound constructions [7, 19, 12, 9] fix some . Given an OV-instance , they construct curves by constructing for each a subcurve and each a subcurve (see Figure 3). The construction has a very strong property: Consider a traversal of and where the person and the dog remain within distance of one another. If the person is in for some and the dog is in for some then neither the person or the dog can stand still if the other moves.
Requiring the planar graph to be unweighted significantly restricts the freedom we have in engineering the pairwise distance between vertices. We are unable to recreate an equally strong property and instead obtain a much weaker statement: If the person is traversing the subpath for some and the dog is traversing for some and the person moves at least two steps then the dog has to move at least one. We rely upon our preprocessing to then still argue that there exists a traversal of and such that the leash length is at most if and only if there is an orthogonal pair .
Theorem 5.
Let and be paths in an unweighted planar graph. Let and for some constant . Then for all , one cannot approximate by a factor better than in time unless OVH fails.
4 Upper bound
We show that subquadratic algorithms do exist for unweighted planar graphs that exhibit additional structure. Specifically, our main result is as follows:
Theorem 6.
Let be a regular unit tiling and be paths in with and . Given , we can output whether in time.
We compute as follows. Given , we compute the smallest axis-aligned rectangles and that contain and , respectively, in time. Let be the Euclidean length of the shortest segment with and , and let be the Euclidean length of the longest such segment. Observe that , that this range contains integers, and that is always integral. By performing a binary search over , applying Theorem 6 at each step, we obtain:
Corollary 7.
Let be a regular unit tiling, and let and be paths in with and . Then can be computed in time.
Additional definitions.
To prove Theorem 6, we first introduce a few new concepts. Let be a regular, unit, axis-aligned tiling. Based on , we construct a super-tiling of the same type as , that is, if is a square/triangular/hexagonal tiling, then is also a square/triangular/hexagonal tiling. We state our results in general terms, but for ease of reading, the reader may assume is a square tiling. For a (super) tiling , we define the halfslabs of any face of by picture (Figure 4).
Definition 8.
Let be a regular tiling, and let be a super-tiling of . We say that two faces and of are well-separated by a vertex if, for all and , there exists a shortest path from to in that passes through .
Having faces be well-separated proves to be very useful, since in such a pair the distance between some vertex and can be well-understood. We provide an efficient algorithm to compute the pairwise Fréchet distance between subpaths of and whenever their corresponding faces in are well-separated. We identify a sufficient condition that ensures that some pair is well-separated, based on the alignment of the two:
Definition 9.
Let be a regular tiling. Two faces and of are aligned if intersects a halfslab of (or intersects a halfslab of ).
Lemma 10.
Let be an axis-aligned regular unit tiling, and let be a super-tiling of of the same type as . Any two faces of that are not aligned are well-separated by a vertex .
Proof.
Consider first the case where is a square tiling (and so is too). The situation is depicted in Figure 5 (a). If the faces are not aligned, then is contained in one of the four regions of the plane formed by the halfslabs of . Let be the vertex at the apex of the region which contains . We claim that for any vertices and , there exists a shortest path between and that passes through . Hence and are well-separated. The claim is easy to see from the properties of shortest paths in grid graphs. We provide an alternative proof of the claim, with the advantage that it can be more easily generalized to the triangular and hexagonal grid. See Figure 5 (b) and consider for the circles of radius in the plane graph centred around , and .
We can see that can be described as diamonds with four sides. Let us among the four sides of denote by the side that is facing towards . Likewise, let us among the four sides of denote by the side that is facing towards . Note that all of are parallel for . Let denote the line through vertex parallel to the . Let be minimal such that touches . Since is parallel to , we have . Furthermore, no matter which was chosen as the centre of the circles , we always have . This follows due to the way and the angle in which the circles expand. Analogously, let be minimal such that touches . Due to the way the expand and since and are not aligned, we have . Now, the circle is entirely on one side of , the circle is entirely on the other side, and . By definition of , this implies and there is a shortest path between that passes through .
For the case of triangular and hexagonal grids, the situation is depicted in Figures 6 and 7. Here the halfslabs divide the plane into 6 cone-shaped regions . Let be the point at the apex of for . Note that is also a vertex of . For both the triangular and hexagonal grid, the definitions of can be made in an analogous matter. Analogously, it follows that which concludes the lemma.
Algorithm overview.
Given and paths and , we first compute a suitable super-tiling:
Lemma 11.
Let be a regular unit tiling, and let and be two paths in of lengths and . In time, we can compute a super-tiling such that:
-
the edges of have a length in , and
-
the total number of induced subpaths in (see Definition 4) is .
Proof.
Our proof is inspired by that of Chan and Rahmati [14, Lemma 1], who prove an analogous statement for grids and curves in higher-dimensional real space (without graphs). For the proof, we assume without loss of generality that is axis-aligned.
Let , and let be any axis-aligned super-tiling of with an edge length in . For each , define to be the super-tiling obtained by shifting by the vector if is square, or by if is triangular or hexagonal. These shifted super-tilings remain axis-aligned super-tilings of , as all their vertices align with those of .
Since we shift in a direction not aligned with any edge of , and since , each edge or vertex of lies on the boundary of faces across the family . It follows that for any discrete vertex set with , there exists some such that only vertices lie on boundaries of faces in . Therefore, there exists a super-tiling such that the total number of boundary vertices from and is , which implies induced subpaths. To compute , we iterate over all vertices of and and, for each, determine the super-tilings with by iterating over all . This takes total time. We then select the super-tiling that minimizes .
Let be the computed super-tiling of . We partition and into induced subpaths, denoted by and . These subpaths naturally induce a subdivision of the free-space diagram into rectangular submatrices , where and (see Figure 8(a)).
Our algorithm makes use of a wave-front method. We define a wave-front as a monotone walk through the grid that separates from . At each grid point , we store a Boolean value indicating whether there exists a monotone walk from to such that all points on lie in free space: that is, for all (Figure 8(b)).
An update to the wave-front selects a pair of subpaths such that the bottom and left facets of the submatrix lie on the current wave-front. The update removes these facets from and inserts the top and right facets instead. To perform the update, we consider the faces and of that , respectively , are assigned to, and proceed via a case distinction:
-
1.
If and are not aligned, then they are well-separated by a vertex (by Lemma 10), and we show how to perform a fast update using .
-
2.
If and are aligned, we perform a brute-force update and use a counting argument to bound the total running time of these updates.
We analyse both cases separately, observing that while some instances may involve only Case 1 or only Case 2 submatrices, we can independently bound the total cost for each case.
Case 1: Updating with where and are not aligned.
We show an update algorithm that is near-linear in the perimeter of the submatrix .
Lemma 12.
Let and be subpaths whose faces and in are not aligned. Then the corresponding wave-front update can be performed in time, where .
Proof.
By Lemma 10, the subcurves and are well-separated by some vertex , which we can identify in constant time. Given , we compute two curves in whose -free space matrix equals . We define these curves as follows.
For a point we let . Likewise, for a point , we let . Note the difference in sign. Because and are well-separated by , we have for any and . We let and .
Case 2: Updating with where and are aligned.
For aligned face pairs, we fall back on a brute-force update strategy based on switching cells, a concept introduced by Har-Peled, Knauer, Wang and Wenk. [4].
Definition 13 (Switching cells).
A cell in is a switching cell if , but either or (or both).
The switching cells in a submatrix allow for a direct update of the wave-front:
Lemma 14 ([4]).
Let and be two subpaths. Given all switching cells in , a brute-force wave-front update takes time.
We apply the brute-force update algorithm to all subpath pairs whose associated faces and in are aligned. We now show that the total number of switching cells encountered in these submatrices is not too large:
Lemma 15.
Let be a regular unit tiling, and let and be two paths in . Let be any super-tiling of with edge length . Then there are at most pairs such that is a switching cell and and lie on aligned faces of . We can compute these pairs in time.
Proof.
Fix a vertex and let be a face of such that . Since and are paths in a unit tiling, a switching cell occurs only if lies at distance exactly from .
Let denote the set of all vertices at distance exactly from . This set lies on the boundary of a shape whose geometry depends on the tiling type:
-
is the boundary of a diamond if is a square tiling.
-
is the boundary of a regular hexagon if is a triangular tiling.
-
is the boundary of a (non-regular) hexagon if is a hexagonal tiling.
These regions are convex. Consider a face of that is aligned with . The intersection of with contains at most vertices. Each of these vertices could correspond to at most one vertex where is a switching cell. There are only faces of that are aligned with , whose closures intersect . Hence, there are at most such values per . Summing over all vertices of gives the desired bound.
What remains is to compute these pairs . We preprocess in a membership query data structure. For each , we select its assigned face in constant time and we identify the faces of that are aligned with and intersect in constant time. For every such face , we iterate over the vertices in . We find if there exists a with in time through a membership query. If so, then we compute and to determine whether is a switching cell. We are now ready to prove our main theorem:
Theorem 6. [Restated, see original statement.]
Let be a regular unit tiling and be paths in with and . Given , we can output whether in time.
Proof.
Given , , and , we begin by applying Lemma 11 to compute in time a super-tiling and the corresponding subpaths and . The number of subpath pairs is . For each pair, we determine if the corresponding faces and in are aligned, which takes total time.
The product set induces a grid of rectangular submatrices of with rows and columns. Thus:
| (1) |
Next, we initialize the wave-front by computing the first row and first column of , i.e., all entries for and for , in time. We then iterate diagonally through all pairs in and perform a wave-front update for each pair.
5 The discrete Fréchet distance under the metric
We extend our techniques for paths in tilings to curves in the plane. Fix some universal constant and fix some value . We consider under the metric, and two polygonal curves and with and vertices, respectively. In full generality, we only require that all edges in have length at most and that is an -curve. Denote their discrete Fréchet distance under the metric by . We show that we can compute in time. We adapt this algorithm in the full version of this paper, to make it work for any metric, by allowing some inaccuracy.
Our approach.
Given some , we first show how to decide whether using the wave-front propagation technique from Section 4, with suitable modifications for curves in the plane. Let be a parameter to be determined later. We define an axis-aligned square tiling of the plane where each square has edge length .
Definition 16.
We define the breakpoints of as the set of vertices such that some edge of incident to intersects an edge of .
Note that may contain overlapping but distinct vertices of (since an -curve may visit the same point up to times). If we remove all edges from which intersect some edge of , we see that the breakpoints induce a partition of the vertices of into pairwise vertex-disjoint subcurves , each fully contained in the closure of a face . We refer to these subcurves as the induced subcurves and we assign each induced subcurve to a face in . We prove that for a suitable choice of , the total number of induced subcurves satisfies .
We then apply our wave-front algorithm over the product set . For a pair of subcurves , let and denote their respective containing faces in . We distinguish two cases:
Balancing the choice of is critical: a larger reduces the number of wave-front updates, while a smaller reduces the number of switching cells encountered. We choose to optimize the overall running time.
Choosing a tiling.
We construct a tiling such that it creates few induced subcurves.
Lemma 17.
Given , we can compute in time a square tiling of edge length such that the number of induced subcurves satisfies .
Proof.
The proof mirrors that of Lemma 11. Let be an axis-aligned square tiling with edge length , and let denote the tiling obtained by shifting by for . We required that each edge of or has length at most . Thus each edge intersects the boundary of at most of the shifted tilings. It follows that there exists an index such that induces only breakpoints across and .
To find , we iterate over all edges of and . For each edge, we test for intersection with each of the candidate tilings in constant time. This gives an overall running time of to find the tiling that minimizes .
Wave-front updates.
Unlike in Section 4, the subcurves in are vertex-disjoint. Thus, we never have a submatrix whose bottom-left facet coincides with the current wave-front . However, we can always find a submatrix where each of the cells on the bottom-left facet of is adjacent to a cell in . We extend to cover it in time via brute force and thereby define wave-front updates analogously.
Case 1: Updating with where and are not aligned.
Our key observation is that, even though the edges of and do not coincide with , a pair of faces of are still well-separated whenever they are not aligned:
Lemma 18.
Let and be subcurves whose faces and in are not aligned. Then the corresponding wave-front update can be performed in time, where .
Proof.
Assume, without loss of generality, that the bottom-left corner of lies above and to the right of the top-right corner of . Then any shortest path from a point in to one in may be rerouted through that corner. The rest follows from Lemma 12.
Case 2: Updating with where and are aligned.
We upper bound the number of switching cells where and lie in aligned faces of :
Lemma 19.
Let be the tiling from Lemma 17. Then there are at most pairs such that is a switching cell and and lie in aligned faces of . We can compute these pairs in time.
Proof.
We preprocess by snapping its vertices to a square grid of edge length , forming . Each vertex in corresponds to original vertices since is an -curve. We store in a spatial data structure (e.g., a lexicographically sorted balanced binary tree), where a query point returns all corresponding to in time.
Recall that all edges of have length at most . Fix a vertex and let be a face of that contains . Let be the metric circle (under the metric) of radius centred at . Let denote a ball with radius and be the metric annulus that is the Minkowski-sum . Observe that an edge of intersects only if one of its corresponding vertices and of lies in .
There are faces of that are aligned with and that intersect . Let . Distinguishing between and , we see that has an area of and therefore contains at most vertices of . We iterate over the vertices in and for each we perform a membership query on . This returns vertices of . For each reported vertex we test if is a switching cell in constant time. Thus, for any , we compute all switching cells that correspond to the lemma statement in time.
Theorem 20.
Let and be two curves in under the metric with and . Fix a universal constant . For (with ) and , if has edge length at most and is an -curve, then we can compute whether in time.
Proof.
Let be a value that we set later. Given and , we apply Lemma 17 to compute in time our tiling and the induced subcurves and . The product set induces a grid over with rows and columns. Thus:
| (2) |
Computing .
Given and , there is a set of values , which can be computed in time, such that . The classical algorithm to compute performs binary search over . Since we want to use subquadratic time, we cannot compute the set explicitly. Instead, we represent as the Cartesian sum of two sets of values. The Cartesian sum of and is the multiset . We can use existing techniques [21, 27] for selection in Cartesian sums to binary search over the Cartesian sum without explicitly computing its elements.
Specifically, we define and as follows. The set contains, for each point , the four values , , and . The set is defined analogously for points in . For all , the distance between and is the sum of an element in and an element in . That is, their distance is an element of . Hence, .
After sorting and , we can compute the smallest value in , for any given , in time [21, 27]. We binary search over the integers , and for each considered integer , we compute the smallest value in . Then we use our decision algorithm (Theorem 20) to decide whether to guide the search to . Thus, we obtain the following result:
Corollary 21.
Given , let and be curves in under with . For any , if has edge length at most and is an -curve, then can be computed in time.
References
- [1] Pankaj K Agarwal, Rinat Ben Avraham, Haim Kaplan, and Micha Sharir. Computing the discrete Fréchet distance in subquadratic time. SIAM Journal on Computing, 43(2):429–449, 2014. doi:10.1137/130920526.
- [2] Helmut Alt and Michael Godau. Computing the Fréchet distance between two polygonal curves. International Journal of Computational Geometry & Applications, 5(01n02):75–91, 1995. doi:10.1142/S0218195995000064.
- [3] Helmut Alt, Christian Knauer, and Carola Wenk. Comparison of distance measures for planar curves. Algorithmica, 38(1):45–58, 2004. doi:10.1007/s00453-003-1042-5.
- [4] Boris Aronov, Sariel Har-Peled, Christian Knauer, Yusu Wang, and Carola Wenk. Fréchet distance for curves, revisited. In European Symposium on Algorithms (ESA), pages 52–63, 2006. doi:10.1007/11841036_8.
- [5] Yoonsik Bang, Jiyoung Kim, and Kiyun Yu. An improved map-matching technique based on the Fréchet distance approach for pedestrian navigation services. Sensors, 16(10), 2016. doi:10.3390/s16101768.
- [6] Sotiris Brakatsoulas, Dieter Pfoser, Randall Salas, and Carola Wenk. On map-matching vehicle tracking data. In International Conference on Very Large Data Bases (VLDB), pages 853–864, 2005. doi:10.5555/1083592.1083691.
- [7] Karl Bringmann. Why walking the dog takes time: Fréchet distance has no strongly subquadratic algorithms unless SETH fails. In IEEE Annual Symposium on Foundations of Computer Science (FOCS), pages 661–670, 2014. doi:10.1109/FOCS.2014.76.
- [8] Karl Bringmann and Marvin Künnemann. Improved approximation for Fréchet distance on c-packed curves matching conditional lower bounds. International Journal of Computational Geometry & Applications, 27(1-2):85–120, 2017. doi:10.1142/S0218195917600056.
- [9] Karl Bringmann and Wolfgang Mulzer. Approximability of the discrete Fréchet distance. Journal of Computational Geometry, 7(2):46–76, 2016. doi:10.4230/LIPIcs.SOCG.2015.739.
- [10] Kevin Buchin, Maike Buchin, David Duran, Brittany Terese Fasy, Roel Jacobs, Vera Sacristan, Rodrigo I Silveira, Frank Staals, and Carola Wenk. Clustering trajectories for map construction. In ACM International Conference on Advances in Geographic Information Systems (SIGSPATIAL), pages 1–10, 2017. doi:10.1145/3139958.3139964.
- [11] Kevin Buchin, Maike Buchin, Wouter Meulemans, and Wolfgang Mulzer. Four soviets walk the dog: Improved bounds for computing the Fréchet distance. Discrete & Computational Geometry, 58(1):180–216, 2017. doi:10.1137/1.9781611973402.103.
- [12] Kevin Buchin, Tim Ophelders, and Bettina Speckmann. SETH says: Weak Fréchet distance is faster, but only if it is continuous and in one dimension. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2887–2901, 2019. doi:10.5555/3310435.3310614.
- [13] Maike Buchin, Bernhard Kilgus, and Andrea Kölzsch. Group diagrams for representing trajectories. International Journal of Geographical Information Science, 34(12):2401–2433, 2020. doi:10.1145/3283207.3283208.
- [14] Timothy Chan and Zahed Rahmati. An improved approximation algorithm for the discrete Fréchet distance. Information Processing Letters (IPL), 138:72–74, 2018. doi:10.1016/J.IPL.2018.06.011.
- [15] Daniel Chen, Anne Driemel, Leonidas Guibas, Andy Nguyen, and Carola Wenk. Approximate map matching with respect to the Fréchet distance. In ACM Workshop on Algorithm Engineering and Experiments (ALENEX), pages 75–83, 2011. doi:10.1137/1.9781611972917.8.
- [16] Thomas Devogele. A new merging process for data integration based on the discrete Fréchet distance. In Advances in spatial data handling, pages 167–181, 2002. doi:10.1007/978-3-642-56094-1_13.
- [17] Anne Driemel, Sariel Har-Peled, and Carola Wenk. Approximating the Fréchet distance for realistic curves in near linear time. Discrete Computational Geometry, 48(1):94–127, 2012. doi:10.1007/s00454-012-9402-z.
- [18] Anne Driemel, Amer Krivošija, and Christian Sohler. Clustering time series under the Fréchet distance. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 766–785. SIAM, 2016. doi:10.5555/2884435.2884490.
- [19] Anne Driemel, Ivor van der Hoog, and Eva Rotenberg. On the discrete Fréchet distance in a graph. In International Symposium on Computational Geometry (SoCG), pages 36:1–36:18, 2022. doi:10.4230/LIPICS.SOCG.2022.36.
- [20] Thomas Eiter and Heikki Mannila. Computing discrete Fréchet distance. Technical Report CD-TR 94/64, Christian Doppler Laboratory for Expert Systems, TU Vienna, Austria, 1994.
- [21] Greg N. Frederickson and Donald B. Johnson. Generalized selection and ranking: Sorted matrices. SIAM Journal of Computing, 13(1):14–30, 1984. doi:10.1137/0213002.
- [22] Branko Grünbaum and Geoffrey Colin Shephard. Tilings and patterns. Courier Dover Publications, 1987. doi:10.5555/19304.
- [23] Joachim Gudmundsson, Majid Mirzanezhad, Ali Mohades, and Carola Wenk. Fast Fréchet distance between curves with long edges. International Journal of Computational Geometry & Applications, 29(02):161–187, 2019. doi:10.1145/3191801.3191811.
- [24] Richard Kenefic. Track clustering using Fréchet distance and minimum description length. Journal of Aerospace Information Systems, 11(8):512–524, 2014. doi:10.2514/1.I010170.
- [25] Maximilian Konzack, Thomas McKetterick, Tim Ophelders, Maike Buchin, Luca Giuggioli, Jed Long, Trisalyn Nelson, Michel A Westenberg, and Kevin Buchin. Visual analytics of delays and interaction in movement data. International Journal of Geographical Information Science, 31(2):320–345, 2017. doi:10.5555/3048386.3048392.
- [26] Ariane Mascret, Thomas Devogele, Iwan Le Berre, and Alain Hénaff. Coastline matching process based on the discrete Fréchet distance. In Progress in Spatial Data Handling, pages 383–400. Springer, 2006. doi:10.1007/3-540-35589-8_25.
- [27] Andranik Mirzaian and Eshrat Arjomandi. Selection in X+Y and matrices with sorted rows and columns. Information Processing Letters, 20(1):13–17, 1985. doi:10.1016/0020-0190(85)90123-1.
- [28] Roniel Sousa, Azzedine Boukerche, and Antonio Loureiro. Vehicle trajectory similarity: Models, methods, and applications. ACM Computing Surveys, 53(5), 2020. doi:10.1145/3406096.
- [29] E Sriraghavendra, K Karthik, and Chiranjib Bhattacharyya. Fréchet distance based approach for searching online handwritten documents. In Ninth International Conference on Document Analysis and Recognition (ICDAR), pages 461–465, 2007. doi:10.1109/ICDAR.2007.4378752.
- [30] Han Su, Shuncheng Liu, Bolong Zheng, Xiaofang Zhou, and Kai Zheng. A survey of trajectory distance measures and performance evaluation. Proceedings of the VLDB Endowment, 29(1):3–32, 2020. doi:10.1007/s00778-019-00574-9.
- [31] Thijs van der Horst, Marc van Kreveld, Tim Ophelders, and Bettina Speckmann. The geodesic Fréchet distance between two curves bounding a simple polygon. CoRR, abs/2501.03834, 2025. doi:10.48550/arXiv.2501.03834.
- [32] Ryan Williams. A new algorithm for optimal 2-constraint satisfaction and its implications. Theoretical Computer Science (TCS), 348(2-3):357–365, 2005. doi:10.1016/J.TCS.2005.09.023.
- [33] Dong Xie, Feifei Li, and Jeff M Phillips. Distributed trajectory similarity search. Proceedings of the VLDB Endowment, 10(11):1478–1489, 2017. doi:10.14778/3137628.3137655.
