I'm given a graph with many seperate components. Each component is bipartite. How do I distribute the vertices into two sets A
and B
such that the difference between the two sets is minimal ?
Example:
1: 1 -> 2 ->3 -> 4 -> 5
2: 6 -> 7 -> 8
The best solution is
A = {1, 3, 5, 7}
B = {2, 4 ,6, 8}
The other (non-optimal) solution is
A = {1, 3, 5, 6, 8}
B = {2, 4, 7}
How do you solve this when the graph has many seperate bipartite components ?