A graph with some nodes (from a to j) and some arcs
connecting the nodes are defined. The arcs are bidirectional:
For an arc connecting a and b, it means that both a -> b and
b -> a are allowed.
This Prolog program can find out all paths between any two
nodes. A path is a list of arcs that connects two nodes.
Source Code
Output
Run the script by swi-prolog, assume that the name of the script is graph01.pl.
No comments:
Post a Comment