Question: Find a path in a weighted graph: ( 1 0 Points ) In the verifier.pl file, there is a representation of the following graph using
Find a path in a weighted graph:
Points
In the
verifier.pl file, there is a representation of the following graph using predicates to define the
edges as edge where A and are the nodes and is the weight of the edge. Using the
graph representation, write a prolog predicate to find a path in the weighted graph between two
nodes. Along with finding the path, you should also print the total weight obtained while taking
the path determined by your program. The solution should not generate cyclic paths. Note that the
graph is undirected and that the provided edge predicates do not specify a direction. For example,
edge can be traversed from to or from to The goal predicate will take the form:
findpath Weight,Path
where name of the node
Weight weight of the path taken
Path path taken in the form of a list
Sample Run:
findpathWeight,Path
Path
Weight ;
Path
Weight ;
File Name:
findpath.pl
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
