implement bipartite complement