Skip to main content

a_star

Function a_star 

Source
pub fn a_star<F>(
    graph: &HashMap<String, Vec<Edge>>,
    start: &str,
    goal: &str,
    heuristic: F,
) -> Result<(Vec<String>, f64), Error>
where F: Fn(&str, &str) -> f64,
Expand description

A* shortest path.

The heuristic must be non-negative. For an optimal first result it should be admissible and consistent; inconsistent but admissible heuristics still return an optimal path, but may cause nodes to be re-expanded.

All edge weights must be non-negative.