Skip to main content

a_star/
graph.rs

1use crate::NodeCost;
2
3/// Responsible for providing the graph structure for `A*` search.
4pub trait Graph<Node, Cost> {
5    /// Adds the neighbors of the `node` with their edge costs to the `neighbors` buffer.
6    fn neighbors(&self, node: Node, neighbors: &mut Vec<NodeCost<Node, Cost>>);
7
8    /// Estimates the lower limit of the cost from the `node` to the `goal`.
9    fn heuristic(&self, node: Node, goal: Node) -> Cost;
10}