ClusteringMapper

Match items using k-means clustering for balanced grouping.

When item counts differ (M→N), uses clustering to group the larger set into clusters, then matches clusters to the smaller set. Algorithm: 1. For N > M (merging): Cluster N items into M groups 2. For N < M (splitting): Cluster M items into N groups 3. For N = M: Falls back to greedy 1:1 matching

Constructor

ClusteringMapper(max_iterations: int = 50, random_seed: int = 42)

Methods

map

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

Map items using k-means clustering.