I have a list of user facts defined as:
user(@michael).
user(@ana).
user(@bob).
user(@george).
user(@john).
and so on. Furthermore, I have a set of facts as:
follows(@michael,@ana).
follows(@ana,@bob).
follows(@bob,@michael).
I am trying to write a relation indirect(user1,user1) which will tell me if user1 indirectly follows user2. However, I am not able to do away with cyclic relations.
Like in the given example, michael -> ana -> bob -> michael will cause a cycle.
What is the best way to eliminate these cycles from the result of indirect(user1,user2)?