yog/pathfinding/utils

Shared types and utilities for pathfinding algorithms.

Types

Represents a path through the graph with its total weight.

pub type Path(e) {
  Path(nodes: List(Int), total_weight: e)
}

Constructors

  • Path(nodes: List(Int), total_weight: e)

Values

pub fn compare_a_star_frontier(
  a: #(e, e, List(Int)),
  b: #(e, e, List(Int)),
  cmp: fn(e, e) -> order.Order,
) -> order.Order
pub fn compare_distance_frontier(
  a: #(e, Int),
  b: #(e, Int),
  cmp: fn(e, e) -> order.Order,
) -> order.Order
pub fn compare_frontier(
  a: #(e, List(Int)),
  b: #(e, List(Int)),
  cmp: fn(e, e) -> order.Order,
) -> order.Order
pub fn should_explore_node(
  visited: dict.Dict(k, e),
  node: k,
  new_dist: e,
  compare: fn(e, e) -> order.Order,
) -> Bool

Helper to determine if a node should be explored based on distance comparison. Returns True if the node hasn’t been visited or if the new distance is shorter.

Search Document