Hi,
I am trying to write a routing function but I cannot seem to get the result needed. This is the code so far. Predecessor finds the node that is linked to N and returns it as P.
traceroute(_,L) :- member((A,A),L).
traceroute(N,L) :- predecessor(N,P),
append(N,L,L1),
traceroute(P,L1).
When I run my traceroute(placeA, Y).
it returns this data..
Y = [ (_G575, _G575)|_G579] .
Basically for the first line of traceroute I am trying to terminate the recursion if any member is a predecessor of itself. The second part should be loop through all the nodes and add them to the list (L).
The nodes are stored like [(placeA,placeB),(placeB,placeC)] and the list should store like [placeA,placeB,placeC]
I can't understand why I am getting these results.
Help! :)