[−][src]Function bio::alignment::distance::levenshtein
pub fn levenshtein(alpha: TextSlice, beta: TextSlice) -> u32
Compute the Levenshtein (or Edit) distance between two strings. Complexity: O(n * m) with n and m being the length of the given texts.
Example
use bio::alignment::distance::*; let x = b"ACCGTGGAT"; let y = b"AAAAACCGTTGAT"; // ----ACCGTGGAT // ||||| ||| // AAAAACCGTTGAT let ldist = levenshtein(x, y); // Distance is 5 assert_eq!(ldist, 5);