Question
Given the following graph of possible flights between seven US cities: (graph taken from the web site of the American Mathematical Society, http://www.ams.org) Define a
Given the following graph of possible flights between seven US cities:
(graph taken from the web site of the American Mathematical Society, http://www.ams.org)
Define a predicate route/3 that takes two cities as arguments and finds the routes to get from city A to a city B. Your predicate should have the signature route(cityA, cityB, Route). Examples:
?- route(seattle, boston, X).
X = [seattle, omaha, atlanta, boston] ;
false.
?- route(fresno, atlanta, X).
X = [fresno, seattle, omaha, atlanta] ;
X = [fresno, albany, seattle, omaha, atlanta] ;
X = [fresno, albany, dallas, seattle, omaha, atlanta] ;
false.
?- route(albany, atlanta, X).
X = [albany, seattle, omaha, atlanta] ;
X = [albany, dallas, seattle, omaha, atlanta] ;
false.
?- route(boston, atlanta, X).
false.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started