Struct cfg::prediction::MinimalDistance [] [src]

pub struct MinimalDistance<'a, G: 'a> {
    // some fields omitted
}

Calculation of minimum distance from one part of the grammar to another. Similar to multi-source shortest path search in a graph.

Methods

impl<'a, G> MinimalDistance<'a, G> where G: ContextFree + 'a, &'a G: ContextFreeRef<'a, Target=G>

fn new(grammar: &'a G) -> Self

Returns a new MinimalDistance for a grammar.

fn distances(&self) -> &[Vec<Option<u32>>]

Returns distances in order respective to the order of rule iteration.

fn minimal_distances<I, J>(&mut self, iter: I) -> &[Vec<Option<u32>>] where I: Iterator<Item=(&'a G::RuleRef, J)>, J: Iterator<Item=usize>

Calculates minimal distance from one parts of the grammar to others. Returns distances in order respective to the order of rule iteration.