Skip to main content

astar

Function astar 

Source
pub fn astar<F>(
    graph: &Subgraph,
    start: &str,
    goal: &str,
    heuristic: F,
) -> Option<(f64, Vec<String>)>
where F: Fn(&str, &str) -> f64,
Expand description

A* search from start to goal (§5.4).

Returns the total cost and the full path inclusive of both endpoints, or None when goal is unreachable. heuristic must be admissible — it must never overestimate the remaining cost — or the path returned is a path but not necessarily the shortest one.