% $Id: generateExplWeight.lp 34412 2013-03-11 18:42:05Z aravena $ % #const maxDepth=5. % element X precedes element Y on oriented network N reachable(X,Y) :- warc(X,Y,W). reachable(X,Y) :- reachable(X,Z), warc(Z,Y,W). % variables (X,Y) are always in the same order as assoc(X,Y). % no weight nor depth is considered for this definition explainable(X,Y) :- assoc(X,Y), reachable(Y,X). explainable(X,Y) :- assoc(X,Y), reachable(X,Y). explainable(X,Y) :- assoc(X,Y), reachable(A,X), reachable(A,Y). explainableNode(X) :- explainable(X,_). explainableNode(X) :- explainable(_,X). %%% all nodes X that can reach an explainable node A % notice that here we only look up to a given depth to avoid infinite recursion % when there are loops in the graph precedes(X,A,1,W) :- explainableNode(A), warc(X,A,W). % X precedes A at dist 1 w/ cumWgt W. precedes(X,A,N+1,W+Z) :- N