I have a bipartite graph G
. I would like to find a fast algorithm (asymptotically) to find an assignment of all the vertices of G
into two sets X
and Y
such that the complete bipartite graph formed by the sets X
and Y
has as many edges as possible.
Slightly longer explanation:
G
is bipartite and consists of a set connected components (each of which are bipartite, obviously). We want to decide on a positioning (for lack of a better word) of each component into X
and Y
. After deciding upon all the positionings, we complete the bipartite graph (i.e. we connect every vertex of X
to every vertex of Y
). We then count out how many edges are there totally (including original edges) and we want to maximize this count. Simple math shows that the number of edges would be |X|*|Y|
.
My thought process for a solution:
As the number of components increase, the number of choices for G
increases exponentially. However, if we take number of connected components of G
to be equal to number of nodes in G
, then the solution is simple - split so that number of nodes in X
and Y
are equal (or almost equal in case of odd number of nodes in G
). This makes me want to generalize that the problem is the same thing as trying to minimize the difference in cardinalities of X
and Y
(which can be solved as in this SO question). However, I have been unsuccessful in proving so.