This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

NeedlemanWunschSimilarity

NeedlemanWunschSimilarity[u, v]
gives a number representing the Needleman-Wunsch similarity between strings or vectors u and v.
  • NeedlemanWunschSimilarity[u, v] finds an optimal global alignment between the elements of u and v, and returns the number of one-element matches.
  • With the default setting SimilarityRules->Automatic, each match between two characters contributes 1 to the total similarity score, while each mismatch, insertion or deletion contributes -1.
  • The option GapPenalty specifies an additional cost to be subtracted from the similarity score for any run of insertions or deletions.
Needleman-Wunsch similarity between two strings:
Needleman-Wunsch similarity between two vectors:
Needleman-Wunsch similarity between two strings:
In[1]:=
Click for copyable input
Out[1]=
 
Needleman-Wunsch similarity between two vectors:
In[1]:=
Click for copyable input
Out[1]=
New in 7