Find the shortest path between the two nodes in the graph in (Prolog) and display the result as an array

[ enter image description here ]

How can I write (using print_path ) a rule to print the path from one node to another, if exists

 Print_path(a, c, Res) ---> Res=[a, f, c] 

What I've done:

 path(a,b). %there is a path from a to b path(a,f). path(b,c). path(c,d). path(c,e). path(e,d). path(f,g). path(f,c). path(f,e).` 

I do not know what to do next.

0
path member prolog shortest-path
source share

No one has answered this question yet.

See similar questions:

7
How to find a unique shortest path for a weighted directed graph using SWI Prolog?

or similar:

605
A reliable way for a Bash script to get the full path to itself
42
Find the paths between two given nodes?
27
Search for all shortest paths between two nodes in an unweighted undirected graph
7
How to find a unique shortest path for a weighted directed graph using SWI Prolog?
5
Finding the shortest path between any two nodes belonging to two disjoint subsets of a graph
3
Find the shortest path between two nodes in a graph in Prolog
2
The cheapest and shortest path between two nodes
one
How to find the shortest path in an equal weighted graph
one
How to save a list of visited nodes in transit on a graph in Prolog
0
The shortest path in the grid using prolog

All Articles