Skip to main content
2 of 3
added that it's only for two colors
domotorp
  • 19.1k
  • 3
  • 59
  • 128

For two colors this can be solved in polynomial time for any graph, as it can be converted to a MinCut problem. Just connect all red vertices into a single vertex $s$, and all blue vertices into another single vertex $t$, obtaining a multigraph (or if you prefer, a graph with edge weights). The Minimum cut in this new graph between $s$ and $t$ gives the partition that gives the coloring maximizing the number of the monochromatic edges.

domotorp
  • 19.1k
  • 3
  • 59
  • 128