A graph is a set V = {a, b, c, . . .} of vertices and a set E ⊆ V × V of edges. We use the binary predicate edge to represent the edges: edge(a,b) means that there is an edge from a to b. In a...


A graph is a set V = {a, b, c, . . .} of vertices and a set E ⊆ V × V of edges.


We use the binary predicate edge to represent the edges: edge(a,b) means


that there is an edge from a to b. In a directed graph, the edges have a


direction, so edge(a,b) is different from edge(b,a). We say that there is


a path from a to b in a graph if there is a sequence of one or more edges


that allows us to go from a to b.


a) Write a logic program defining the predicate path.


b) Write a query to compute all the directed paths starting from a in the


graph.


c) Write a query to compute all the directed paths in the graph.



May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here