bipartite function implemented