Skip to main content

a_star

Function a_star 

Source
pub fn a_star<H: Fn(usize) -> f64>(
    g: &Graph,
    source: usize,
    target: usize,
    heuristic: H,
) -> Result<Option<(f64, Vec<usize>)>, ErrorsJSL>
Expand description

A* search from source to target guided by heuristic(v), an estimate of the remaining cost. With an admissible (never overestimating) and consistent heuristic the returned path is optimal; a zero heuristic reduces to Dijkstra. Returns (cost, path) or None if unreachable.