Skip to main content

assign_or_hall

Function assign_or_hall 

Source
pub fn assign_or_hall(adj: &[Vec<usize>], num_slots: usize) -> MatchOutcome
Expand description

Decide whether every item can be assigned a distinct slot, where adj[i] lists the slots item i may use and slots range over 0..num_slots. Returns a perfect assignment or a certified Hall witness. Finds a maximum matching with Hopcroft–Karp (O(E·√V) — many shortest vertex-disjoint augmenting paths per phase, far faster than Kuhn’s O(V·E) as instances grow), then — on failure — the König alternating-reachability construction extracts the deficient set.