Function bio::alignment::distance::levenshtein [] [src]

pub fn levenshtein(alpha: TextSlice, beta: TextSlice) -> u32

Compute the Levenshtein (or Edit) distance between two strings with levenshtein. It returns a distance between two strings, i.e. minimal number of mismatches, insertions and deletions between two strings.

Example

use bio::alignment::distance::*;

let x = b"ACCGTGGAT";
let y = b"AAAAACCGTTGAT";
// ----ACCGTGGAT
//     ||||| |||
// AAAAACCGTTGAT
let l_score = levenshtein(x, y);  // Score is 5
assert_eq!(l_score, 5);