yog/pathfinding/matrix

Optimized distance matrix computation for subsets of nodes.

Values

pub fn distance_matrix(
  in graph: model.Graph(n, e),
  between points_of_interest: List(Int),
  with_zero zero: e,
  with_add add: fn(e, e) -> e,
  with_compare compare: fn(e, e) -> order.Order,
) -> Result(dict.Dict(#(Int, Int), e), Nil)

Computes shortest distances between all pairs of points of interest.

Automatically chooses between Floyd-Warshall and multiple Dijkstra runs based on the density of POIs relative to graph size.

Time Complexity: O(V³) or O(P × (V + E) log V)

Search Document