graph path in prolog -


I have created rules for getting the path of a graph with the defined edges:

  Graph (A, B). Graph (A, C). Graph (b, c). For example:  
  Article (a, [a, b, e]), but now I need to do this. Graph (b, [c, d]). Graph (d, []).   

I had this:

  path (origin, destination, list): - path (origin, destination, list, [original]). Path (x, x, list, floating): - reverse (temporary, list). Path (Genesis, Dest, List, Temp): - Graph (Genesis, Difference), No (Member (Difference, Temp)), Path (Difference, Destination, List, [Inter | Temporarily]).   

And I know that the problem is in the graph (original, inter), but I do not know how to zoom it so that it can get inside the list, I have tried graph (original, [inter | _]) but obviously it only checks for the first one. Any help (even if this code is not) will be greatly appreciated.

Assume the guided article:

  side (x, y) : - Graph (X, Nodes), Member (Y, Nodes)    

Comments