HungarianMapper

Optimal mapping using Hungarian algorithm.

Uses the Hungarian (Munkres) algorithm for globally optimal assignment. Minimizes total distance across all pairings, unlike greedy matching which may get stuck in local minima. Algorithm: 1. Build cost matrix of distances between all item pairs 2. For N!=M cases, replicate items to create square matrix 3. Apply Hungarian algorithm to find minimum-cost perfect matching 4. Map assignments back to original items For N>M (merging): Multiple start items morph to same end item For N

Constructor

HungarianMapper(args, kwargs)

Methods

map

map(
    start_items: list[T],
    end_items: list[T],
    get_position: Callable[[T], Point2D]
) -> list[Match[T]]

Map items using Hungarian algorithm for optimal assignment.