I am a real newbie in Prolog and I am having a hard time with some basic stuff...
I have a cluster of letters connected to each other randomly. Each letter is a node and the connection between two letters is an edge. I'm trying to find the path between a letter to another. E.g : the path between A and C (knowing that A is connected to B which is connected to C but C is not connected to A directly.
Here is what I implemented :
node(noA).
node(noB).
node(noC).
edge(noA,noB).
edge(noB,noC).
connected(X,Y):- edge(X,Y).
connected(X,Y):- edge(Y,X).
exists_way(X,Y):-
connected(X,Z),
connected(Y,Z).
But of course it does not apply to a bigger cluster with a lot of letters...
Could anyone of you help me ?
Thank you very much in advance !