Question: Define and test the PROLOG predicates described below. Each of your predicates must have the same name and signature as the examples below . Your

Define and test the PROLOG predicates described below. Each of your predicates must have the same name and signature as the examples below. Your predicates must behave properly on all instances of valid input types. Please write in PROLOG.

4) Route

Given the following graph of possible flights between seven US cities:

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).

Define and test the PROLOG predicates described below. Each of your predicates

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.

Omaha Seattle Albany Boston Fresno - Atlanta Dallas +

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!