Is Levenshtein distance related to largest common subsequence?

177 Views Asked by At

I don't have proof but i have gut feeling that , suppose s1 is string which needs to be converted to s2 then we can keep the largest common subsequence in s1 as it is and edit distance is number of elements we need to replace to add .

For example : s1 = "adjsjvnejnv"
              s2 = "djpppne"

Here LCS is "djne" , now we need to remove 3 element string "jnv" at right side of "djne" ,we can replace "sjv" with "ppp" in s1 and and we can delete "a" from s1. so total edit distance is 3+3+1 = 7 .

Idea is to replace or delete elements inbetween the elements of LCS and add or remove elements from right and left part of LCS .

I am not able to prove it . Can someone provide counterexample or proof ?

1

There are 1 best solutions below

0
On BEST ANSWER

Lets take s1 = "abbba" and s2 = "aaccc". Levenshtein distance is obviously at most $4$, but LCS is "aa", and your method, if I understood correctly, will remove bbb and add ccc, leading to $6$ edits.