TOPICS
Search

Edit Distance


Edit distance between two strings, in the unit-cost convention also called Levenshtein distance, is the minimum number of single-symbol insertions, deletions, and substitutions needed to transform one into the other (CRC Press LLC 2019). Each operation costs one. For example, the edit distance from cat to cart is 1, achieved by inserting r.

Unlike Hamming distance, edit distance permits changes in length. Even for equal-length strings, insertions and deletions can cost less than replacing every differing symbol. For example, abc and bca have Hamming distance 3 but edit distance 2.

Let E_Sigma(d) be the least metric embedding distortion into the real space l_1 of absolutely summable sequences for all strings of length at most d over a finite alphabet Sigma, including the empty string. The norm on l_1 is ||x||_1=sum_(i)|x_i|.


See also

Hamming Distance, Metric Embedding Distortion, String

Explore with Wolfram|Alpha

References

CRC Press LLC. "Levenshtein Distance." In Dictionary of Algorithms and Data Structures (Ed. P. E. Black). National Institute of Standards and Technology, May 15, 2019. https://xlinux.nist.gov/dads/HTML/Levenshtein.html.

Cite this as:

Weisstein, Eric W. "Edit Distance." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/EditDistance.html

Subject classifications