Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow limiting the maximum distance for performance #221

Open
kno10 opened this issue Dec 3, 2024 · 1 comment
Open

Allow limiting the maximum distance for performance #221

kno10 opened this issue Dec 3, 2024 · 1 comment

Comments

@kno10
Copy link

kno10 commented Dec 3, 2024

For long sequences, the Levenshtein difference is $O(m*n)$ in complexity.

However, in many cases there will be some small k that gives the maximum distance of interest.

In such cases, the computation can be terminated early if the strings become too different, and if I am not mistaken this allows to reduce the algorithm complexity to $O(max(m,n)\cdot k)$ (basically, of the full m x n matrix you only need to look at a band of height k around the diagonal - pretty straightforward).

@jamesturk
Copy link
Owner

Makes sense, I'd take a patch for this if there's interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants