Function pathfinding::kuhn_munkres_min [] [src]

pub fn kuhn_munkres_min<C, W>(weights: &W) -> (C, Vec<usize>) where
    C: Bounded + Sum<C> + Zero + Signed + Ord + Copy,
    W: Weights<C>, 

Compute a minimum weight maximum matching between two disjoints sets of vertices using the Kuhn-Munkres algorithm (also known as Hungarian algorithm).

The weights between the first and second sets are given into the weights adjacency matrix. The return value is a pair with the total assignments weight, and a vector containing the column corresponding the every row.

For this reason, the number of rows must not be larger than the number of columns as no row will be left unassigned.

This algorithm executes in O(n³) where n is the cardinality of the sets.

Panics

This function panics if the number of rows is larger than the number of columns.