Location-Aware Matching Statistics
Abstract
Edit distance is the standard measure of string similarity, but its quadratic-time complexity is prohibitive for long strings. Popular linear-time alternatives, such as the -gram distance, or the average common substring measure (ACS) that is based on matching statistics (MS), consider the substrings shared by the two input strings but not where they occur in each string. Yet in many real-world applications, e.g., when comparing document versions or co-recorded time series, a shared substring is really relevant only if its occurrences are close in position. We introduce Location-Aware Matching Statistics (LAMAS). Given strings and and a displacement tolerance , LAMAS reports, for every position of , the longest substring starting at that occurs in at a position with , together with the displacement . MS is the special case of LAMAS with unbounded . Our main result is an algorithm that solves LAMAS in time and space for strings of length at most and any ; this is optimal and matches the complexity of MS. The algorithm reduces LAMAS to predecessor and successor queries over a sliding window of suffix ranks and answers them in linear total time via a window decomposition and interval union-find. Experiments on 20 real datasets and synthetic data show that LAMAS substantially improves over MS and -gram distance in similarity-based classification, top- retrieval, and clustering. It is competitive with edit distance and a constrained dynamic time warping variant in classification and generally outperforms a state-of-the-art method for top- retrieval under edit distance. Finally, our implementation of the main algorithm for LAMAS scales linearly in and does not slow down as grows.
Create a lesson
Metadata
- Categories
- cs.DS, cs.DB
Related papers
Constrained Online Selection with Predictions: Matroid Secretary, Knapsack, and Matching
Shared title terminologycs.DSHedyeh Beyhaghi, Tao Zixu He, Cameron Musco
Computational Hardness of Online Stochastic Matching
Shared title terminologycs.DSYifeng Teng, Zongjun Yang
Constant-Factor Matching-Size Estimation in Random-Order Streams
Shared title terminologycs.DSAlireza Farhadi, Mohammad Hajiaghayi, Morteza Monemizadeh
Exact-Quota Facility Location: A Transfer Framework and Three Approximation Guarantees
Shared title terminologycs.DSHang Luo
Quantum Algorithm with Quadratic Speedup for 2D Pattern Matching
Shared title terminologycs.DSRishabh Gala, Rahul Shah
Dual-Slack Frontier Matching: Parallel Approximate Maximum-Product Matching
Shared title terminologycs.DSMarc A. Tunnell, Oguz Selvitopi, Xiaoye Sherry Li