Skip to content

Commit

Permalink
docs(astar): add documentation for SmallestCostHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
samueltardieu committed Aug 24, 2024
1 parent 3c3f05f commit ad95f6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/directed/astar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ where
.map(|(solutions, cost)| (solutions.collect(), cost))
}

/// This structure is used to implement Rust's max-heap as a min-heap
/// version for A*. The smallest `estimated_cost` (which is the sum of
/// the `cost` and the heuristic) is preferred. For the same
/// `estimated_cost`, the highest `cost` will be favored, as it may
/// indicate that the goal is nearer, thereby requiring fewer
/// exploration steps.
struct SmallestCostHolder<K> {
estimated_cost: K,
cost: K,
Expand Down

0 comments on commit ad95f6e

Please sign in to comment.