database of social networking in prolog
Posted on 2008-10-27
I am currently building a social networking stuff, similar like facebook or friendster and I a bit stuck in this part where I need to have a predicate that basically says " who is X friends with, through at most two intermediate people, and what is the path?" I have a database in my prolog file which is something like:
I want to create a prolog predicate called friend(X,Y,Z). An example I want it to do something like
L = [chris, geen, jill, clark].
and other stuff according what it finds in the database.
I know that I am suppose to use recursion here and backtracking, as well as the cut operation to tell the function to stop when it finds a friend more than 2 bridges. Can someone please help me one this