I have been trying to understand the bipartite graph. To my understanding it is a graph G which can be divided into two subgraphs U and V.So that intersection of U and V is
Here is a Prolog CLP(FD) solution. Just model each edge in the graph as a variable in the domain 0..1. Then model each vertex as an equation:
X #\= Y.
Then issue labeling. If the labeling finds a solution, you are done. It might find multiple solutions though. Here is a run for your example:
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.3.23)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
:- use_module(library(clpfd)).
problem(L) :- L=[A,B,C,D,E,F,G],
A #\= E, A #\= F,
B #\= E,
C #\= E, C #\= F, C #\= H,
D #\= G, D #\= H,
E #\= A, E #\= B, E #\= C,
F #\= A, F #\= C, F #\= G,
G #\= F, G #\= D,
H #\= C, H #\= D.
?- problem(L), L ins 0..1, label(L).
L = [0, 0, 0, 1, 1, 1, 0] ;
L = [1, 1, 1, 0, 0, 0, 1].
Works also in GNU Prolog, SICStus Prolog, Jekejeke Minlog etc.. mostly with any Prolog system that implements CLP(FD). Alternatively could also use CLP(B) or dif/2.