|
From: | Timo Karjalainen |
Subject: | Re: Need advice for path research |
Date: | Tue, 06 Jun 2006 20:21:06 +0300 |
Hi Gurvan,
path(From, To, [From, To]) :- rel(From, To). path(From, To, [From | Tail]) :- rel(From, Intermediate), path(Intermediate, To, Tail). How would you prevent an element to appear twice in the path?
You need to keep track of the nodes that you've visited already. Then you check that the Intermediate given by rel/2 is not in the set of already visited nodes.
-- TOK
[Prev in Thread] | Current Thread | [Next in Thread] |