4 ms·
Can you explain what transitive closure is and how your prolog snippet accomplishes it?
by simplify 8y ago
Can you explain what transitive closure is and how your prolog snippet accomplishes it?
- carapace 8y agohttps://en.wikipedia.org/wiki/Transitive_closure#In_graph_theory https://en.wikipedia.org/wiki/Transitive_closure#In_graph_th... > In computer science, the concept of transitive closure can be thought of as constructing a data structure that makes it possible to answer reachability questions. That is, can one get from node a to node d in one or more hops? A binary relation tells you only that node a is connected to node b, and that node b is connected to node c, etc. That snippet defines a function path(A, B) by specifying two cases: 1. a link(A, B) exists -or- 2. some element I exists, such that a link(A, I) exists and path(I, B) exists.