Another Recursive Query
Flight(x,y) : there is a flight from city x to y.
Hub(x): x is a hub.
Query: find pairs of cities for which there is a flight that goes through some hub.
Fl(x,y) :- Flight(x,y)
Fl(x,y) :- Flight(x,z), Fl(z,y)
Answer(x,y) :- Fl(x,z), Hub(z), Fl(z,y).
Previous slide
Next slide
Back to first slide
View graphic version