It is necessary to implement a swi-prolog program that implements the search for all cycles in an undirected graph and outputs the result without repetitions. Example:
?-find_cycles([a-[b,c,d],b-[a,c],c-[a,b,d],d-[a,c]])
Result:
Cycle = [a,b,c]
Cycle = [a,d,c]
Cycle = [a,b,c,d]
I tried to implement the dfs algorithm but it did not work
I think this is what you want, or at least it's a starting point:
Results in swi-prolog: