Prelude to the Hungarian Algorithm for the Assignment problem
Prelude
to the Hungarian Algorithm
Preparation:
The
Hungarian Algorithm
works on a
bi-partite graph
where the
number of vertices
in both sets are
equal
If the
number of vertices
are
unequal
:
Add
dummy vertices
The
Hungarian Algorithm
works on a
complete
bi-partite graph
:
There is an
edge
between
every pair
of vertices in the
bi-partite graph
If the
graph
is
not
complete
:
Add
dummy edges
with
large cost values
to make the
bi-partite graph
complete
Example:
Cost assignment:
Adding dummy vertices:
Adding dummy edges of high cost:
Note:
As long as the
cost of dummy edge > max. cost of real edge
, the algorithm will
avoid
using a
dummy edge
if a
real edge
is
available