CSE505/Assignment1/B/reach.lp
2024-02-22 17:33:26 -05:00

16 lines
298 B
Plaintext

#include "reachin1000".
source(3).
% Way 1
reach(X) :- source(X).
reach(Y) :- edge(X,Y), reach(X).
% Way 2
%reach(Y) :- edge(X,Y), reach(X).
%reach(X) :- source(X).
% Way 3
%reach(X) :- source(X).
%reach(Y) :- reach(X), edge(X,Y).
% Way 4
%reach(Y) :- reach(X), edge(X,Y).
%reach(X) :- source(X).