Skip to main content

On Length-Sensitive Fréchet Similarity

  • Conference paper
  • First Online:
Algorithms and Data Structures (WADS 2023)

Abstract

Taking length into consideration while comparing 1D shapes is a challenging task. In particular, matching equal-length portions of such shapes regardless of their combinatorial features, and only based on proximity, is often required in biomedical and geospatial applications. In this work, we define the length-sensitive partial Fréchet similarity (LSFS) between curves (or graphs), which maximizes the length of matched portions that are close to each other and of equal length. We present an exact polynomial-time algorithm to compute LSFS between curves under \(L_1\) and \(L_\infty \). For geometric graphs, we show that the decision problem is NP-hard even if one of the graphs consists of one edge.

Supported by the National Science Foundation grant CCF 2046730.

Supported by the National Science Foundation grant CCF 2107434.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 89.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 119.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    We do not consider \(L_2\), since we expect to encounter the same algebraic obstacles that make partial Fréchet similarity unsolvable over the rational numbers [14].

  2. 2.

    For LSFS it suffices to measure lengths of subcurves on f. Partial Fréchet similarity [11] measures lengths of subcurves on f and g, but is not length-preserving.

  3. 3.

    We use the term propagatable, as these regions allow for easier propagation of a score function in the dynamic program, which we elaborate on in the next sub-sections.

  4. 4.

    Note that in both sub-cases, if \(\mathcal {S}_B(x_R)>\mathcal {S}_B(k)+\frac{j+k}{1-\frac{t-k}{y_T}}\), then \(\mathcal {S}_R(r)=\mathcal {S}_B(x_R)\).

References

  1. Aguilar, J., Buchin, K., Buchin, M., Hosseini Sereshgi, E., Silveira, R.I., Wenk, C.: Graph sampling for map comparison. In: 3rd ACM SIGSPATIAL International Workshop on Spatial Gems (2021)

    Google Scholar 

  2. Ahmed, M., Fasy, B.T., Hickmann, K.S., Wenk, C.: Path-based distance for street map comparison. ACM Trans. Spat. Algorithms Syst. 28 (2015)

    Google Scholar 

  3. Ahmed, M., Fasy, B.T., Wenk, C.: Local persistent homology based distance between maps. In: Proceedings of the 22nd ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems, pp. 43–52. ACM (2014)

    Google Scholar 

  4. Ahmed, M., Karagiorgou, S., Pfoser, D., Wenk, C.: Map Construction Algorithms. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-319-25166-0

    Book  MATH  Google Scholar 

  5. Akitaya, H.A., Buchin, M., Kilgus, B., Sijben, S., Wenk, C.: Distance measures for embedded graphs. Comput. Geom.: Theory Appl. 95, 101743 (2021)

    Google Scholar 

  6. Alt, H., Efrat, A., Rote, G., Wenk, C.: Matching planar maps. J. Algorithms 49(2), 262–283 (2003). https://doi.org/10.1016/s0196-6774(03)00085-3

    Article  MathSciNet  MATH  Google Scholar 

  7. Alt, H., Godau, M.: Computing the Fréchet distance between two polygonal curves. IJCGA 5(1–2), 75–91 (1995)

    MATH  Google Scholar 

  8. Biagioni, J., Eriksson, J.: Inferring road maps from global positioning system traces. Transp. Res. Rec.: J. Transp. Res. Board 2291(1), 61–71 (2012)

    Article  Google Scholar 

  9. Buchin, K., et al.: Improved map construction using subtrajectory clustering. In: Proceedings of the 4th ACM SIGSPATIAL LocalRec Workshop, pp. 5:1–5:4 (2020). https://doi.org/10.1145/3423334.3431451

  10. Buchin, K., Buchin, M., Gudmundsson, J.: Constrained free space diagrams: a tool for trajectory analysis. Int. J. Geogr. Inf. Sci. 24(7), 1101–1125 (2010). https://doi.org/10.1080/13658810903569598

    Article  Google Scholar 

  11. Buchin, K., Buchin, M., Wang, Y.: Exact algorithms for partial curve matching via the Fréchet distance. In: Proceedings of the Twentieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2009, pp. 645–654. Society for Industrial and Applied Mathematics, USA (2009)

    Google Scholar 

  12. Chen, C., Lu, C., Huang, Q., Yang, Q., Gunopulos, D., Guibas, L.: City-scale map creation and updating using GPS collections. In: Proceedings of the/ 22nd ACM SIGKDD, pp. 1465–1474 (2016). https://doi.org/10.1145/2939672.2939833

  13. Cheong, O., Gudmundsson, J., Kim, H.-S., Schymura, D., Stehn, F.: Measuring the similarity of geometric graphs. In: Vahrenhold, J. (ed.) SEA 2009. LNCS, vol. 5526, pp. 101–112. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02011-7_11

    Chapter  Google Scholar 

  14. De Carufel, J.L., Gheibi, A., Maheshwari, A., Sack, J.R., Scheffer, C.: Similarity of polygonal curves in the presence of outliers. Comput. Geom. 47(5), 625–641 (2014). https://doi.org/10.1016/j.comgeo.2014.01.002

    Article  MathSciNet  MATH  Google Scholar 

  15. Duran, D., Sacristán, V., Silveira, R.I.: Map construction algorithms: a local evaluation through hiking data. GeoInformatica 24(3), 633–681 (2020). https://doi.org/10.1007/s10707-019-00386-7

    Article  Google Scholar 

  16. He, S., et al.: Roadrunner: improving the precision of road network inference from GPS trajectories. In: Proceedings of 26th ACM SIGSPATIAL GIS, pp. 3–12 (2018)

    Google Scholar 

  17. Itai, A., Papadimitriou, C.H., Szwarcfiter, J.L.: Hamilton paths in grid graphs. SIAM J. Comput. 11(4), 676–686 (1982)

    Article  MathSciNet  MATH  Google Scholar 

  18. Koide, S., Xiao, C., Ishikawa, Y.: Fast subtrajectory similarity search in road networks under weighted edit distance constraints. Proc. VLDB Endow. 13(12), 2188–2201 (2020). https://doi.org/10.14778/3407790.3407818

  19. Maheshwari, A., Sack, J.R., Shahbaz, K., Zarrabi-Zadeh, H.: Fréchet distance with speed limits. Comput. Geom. 44(2), 110–120 (2011). https://doi.org/10.1016/j.comgeo.2010.09.008. Special issue of selected papers from the 21st Annual Canadian Conference on Computational Geometry

  20. Papadimitriou, C.H., Vazirani, U.V.: On two geometric problems related to the travelling salesman problem. J. Algorithms 5(2), 231–246 (1984)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Erfan Hosseini Sereshgi .

Editor information

Editors and Affiliations

Appendices

A LSFS is Length-Preserving on Connected Components

By definition, \(C_h^{\varepsilon }\) only requires the restriction of h to small balls to be length-preserving, we show that indeed all connected components are length-preserving.

Lemma 4 (Path-Connected Components Are Length-Preserving)

Each restriction of h to the preimage of a path-connected component of \(C_h^{\varepsilon }\) is a length-preserving map.

Proof

Let \(\widetilde{C}\) be a path-connected component of \(C_h^{\varepsilon }\). Let \(x,y \in \widetilde{C}\). Since \(\widetilde{C}\) is path-connected, let \(\gamma :[0,1] \rightarrow \widetilde{C}\) be a path that starts at x and ends at y. Then, by the definition of \(C_h^{\epsilon }\), for each \(t \in [0,1]\), there exists a \(\delta _t>0\) such that h restricted to \(B_t:={\mathbb {B}_{p}(h^{-1}(\gamma (t)),\delta _t)}\) is length-preserving. Let \(\mathcal {U} := \{ \gamma \left( B_t \right) \}_{t \in [0,1]}\). Since \({{\,\textrm{Im}\,}}(\gamma )\) is a compact subspace of \(\mathbb {R}^2\) and since \(\mathcal {U}\) covers \({{\,\textrm{Im}\,}}(\gamma )\), there exists a finite sub-cover \(\widehat{\mathcal {U}}\) of \(\mathcal {U}\). Then, there exists a decomposition of \(\gamma \) into sub-paths such that each sub-path lies entirely in at least one open set in \(\widehat{\mathcal {U}}\). Let \(\{ \gamma _i \}_{i=1}^n\) be one such decomposition. Then, we know that \({{\,\textrm{len}\,}}(\gamma )=\sum _i {{\,\textrm{len}\,}}(p_i)\).

Since each \({{\,\textrm{Im}\,}}p_i\) is contained in some \(U \in \widehat{\mathcal {U}}\) and since h restricted to U is length-preserving, we know that \({{\,\textrm{len}\,}}(\gamma _i) = {{\,\textrm{len}\,}}(h(\gamma _i))\). Taking the sum over all sub-paths, we find \({{\,\textrm{len}\,}}(\gamma )={{\,\textrm{len}\,}}(h(\gamma ))\). Thus, we have shown that h restricted to \(\widetilde{C}\) is length-preserving.

Noting that a curve \(f :[0,L_f] \rightarrow \mathbb {R}^d\) is simply a directed graph in \(\mathbb {R}^d\), we obtain:

Corollary 1

Each restriction of h to the preimage of a path-connected component of \(H^{\varepsilon }\) is a length-preserving map.

B Proof of Lemmas 2 and 3

In this section we discuss the proofs for Lemmas 2 and 3.

1.1 B.1 Proof of Lemma 2

Proof

First we show that for any two points \((x_1,y_1)\) and \((x_2,y_2)\) on the top or right boundary, there exist optimal paths to \((x_1,y_1)\) and \((x_2,y_2)\) that might overlap but do not cross each other. Assuming that the optimal paths to \((x_1,y_1)\) and \((x_2,y_2)\) cross at a point \(a_0\), there is another optimal path to \((x_1,y_1)\) that goes through \(a_0\) and overlaps with the optimal path to \((x_2,y_2)\) before reaching \(a_0\) (as shown in Fig. 11b).

Fig. 11.
figure 11

A refined cell \(\mathcal {C}\) in the free-space diagram \(\mathcal {D}_{\varepsilon }(f,g)\). In each sub-figure, we see two optimal paths to \((x_1,y_1) \in T\) and to \((x_2,y_2) \in R\). (a) The two paths intersect transversally, at \(a_0\). (b) The two paths first overlap, then separate at \(a_0\).

Therefore, the optimal path to any point on the top or right boundary of a cell cuts the cell into two parts such that for all points on the top or right boundary in one part there is an optimal path going through them within that part. Considering the example in Fig. 11b with the purple path being an optimal path to \((x_2,y_2)\), without loss of generality, we can say any point (xy) such that \(y > y_{2}\) has an optimal path that comes from the left boundary (more specifically, above the purple path) which means all points on the top boundary have an optimal path coming from the left boundary, hence (4) applies. Similarly, consider \((x_1,y_1)\) and the orange path in Fig. 11a to be optimal. In this case, all the points (xy) such that \(x > x_{1}\) have an optimal path that comes from the bottom boundary (the right side of the orange path) which results in (5).

1.2 B.2 Proof of Lemma 3

Proof

Let \(\mathcal {C}\) be a refined cell in \(\mathcal {D}_{\varepsilon }(f,g)\). Let \((x_1,y_B+y_T), (x_2,y_B+y_T)\) be two points on T of \(\mathcal {C}\). We want to show: \(\mathcal {S}_T(x_2)-\mathcal {S}_T(x_1)=\mathcal {S}(x_2,y_B+y_T)-\mathcal {S}(x_1,y_B+y_T) \le x_2 - x_1\). Consider the vertical line \(\ell =\{(x,y)\in D\;|\; x=x_1\}\). The optimal monotone path from (0, 0) to \((x_2,y_B+y_T)\) has to cross \(\ell \) at a point \((x_1,y_0)\). Note that \((x_1,y_0)\) does not have to be inside \(\mathcal {C}\), see Fig. 12. We know \(\mathcal {S}(x_1,y_B+y_T) \ge \mathcal {S}(x_1,y_0)\) and from Observation 3 follows that \(\mathcal {S}(x_2,y_B+y_T)-\mathcal {S}(x_1,y_0) \le \min (y_B+y_T-y_0,x_2-x_1)\). Thus we can conclude: \( \mathcal {S}_T(x_2)-\mathcal {S}_T(x_1)=\mathcal {S}(x_2,y_B+y_T)-\mathcal {S}(x_1,y_B+y_T) \le \min (y_B+y_T-y_0,x_2-x_1) \le x_2 - x_1\). Similarly we can show the equation above for other boundaries of \(\mathcal {C}\) as well.

Fig. 12.
figure 12

A cell \(\mathcal {C}\) in \(\mathcal {D}_{\varepsilon }(f,g)\). \((x_1,y_0)\) is on the optimal path to \((x_2,y_T)\).

C Score Function Propagation Within a Cell, Continued

We discuss the remainder of the cases and score functions. Due to symmetric nature of Case (b),Case (c), Case (d), and Case (e) with regard to \(\mathcal {S}_{L \rightarrow T}\) and \(\mathcal {S}_{B \rightarrow R}\) (likewise, for Case (f) and Case (g)), we do not explain \(\mathcal {S}_{L \rightarrow T}\) for these cases to avoid repetition.

Case (b): Consider Fig. 13 and the cell \(\mathcal {C}\) that is divided into two propagatable polygons by a line with a positive slope. The maximum value for \(\mathcal {L}((0,l),(x_R,r))\) in this case is \(x_R-j\) if \(x_R<y_T\), and \(y_T\) if \(x_R>y_T\). Such value can be achieved by drawing a slope-one line from (j, 0) and if the divider’s slope is less than one (see Fig. 13, right), by drawing a slope-one line from \((x_R,y_T)\). For \(\mathcal {S}_{L \rightarrow R}\), for any point \((x_R,r_1)\) on R, below the maximum line, the optimal path goes from (0, 0) to \((x_R-r_1,0)\) horizontally and then to \((x_R,r_1)\) via a slope-one segment (red dashed line).

Fig. 13.
figure 13

Case (b) when \(\frac{y_T}{i-j}>1\) on the left, and when \(\frac{y_T}{i-j}<1\) on the right. The blue line shows the maximum slope-one length possible. Maximum slope-one segments to \(r_1\) and \(r_2\) are shown in magenta and orange, respectively. (Color figure online)

For all points \((x_R,r_2)\) above the maximum, the start point of the optimal path depends on \(\mathcal {S}_L(l)\). In other words, taking the longest slope-one path to \((x_R,r_2)\) in \(\mathcal {C}\) does not necessary yield the maximum score for \((x_R,r_2)\) in this case. This is due to the fact that \(\mathcal {L}((0,l),(x_R,r))\) over l (and r) has negative slope. In Theorem 4, we demonstrate how this decision is made and why the number of start-point candidates is at most the number of breakpoints on \(\mathcal {S}_L(l)\).

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_L(0) + r &{} \text{ for } &{} r \le x_R-j \\ \max \limits _{l \in [0,y_T(\frac{x_R-r-j}{i-j-y_T})]} \mathcal {S}_L(l)+\mathcal {L}((\frac{i-j}{y_T}(l+j),l),(x_R,r)) &{} \text{ for } &{} r \ge x_R-j\end{array}\right. \end{aligned} \end{aligned}$$

Propagation from B to R can be done similar to Case (a), yielding:

$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_B(x_R-r) + r &{} \text{ for } &{} r \le x_R-j \\ \mathcal {S}_B(j) + x_R-j &{} \text{ for } &{} r \ge x_R-j\end{array}\right. \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow T}(t)=\left\{ \begin{array}{lcl} \mathcal {S}_B(t) &{} \text{ for } &{} t \le j \\ \mathcal {S}_B(j)+(t-j) &{} \text{ for } &{} t \ge j \end{array}\right. \end{aligned}\end{aligned}$$

Theorem 4

The propagation within Case (b) adds O(1) complexity.

Proof

Assuming \(\mathcal {S}_{L}\) has n breakpoints, we want to determine the number of breakpoints on \(\mathcal {S}_{L \rightarrow R}\), which consists of two pieces. The first piece, \(\mathcal {S}_L(0) + r\) is a linear function. The second piece, is the upper-envelope of the summation of a non-decreasing piecewise linear and a decreasing linear function. See Fig. 14 for an example. To compute \(\mathcal {S}_{L \rightarrow R}\), one can find the summation on the breakpoints of \(\mathcal {S}_{L}\) and connect them, which results in at most n breakpoints. Taking the upper-envelope makes the resulting function non-decreasing and can only reduce the number of breakpoints. Therefore, there are at most \(n+1\) breakpoints on \(\mathcal {S}_{L \rightarrow R}\), and the complexity of \(\mathcal {S}_{L \rightarrow R}\) is equal to the complexity of \(\mathcal {S}_{L}\). The complexity for \(\mathcal {S}_{B \rightarrow R}\), \(\mathcal {S}_{B \rightarrow T}\), and \(\mathcal {S}_{L \rightarrow T}\) can be shown similar to Theorem 1.

Fig. 14.
figure 14

The score function for \(S_{L \rightarrow R} (r)\) when \(r \ge x_R -j\).

Case (c): Case (c) represents a cell divided by a positive-slope line with free space on the left, therefore, the maximum length slope-one segment goes through \((i,y_T)\), if the divider’s slope is greater than one (\(\frac{y_T}{i-j}>1\)). Otherwise the maximum segment intersects B at (j, 0).

The Divider’s Slope is Greater than One: Consider Fig. 15, we first explore the paths from L to R. We draw a slope-one segment starting at (0, 0) to find the score function’s breakpoint. For any point below \((x_R,\frac{j}{\frac{y_T}{i-j}-1})\) the optimal path starts from (0, 0). For all points \((x_R,r)\) above the breakpoint, the optimal path starts from \((0,(1-\frac{i-j}{y_T})r-j)\).

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_L(0) + r &{} \text{ for } &{} r \le \frac{j}{\frac{y_T}{i-j}-1} \\ \mathcal {S}_L((1-\frac{i-j}{y_T})r-j) + \frac{i-j}{y_T}r+j &{} \text{ for } &{} r \ge \frac{j}{\frac{y_T}{i-j}-1} \end{array}\right. \end{aligned} \end{aligned}$$

Similarly for paths from B to R we have:

$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_B((\frac{i-j}{y_T}-1)r+j) + r &{} \text{ for } &{} r \le \frac{j}{\frac{y_T}{i-j}-1} \\ \mathcal {S}_B(0) + \frac{i-j}{y_T}r+j &{} \text{ for } &{} r \ge \frac{j}{\frac{y_T}{i-j}-1} \end{array}\right. \end{aligned} \end{aligned}$$
Fig. 15.
figure 15

Case (c), when \(\frac{y_T}{i-j}>1\) on the left, and when \(\frac{y_T}{i-j}<1\) on the right. The blue line shows the maximum slope-one length possible. Maximal slope-one segments to \(r_1\) and \(r_2\) are shown in magenta and orange, respectively. (Color figure online)

$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow T}(t)=\left\{ \begin{array}{lcl} \mathcal {S}_B(0)+t &{} \text{ for } &{} t \le i \\ \max (\mathcal {S}_B(0)+t,\mathcal {S}_B(t)) &{} \text{ for } &{} t \ge i \end{array}\right. \end{aligned}\end{aligned}$$

The Divider’s Slope is Less than One: Consider the right picture in Fig. 15. Since the maximum of \(\mathcal {L}\) can be achieved from (j, 0), we do not have a breakpoint in the score functions:

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \mathcal {S}_L(0) + r\quad \text{ and }\quad \mathcal {S}_{B \rightarrow R}(r) = \mathcal {S}_B(j) + r \end{aligned} \end{aligned}$$

However for \(\mathcal {S}_{B \rightarrow T}(t)\) we have:

$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow T}(t)=\left\{ \begin{array}{lcl} \mathcal {S}_B(0)+t &{} \text{ for } &{} t \le y_T \\ \mathcal {S}_B(t-y_T)+y_T &{} \text{ for } &{} y_T \le t \le j+y_T \\ \max (\mathcal {S}_B(t-y_T)+y_T,\mathcal {S}_B(t)) &{} \text{ for } &{} t \ge j+y_T \end{array}\right. \end{aligned}\end{aligned}$$

Theorem 5

The propagation within Case (c) adds O(1) complexity.

Proof

The O(1) complexity follows in a similar way to Theorem 1. Note that for \(\mathcal {S}_{B \rightarrow T}\) the max function adds at most one breakpoint (Fig. 16).

Case ( d ):

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_L(0) + r &{} \text{ for } &{} r \le \frac{j}{\frac{y_T}{i-j}-1} \\ \max \limits _{l \in [0,(1-\frac{i-j}{y_T})r-j]} \mathcal {S}_L(l)+\mathcal {L}((0,l),(\frac{i-j}{y_T}r+j,r)) &{} \text{ for } &{} r \ge \frac{j}{\frac{y_T}{i-j}-1}\end{array}\right. \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_B((\frac{i-j}{y_T}-1)r+j) + r &{} \text{ for } &{} r \le \frac{j}{\frac{y_T}{i-j}-1} \\ \mathcal {S}_B(0) + \frac{j}{\frac{y_T}{i-j}-1} &{} \text{ for } &{} r \ge \frac{j}{\frac{y_T}{i-j}-1}\end{array}\right. \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow T}(t) = \left\{ \begin{array}{lcl} \mathcal {S}_B(0) + t &{} \text{ for } &{} t \le i \\ \max \limits _{b \in [0,t-(\frac{y_T}{i-j}(t-j))]} \mathcal {S}_B(b)+\mathcal {B}((b,0),(t,\frac{y_T}{i-j}(t-j))) &{} \text{ for } &{} t \ge i\end{array}\right. \end{aligned} \end{aligned}$$
Fig. 16.
figure 16

Case (d), when \(\frac{y_T}{i-j}<-1\) on the left, and when \(\frac{y_T}{i-j}>-1\) on the right. The blue line shows the maximum slope-one length possible. Maximal slope-one segments to \(r_1\) and \(r_2\) are shown in magenta and orange, respectively. (Color figure online)

Theorem 6

The propagation within Case (d) adds O(1) complexity.

Proof

The O(1) complexity can be discussed in a similar way to Theorem 4 (Fig. 17)

Case ( e ):

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_L(0) + r &{} \text{ for } &{} r \le x_R \\ \mathcal {S}_L(y_T(\frac{x_R-r-j}{i-j-y_T})) + r-y_T(\frac{x_R-r-j}{i-j-y_T}) &{} \text{ for } &{} r \ge x_R\end{array}\right. \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_B(x_R-r) + r &{} \text{ for } &{} r \le x_R-j \\ \mathcal {S}_B(\frac{x_R-r-\frac{jy_T}{i-j}}{1-\frac{y_T}{i-j}}) + x_R-\frac{x_R-r-\frac{jy_T}{i-j}}{1-\frac{y_T}{i-j}} &{} \text{ for } &{} r \ge x_R-j\end{array}\right. \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow T}(t) = \left\{ \begin{array}{lcl} \mathcal {S}_B(t) &{} \text{ for } &{} r \le t \le i \\ \mathcal {S}_B(\frac{y_T}{i-j}+t-j) + t-\frac{y_T}{i-j}+t-j &{} \text{ for } &{} t \ge i \end{array}\right. \end{aligned} \end{aligned}$$
Fig. 17.
figure 17

Case (e), when \(\frac{y_T}{i-j}<-1\) on the left, and when \(\frac{y_T}{i-j}>-1\) on the right. The blue line shows the maximum slope-one length possible. Maximal slope-one segments to \(r_1\) and \(r_2\) are shown in magenta and orange, respectively. (Color figure online)

Theorem 7

The propagation within Case (e) adds O(1) complexity.

Proof

The O(1) complexity can be discussed in a similar way to Theorem 1

Case (f): As mentioned in Case (c), when a divider has a positive slope and is located on the right side of a free space, extra care is required. Suppose a divider’s slope is less than one, a slope-one segment can be drawn above it, starting at (k, 0). This segment can be a part of the optimal path from B to R. Therefore, we have four possibilities for this case:

Both Dividers’ Slopes are Greater Than One: When both slopes are greater than one, the optimal path between two points does not necessarily have at most three segments. Consider Fig. 18 (right) and point \((x_R,r'_2)\). The longest slope-one path to \((x_R,r'_2)\) is shown in orange, and has multiple slope-one segments. By Lemma 3, this path is always maximal when going through B. The same cannot be said for paths going through L in this case, since there are vertical segments in such a path. Therefore, for a point \((x_R,r)\) above \((x_R,\frac{j+k}{1-\frac{w-k}{y_T}})\), \(\mathcal {S}_{L \rightarrow R}(r)\) is the maximum over l of \(\mathcal {S}_L(l)\) and the length of slope-one segments in the feasible space between l and r.

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_L(0) + r &{} \text{ for } &{} r \le \frac{j+k}{1-\frac{w-k}{y_T}} \\ \max \limits _{l \in [0,\frac{(1-\frac{w-k}{y_T})r_2-k+j}{1-\frac{i-j}{y_T}}]} \mathcal {S}_L(l)+\mathcal {L}((\frac{(i-j)}{y_T}l+(i-j)j,l),(\frac{w-k}{y_T}r+k,r)) &{} \text{ for } &{} r \ge \frac{j+k}{1-\frac{w-k}{y_T}}\end{array}\right. \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_B((\frac{i-j}{y_T}-1)r+j) + r &{} \text{ for } &{} r \le \frac{j+k}{1-\frac{w-k}{y_T}} \\ \mathcal {S}_B(j)+\frac{w-k}{y_T}r+k-j &{} \text{ for } &{} r \ge \frac{j+k}{1-\frac{w-k}{y_T}}\end{array}\right. \end{aligned} \end{aligned}$$
Fig. 18.
figure 18

Case (f) when both dividers have slope greater than one. The blue line shows the maximum slope-one length possible. Maximal slope-one segments to \(r_1\), \(r_2\) and \(r'_2\) are shown in magenta and orange. (Color figure online)

Theorem 8

The propagation within Case (f) adds O(1) complexity.

The proof is omitted, as it is similar to Theorem 4 and Theorem 5.

Left Divider’s Slope is Greater than One: Since a divider can only have slope less than one if \(x_R>y_T\), the maximum length slope-one segment that can obtained in this case is \(y_T\). This amount can be achieved by simply drawing a slope-one line from (K, 0) (see Fig. 19) because the right divider’s slope is less than one. We have:

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \mathcal {S}_L(0) + r \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \mathcal {S}_B(k) + r \end{aligned} \end{aligned}$$

Right divider’s slope is greater than one: Similar to the previous sub-case, the maximum length slope-one segment is achievable. However, since the right divider’s slope is greater than one, the maximum can be gained by drawing a slope-one line from \((w,y_T)\) (Fig. 19).

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \mathcal {S}_L(0) + r \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \mathcal {S}_B((\frac{w-k}{y_T}-1)r+k) + r \end{aligned} \end{aligned}$$
Fig. 19.
figure 19

Case (f) when one divider’s slope is less than one and the other’s is greater than one.

Both Dividers’ Slopes are Less Than One:

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(x_R,r) = \mathcal {S}_L(0) + r \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned}&\mathcal {S}_{B \rightarrow R}(r)=\\&\left\{ \begin{array}{lcl} \mathcal {S}_B(k) + r &{} \text{ for } &{} r \le \frac{(i-j)(j-k)}{(i-j)-y_T} \\ \max \limits _{b \in [k,\frac{(w-k)((1-\frac{i-j}{y_T})r+ky_T-j(i-j))}{y_T-w+k}]} \mathcal {S}_B(b)+\mathcal {L}((b,\frac{y_T}{w-k}b-ky_T),(\frac{i-j}{y_T}r+j(i-j),r)) &{} \text{ for } &{} r \ge \frac{(i-j)(j-k)}{(i-j)-y_T}\end{array}\right. \end{aligned} \end{aligned}$$

Case (g): Case (g) consists of two dividers with negative slope. Naturally, there are three possibilities for this case:

Two Parallel Dividers ( II ):

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_L(0) + r &{} \text{ for } &{} r \le \frac{j+k}{1-\frac{w-k}{y_T}} \\ \mathcal {S}_L(\frac{(1-\frac{w-k}{y_T})r-k+j}{1-\frac{i-j}{y_T}}) + \frac{(\frac{w-k-i+j}{y_T})r+k-j}{1-\frac{i-j}{y_T}} &{} \text{ for } &{} r \ge \frac{j+k}{1-\frac{w-k}{y_T}}\end{array}\right. \end{aligned} \end{aligned}$$
$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_B((\frac{w-k}{y_T})r+k) + r &{} \text{ for } &{} r \le \frac{j+k}{1-\frac{w-k}{y_T}} \\ \mathcal {S}_B(j) + \frac{j+k}{1-\frac{w-k}{y_T}} &{} \text{ for } &{} r \ge \frac{j+k}{1-\frac{w-k}{y_T}}\end{array}\right. \end{aligned} \end{aligned}$$

Theorem 9

The propagation within Case (g) adds O(1) complexity.

Proof

The O(1) complexity for sub-case II follows in a way similar to Theorem 1. Likewise, for V and \(\varLambda \) we can use the same approach as in Theorem 4.

V-shaped and \(\varLambda \)-shaped cases share some functions and properties with the parallel case II. We discuss their corresponding functions below:

The Left Divider’s Slope is Greater than the Right Divider’s (V): The score function on R coming from L is identical to the parallel case (II), since \(\mathcal {L}((0,l),(x_R,r))\) is non-decreasing over l and r (see Fig. 20). However, \(\mathcal {L}((0,b),(x_R,r))\) is decreasing over b, so for \(\mathcal {S}_{B \rightarrow R}(r)\) we have:

$$\begin{aligned} \begin{aligned} \mathcal {S}_{B \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_B(j) + r &{} \text{ for } &{} r \le \frac{j+k}{1-\frac{w-k}{y_T}} \\ \max \limits _{B \in [0,(\frac{w-k}{y_T}-1)r+k]} \mathcal {S}_B(b)+\mathcal {L}((b,\frac{y_T}{i-j}b-jy_T),(\frac{w-k}{y_T}r+k,r)) &{} \text{ for } &{} r \ge \frac{j+k}{1-\frac{w-k}{y_T}}\end{array}\right. \end{aligned} \end{aligned}$$

The Right Divider’s Slope is Greater than the Left Divider’s (\(\varLambda \)): The score function on R coming from B is identical to the parallel case (II) because \(\mathcal {L}((0,b),(x_R,r))\) is non-decreasing over b.Footnote 4 However, that is not the case with \(\mathcal {L}((0,l),(x_R,r))\):

$$\begin{aligned} \begin{aligned} \mathcal {S}_{L \rightarrow R}(r) = \left\{ \begin{array}{lcl} \mathcal {S}_L(0) + r &{} \text{ for } &{} r \le \frac{j+k}{1-\frac{w-k}{y_T}} \\ \max \limits _{l \in [0,\frac{(1-\frac{w-k}{y_T})r-k+j}{1-\frac{i-j}{y_T}}]} \mathcal {S}_L(l)+\mathcal {L}((\frac{(i-j)}{y_T}l+(i-j)j,l),(\frac{w-k}{y_T}r+k,r)) &{} \text{ for } &{} r \ge \frac{j+k}{1-\frac{w-k}{y_T}}\end{array}\right. \end{aligned} \end{aligned}$$
Fig. 20.
figure 20

Case (g) with V on the left and \(\varLambda \) on the right side. The blue line shows the maximum slope-one length possible. Maximal slope-one segments to \(r_1\) and \(r_2\) are shown in magenta and orange. (Color figure online)

Case (h). Here, the cell is filled with infeasible space; therefore, for any pair of points \(p_1\) and \(p_2\) on the boundaries, \(\mathcal {L}(p_1,p_2)=0\). Hence, going from L to R (or B to T) is simply: \(\mathcal {S}_{L \rightarrow R}(r) = \mathcal {S}_L(r)\) (and \(\mathcal {S}_{B \rightarrow T}(t) = \mathcal {S}_B(t)\)). Since the score functions on the boundaries are non-decreasing (by Observation 3), we have: \(\mathcal {S}_{B \rightarrow R}(r) = \mathcal {S}_B(x_R)\) (and \(\mathcal {S}_{L \rightarrow T}(t) = \mathcal {S}_L(y_T)\)).

Theorem 10

The propagation within Case (h) adds no complexity.

Proof

Since \(\mathcal {S}_{L \rightarrow R}(r)=\mathcal {S}_L(l)\) directly, there is no additional breaking point on \(\mathcal {S}_{L \rightarrow R}\). Furthermore, \(\mathcal {S}_{B \rightarrow R}\) is a constant function, which means it does not transfer any complexity from \(\mathcal {S}_B\). We have similar explanations for \(\mathcal {S}_{B \rightarrow T}\) and \(\mathcal {S}_{L \rightarrow T}\).

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Buchin, K., Fasy, B.T., Sereshgi, E.H., Wenk, C. (2023). On Length-Sensitive Fréchet Similarity. In: Morin, P., Suri, S. (eds) Algorithms and Data Structures. WADS 2023. Lecture Notes in Computer Science, vol 14079. Springer, Cham. https://doi.org/10.1007/978-3-031-38906-1_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-38906-1_15

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-38905-4

  • Online ISBN: 978-3-031-38906-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics