Logic Programming

Assignment - Analysis

Suppose we have a directed graph with n nodes where n ≥ 3. We represent the graph as a dataset, where the factoid node(y) means that y is a node and the factoid edge(x,y) means that there is an edge from x to y. Assume that these are the only factoids in the dataset. In terms of n, what is the number of unifications it takes to evaluate the following query using full indexing?

goal(Y) :- node(Y) & edge(X,Y)

Suggestion: Use Sierra to check your answer for a graph with just 3 nodes.