Hi Guys!
I am in a need of help! Sorry if my English is not okay.
So let's see my problem:
I would like to make a pathing algorith on direcred nodes.
so 1 -> 2, 1 -> 3, 2 -> 1 means 1 can visit 2 and 3, and 2 can visit 1, but 3 cannot visit 1.
I would like to visit all nodes from a given node. My function header looks like this: traversal(G, X) g = graph, X = node.
I would like to use a global "list", where I can remove elements, that I have already visited so far: In the starting situation all elements exists in the G. After 1 visits 2, I would like to remove 1 from the list (and 2 also).
Of course in some situation there can be a "dead end", and prolog will backtrack.
The problem is, prolog will "go back in time" with list: It will use the list before the dead and happend. I want to not let this happen. If 3 -> 4 happens, Remove 3 from G (and also 4). If 4 is a dead and, I don't want 3 and 4 to be again on the list.
I hope I am clear.
I am in a need of help! Sorry if my English is not okay.
So let's see my problem:
I would like to make a pathing algorith on direcred nodes.
so 1 -> 2, 1 -> 3, 2 -> 1 means 1 can visit 2 and 3, and 2 can visit 1, but 3 cannot visit 1.
I would like to visit all nodes from a given node. My function header looks like this: traversal(G, X) g = graph, X = node.
I would like to use a global "list", where I can remove elements, that I have already visited so far: In the starting situation all elements exists in the G. After 1 visits 2, I would like to remove 1 from the list (and 2 also).
Of course in some situation there can be a "dead end", and prolog will backtrack.
The problem is, prolog will "go back in time" with list: It will use the list before the dead and happend. I want to not let this happen. If 3 -> 4 happens, Remove 3 from G (and also 4). If 4 is a dead and, I don't want 3 and 4 to be again on the list.
I hope I am clear.