Check for bipartitness.