Algorithm for finding a maximal matching in a bi-partite graph