edit_distance

Function edit_distance 

Source
pub fn edit_distance(v1: &[u8], v2: &[u8]) -> usize
Expand description

Returns the edit distance between two u8 Vecs by doing the full grid calculation.

§Arguments

  • v1 - the first Vec
  • v2 - the second Vec

§Examples

use fmlrc::align::edit_distance;
let v1: Vec<u8> = vec![0, 1, 2, 4, 5];
let v2: Vec<u8> = vec![0, 1, 3, 4, 5];
let v3: Vec<u8> = vec![1, 2, 3, 5];
assert_eq!(edit_distance(&v1, &v1), 0);
assert_eq!(edit_distance(&v1, &v2), 1);
assert_eq!(edit_distance(&v1, &v3), 2);