Skip to main content
Log in

Translation Invariant Fréchet Distance Queries

  • Published:
Algorithmica Aims and scope Submit manuscript

Abstract

The Fréchet distance is a popular similarity measure between curves. For some applications, it is desirable to match the curves under translation before computing the Fréchet distance between them. This variant is called the Translation Invariant Fréchet distance, and algorithms to compute it are well studied. The query version, finding an optimal placement in the plane for a query segment where the Fréchet distance becomes minimized, is much less well understood. We study Translation Invariant Fréchet distance queries in a restricted setting of horizontal query segments. More specifically, we preprocess a trajectory in \({\mathcal {O}}(n^2 \log ^2 n)\) time and \({\mathcal {O}}(n^{3/2})\) space, such that for any subtrajectory and any horizontal query segment we can compute their Translation Invariant Fréchet distance in \({\mathcal {O}}({{\,\mathrm{polylog}\,}}n)\) time. We hope this will be a step towards answering Translation Invariant Fréchet queries between arbitrary trajectories.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

References

  1. Alt, H.: The computational geometry of comparing shapes. In: Efficient Algorithms, pp. 235–248. Springer, Berlin (2009)

  2. Alt, H., Godau, M.: Computing the Fréchet distance between two polygonal curves. Int. J. Comput. Geom. Appl. 5(2), 75–91 (1995)

    Article  Google Scholar 

  3. Alt, H., Knauer, C., Wenk, C.: Matching polygonal curves with respect to the Fréchet distance. In: STACS 2001, 18th Annual Symposium on Theoretical Aspects of Computer Science, Dresden, Germany, February 15–17, 2001, Proceedings, pp. 63–74 (2001)

  4. Bringmann, K.: Why walking the dog takes time: Fréchet distance has no strongly subquadratic algorithms unless SETH fails. In: Proceedings of the 55th IEEE Annual Symposium on Foundations of Computer Science, pp. 661–670 (2014)

  5. Bringmann, K., Künnemann, M.: Improved approximation for Fréchet distance on c-packed curves matching conditional lower bounds. Int. J. Comput. Geom. Appl. 27(1–2), 85–120 (2017)

    Article  Google Scholar 

  6. Bringmann, K., Künnemann, M., Nusse, A.: Fréchet distance under translation: conditional hardness and an algorithm via offline dynamic grid reachability. In: Proceedings of the 30th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 2902–2921 (2019)

  7. Buchin, K., Buchin, M., Meulemans, W., Mulzer, W.: Four Soviets walk the dog: improved bounds for computing the Fréchet distance. Discret. Comput. Geom. 58(1), 180–216 (2017)

    Article  Google Scholar 

  8. Buchin, M., van der Hoog, I., Ophelders, T., Silveira, R.I., Schlipf, L., Staals, F.: Improved space bounds for Fréchet distance queries. In: 36th European Workshop on Computational Geometry (EuroCG 2020) (2020)

  9. de Berg, M., Cook, A.F., Gudmundsson, J.: Fast Fréchet queries. Comput. Geom. 46(6), 747–755 (2013)

    Article  MathSciNet  Google Scholar 

  10. De Berg, M., Mehrabi, A.D., Ophelders, T.: Data structures for Fréchet queries in trajectory data. In: Proceedings of the 29th Canadian Conference on Computational Geometry (2017)

  11. Driemel, A., Har-Peled, S.: Jaywalking your dog: computing the Fréchet distance with shortcuts. SIAM J. Comput. 42(5), 1830–1866 (2013)

    Article  MathSciNet  Google Scholar 

  12. Fréchet, M.: Sur quelques points du calcul fonctionnel. Rendiconti del Circolo Matematico di Palermo (1884–1940) 22(1), 1–72 (1906)

  13. Gudmundsson, J., Mirzanezhad, M., Mohades, A., Wenk, C.: Fast Fréchet distance between curves with long edges. In: Proceedings of the 3rd International Workshop on Interactive and Spatial Computing, pp. 52–58 (2018)

  14. Gudmundsson, J., Smid, M.: Fast algorithms for approximate Fréchet matching queries in geometric trees. Comput. Geom. 48(6), 479–494 (2015)

    Article  MathSciNet  Google Scholar 

  15. Jiang, M., Xu, Y., Zhu, B.: Protein structure–structure alignment with discrete Fréchet distance. J. Bioinform. Comput. Biol. 6(1), 51–64 (2008)

    Article  Google Scholar 

  16. Keogh, E.J., Pazzani, M.J.: Scaling up dynamic time warping to massive datasets. In: European Conference on Principles of Data Mining and Knowledge Discovery, pp. 1–11 (1999)

  17. Laube, P.: Computational Movement Analysis. Springer Briefs in Computer Science. Springer, Berlin (2014)

  18. Megiddo, N.: Applying parallel computation algorithms in the design of serial algorithms. In: 22nd Annual Symposium on Foundations of Computer Science (SFCS 1981), pp. 399–408. IEEE (1981)

  19. Meulemans, W.: Similarity measures and algorithms for cartographic schematization. Ph.D. thesis, Technische Universiteit Eindhoven (2014)

  20. Ranacher, P., Tzavella, K.: How to compare movement? A review of physical movement similarity measures in geographic information science and beyond. Cartogr. Geogr. Inf. Sci. 41(3), 286–307 (2014)

    Article  Google Scholar 

  21. Ratanamahatana, C.A., Keogh, E.: Three myths about dynamic time warping data mining. In: Proceedings of the 2005 SIAM International Conference on Data Mining, pp. 506–510 (2005)

  22. Sriraghavendra, E., Karthik, K., Bhattacharyya, C.: Fréchet distance based approach for searching online handwritten documents. In: Proceedings of the 9th International Conference on Document Analysis and Recognition, vol. 1, pp. 461–465 (2007)

  23. Toohey, K., Duckham, M.: Trajectory similarity measures. SIGSPATIAL Special 7(1), 43–50 (2015)

    Article  Google Scholar 

  24. Wang, H., Su, H., Zheng, K., Sadiq, S., Zhou, X.: An effectiveness study on trajectory similarity measures. In: Proceedings of the 24th Australasian Database Conference, pp. 13–22 (2013)

  25. Wenk, C.: Shape matching in higher dimensions. Ph.D. thesis, Free University of Berlin, Dahlem, Germany (2003)

  26. Wylie, T., Zhu, B.: Protein chain pair simplification under the discrete Fréchet distance. IEEE/ACM Trans. Comput. Biol. Bioinform. 10(6), 1372–1383 (2013)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Joachim Gudmundsson.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

J. G. is supported under the Australian Research Council Discovery Projects funding scheme (project number DP180102870).

Appendix A: Improving the Number of Critical Values

Appendix A: Improving the Number of Critical Values

In order to show that it suffices to use a set of critical values of size \(\mathcal {O}(n)\) instead of \(\mathcal {O}(n^2)\) to compute \(p'\) and \(q'\), we look more formally at what property a candidate needs to satisfy.

Definition 1

A point s represents \(p_u\) if and only if there exists a non-decreasing continuous mapping \(\mu : \pi [u,v] \rightarrow pq\) such that \(\mu\) achieves the Fréchet distance and \(\mu (p_u) = s\).

Now we define a collection of points on pq that could feasibly be representatives.

Definition 2

Given any vertex \(p_i\) on the subtrajectory \(\pi [u,v]\), let \(p^*_i\) be the orthogonal projection of vertex \(p_i\) onto the horizontal segment pq.

Definition 3

Given any two vertices \(p_i\) and \(p_j\) on the subtrajectory \(\pi [u,v]\), let \(P_{ij}\) be the perpendicular bisector of \(p_i\) and \(p_j\). Let \(P_{ij}^*\) be the intersection of the perpendicular bisector \(P_{ij}\) with the horizontal segment pq.

We now have all we need in place to define our set S of candidates for \(p'\) and \(q'\).

Definition 4

Let S be the set containing the following elements:

  1. 1.

    the points p and q,

  2. 2.

    all orthogonal projection points \(p^*_i\), and

  3. 3.

    all perpendicular bisector intersection points \(P_{ij}^*\).

It now suffices to show that S contains at least one representative for \(p_u\). An analogous argument shows that S contains a representative of \(p_v\) as well.

Lemma 1

There exists an element \(s \in S\) on pq that represents \(p_u\).

Proof

Assume for the sake of contradiction that there is no element \(s \in S\) which represents \(p_u\). Consider a mapping \(\mu\) that achieves the Fréchet distance and consider the point \(\mu (p_u)\) on the horizontal segment pq. Since \(\mu (p_u)\) represents \(p_u\), \(\mu (p_u)\) cannot be in S and must lie strictly between two consecutive elements of S, say \(s_L\) to its left and \(s_R\) to its right (see Fig. 10). Note that it may be the case that \(s_L = p\) or \(s_R = q\). Since \(s_L\) and \(s_R\) are elements of S, neither can represent \(p_u\). Next, we reason about the implications of \(s_L\) and \(s_R\) not being able to represent \(p_u\), before putting these together to obtain a contradiction.

\({s_L}\) cannot represent \({p_u}\) This means that no mapping which sends \(p_u \rightarrow s_L\) achieves the Fréchet distance. Let us take the mapping \(\mu\) and modify it into a new mapping \(\mu _L\) in such a way that \(\mu _L(p_u) = s_L\). We can do so by starting out parametrising \(\mu _L\) with a constant speed mapping which sends \(u \rightarrow p\) and \(p_u \rightarrow s_L\). Next, we stay fixed at \(p_u\) along the subtrajectory and move along the horizontal segment from \(s_L\) to \(\mu (p_u)\). The red shaded region in Fig. 10 describes this portion of the remapping. Now that \(\mu _L(p_u) = \mu (p_u)\), we can use the original mapping for the rest.

Since our new mapping \(\mu _L\) maps \(p_u\) to an element of S that cannot represent it, we know that our modification must increase the Fréchet distance. The only place where the Fréchet distance could have increased is at the line segments where the mapping was changed and here \(\mu _L(p_u) = s_L\) maximises the Fréchet distance. Hence, we have \(\Vert p_u s_L \Vert > d\), where d is the Fréchet distance, as shown in Fig. 10. But \(\Vert p_u \mu (p_u) \Vert \le d\), so we can deduce that \(p_u\) is closer to \(\mu (p_u)\) than \(s_L\). Therefore, \(p_u\) is to the right of \(s_L\). Finally, if \(s_L\) and \(s_R\) were on opposite sides of \(p_u^*\), then \(s_L\) and \(s_R\) would not be consecutive, therefore \(p_u\) must be on the same side of \(s_L\) and \(s_R\). Therefore, \(p_u\) is to the right of the entire segment \(s_L s_R\).

\({s_R}\) cannot represent \({p_u}\) Again, no mapping which sends \(p_u \rightarrow s_R\) achieves the Fréchet distance, so we use the same approach and modify \(\mu\) into a new mapping mapping \(\mu _R\) in such a way that \(\mu _R(p_u) = s_R\). To this end, we keep the mapping \(\mu _R\) the same as \(\mu\) until it reaches \(p_u\), and then while staying at \(p_u\), we fastforward the movement from \(\mu (p_u)\) along the horizontal segment so that \(\mu _R(p_u) = s_R\). Next, we stay at \(s_R\) and fastforward the movement along the subtrajectory, until we reach the first point T on the subtrajectory such that \(\mu (T) = s_R\) in the original mapping. From point T onwards we can use the original mapping \(\mu\).

Since our new mapping \(\mu _R\) maps \(p_u\) to an element of S that does not represent it, we cannot have achieved the Fréchet distance. The first change we applied was staying at \(p_u\) and fastforwarding the movement from \(\mu (p_u)\) to \(s_R\). However, since we know from above that \(p_u\) is to the right of the entire segment \(s_L s_R\), this fastforwarding moves closer to \(p_u\), so this part cannot increase the Fréchet distance. The second change we applied, staying at \(s_R\) and fastforwarding the movement from \(p_u\) to T, must therefore be the change that increases the Fréchet distance. Thus, there must be a point on the subtrajectory \(\pi [p_u,T]\) which has distance greater than d, the Fréchet distance, to the point \(s_R\). Since the distance to a point \(s_R\) is maximal at vertices of \(\pi [p_u,T]\), we can assume without loss of generality that \(\Vert p_i s_R \Vert > d\) for some vertex \(p_i\). Consider \(\mu (p_i)\) in the original mapping. Since \(p_i\) is on the subtrajectory \(\pi [p_u,T]\), \(\mu (p_i)\) must be between \(\mu (p_u)\) and \(\mu (T) = s_R\). This mapping of \(p_i\) to \(\mu (p_i)\) is shown as a black dotted line in Fig. 10. Using a similar logic as before, \(\Vert p_i \mu (p_i) \Vert \le d\) and \(\Vert p_i s_R \Vert > d\), so \(p_i\) must lie to left of \(s_R\). And since \(s_L\) and \(s_R\) are consecutive elements of S, we deduce that \(p_i\) is to the left of the entire segment \(s_L s_R\).

Putting these together We now have the full diagram as shown in Fig. 10. The vertex \(p_u\) is to the right of both \(s_L\) and \(s_R\) and the vertex \(p_i\) is to the left of both \(s_L\) and \(s_R\). We also have inferred that \(\Vert p_u s_L \Vert > d\) and \(\Vert p_i s_R \Vert > d\). Moreover, since \(\Vert p_u \mu (p_u) \Vert \le d\) and \(\Vert p_i \mu (p_i) \Vert \le d\), we also have that \(\Vert p_u s_R \Vert \le d\) and \(\Vert p_i s_L \Vert \le d\), since this just moves these endpoints closer to \(p_u\) and \(p_i\) respectively.

Finally, we will show that \(P_{ui}^*\) lies between \(s_L\) and \(s_R\), reaching the intended contradiction. We do so by considering the function \(f(x) = \Vert x p_u \Vert - \Vert x p_i \Vert\) for all points x between \(s_L\) and \(s_R\). From our length conditions, we have that \(f(s_L) > 0\), \(f(s_R) < 0\). Furthermore, since f(x) is a continuous function, by the intermediate value theorem, there is a point x strictly between \(s_L\) and \(s_R\) such that \(f(x) = 0\). Since \(f(x) = 0\), the point x is equidistant from \(p_u\) and \(p_i\) so therefore lies on both \(P_{ui}\) and the horizontal segment pq. Therefore \(x = P_{ui}^*\) and is an element of S between two consecutive elements \(s_L\) and \(s_R\), giving us a contradiction. \(\square\)

Fig. 10
figure 10

The point \(\mu (p_u)\) lies between two consecutive elements \(s_L\) and \(s_R\). Distances that are greater than d are thin solid and distances that are at most d are dotted, where d is the Fréchet distance

Note that in the above proof, we require only \(P_{ui}^*\) to be in the candidate set when we are computing \(p'\), and also only when \((p_u, p_i)\) is a backward pair. This means that for computing \(p'\) and \(q'\) respectively, we only require the bisector intersections \(P_{ui}^*\) and \(P_{jv}^*\) to be in S, hence reducing the size of S from \({\mathcal {O}}(n^2)\) to \({\mathcal {O}}(n)\).

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Gudmundsson, J., van Renssen, A., Saeidi, Z. et al. Translation Invariant Fréchet Distance Queries. Algorithmica 83, 3514–3533 (2021). https://doi.org/10.1007/s00453-021-00865-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00453-021-00865-0

Keywords

Navigation