I am checking if the graph is connected and for some reason getting false when it should be true.
allConnected([]).
allConnected(A|L) :- checkConnect(A,L), allConnected(L).
checkConnect([],[]).
checkConnect(X, Head|Y) :- isConnected(X,Head), checkConnect(X,Y).
isConnected(X,Y) :- edge(X,Y); edge(Y,X).
edge(a,b).
edge(b,c).
edge(c,a).
What I'm doing for my predicate is checking if every node in allConnected([a,b,c]) is connected. I should be getting true, but can't pinpoint my error, I have tried using trace, but it does not help.