In Prolog, how can I implement graph algorithm in order to find all path in order to implement travel salesman problem in directed graph ?
example :
graph
expected input expected output X -----> Y
start X X Y X Z Y -----> T
end Z Y T X Y Z T -----> Z
T Z X Y T Z Y -----> Z
Y Z X -----> Z
X Z
As you know, in directed graph, there could be a cycle. However, no need to pass same point two times.
graph expected output
X ----> Y
Y ----> X X Y Z
Y ----> Z
Why I am elimineting this case is because ;
output :
X Y X Y ... Z
^^^
god knows this length ( when program terminates )
termination is np problem