Suppose we have two strings:
- ccttgg
- gacgct
The edit distance of these two strings is 6.
Possible substrings are:
- cctt--
- gacg--
Their edit distance is 4.
The remaining parts to equal the original two strings are:
- ----gg
- ----ct
and their edit distance is 2.
So 4+2=6, that is the original edit distance.
Is this type of assumption always correct?
If it's not, is there a way to compute the edit distance between two strings using the edit distance of their substrings?
Edit: to be clearer my definition of edit distance is the Levenshtein distance with a cost of 1 for insertion, deletion and replace if the characters are not the same and 0 if the characters are equal. I'm not considering the Damerau distance with transpositions.