|
Transitive closure is the first thing nearly every introduction to datalog (or Prolog, for that matter) will show you. All you had to do was click the link and scroll down: Edge("a", "b").
Edge("b", "c").
Path(x, y) :-
Edge(x, y).
Path(x, z) :-
Path(x, y),
Edge(y, z).
Symmetric closure, assuming I'm understanding correctly, is also trivial: SymmetricEdge(Left, Right) :-
Edge(Left, Right).
SymmetricEdge(Left, Right) :-
Edge(Right, Left).
|