Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- distribute([], [], []).
- distribute([H|T], [H|L2], L3) :-
- distribute(T, L2, L3).
- distribute([H|T], L2, [H|L3]) :-
- distribute(T, L2, L3).
- both(X, Y, L) :-
- member(X, L),
- member(Y, L).
- bipartite([], _, _).
- bipartite([H|T], S1, S2) :-
- bipartite(T, S1, S2),
- [X,Y] = H,
- \+both(X, Y, S1),
- \+both(X, Y, S2).
- bipartite(M, L1, L2, L3) :-
- findall(N, between(1, M, N), NS),
- distribute(NS, L2, L3),
- bipartite(L1, L2, L3).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement