Im new at Prolog , and I am trying some manipulation on graphs .
I have a problem in my implementation, and since it is very long and complicated to expose , I will give a simple and similar problem .
Let say we have the following graph :
edge(a,e).
edge(e,d).
edge(d,c).
edge(c,b).
edge(b,a).
edge(d,a).
edge(e,c).
edge(f,b).
And I wanted to make this graph bidirected . I use the following code :
graph(Graph):-findall(A-B, edge(A,B), L),
findall(B-A, edge(A,B), L1),
append(L, L1, Graph).
when executing the query I get this result :
?- graph(Graph).
Graph = [a-e, b-a, c-b, d-a, d-c, e-c, e-d, f-b, ... - ...|...].
My problem is not in the code my problem is in the results as you can see I don't get the complete results, its always giving me only 8 edges and the rest are not shown.
How to solve this ?
graph(Graph),writeln(Graph).
writeln/1
writes out the entire variable to the output.
From @WillemVanOnsem
If you write graph(G);true.
then the program will pause after the first statement. Next you can hit W and it will again write the answer but now in full.