ML-KULeuven / problog

ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.
https://dtai.cs.kuleuven.be/problog/
308 stars 36 forks source link

How to identify all goals another goal calls? #55

Closed mac389 closed 3 years ago

mac389 commented 3 years ago

For a research project, I want to create a graph based on a Problog program, where each vertex a clause or fact and an edge is drawn from vertex B to vertex A if vertex A invokes vertex B.

For example,

     a(x) :- 
      b(x), 
      c(x).

   b(x) :- c(x).

would translate into a graph with three vertices a,b,c and edges going b->a, c->a, c->b.

My thought is to insert writeln statements that print to the console and then redirect that output to a .dot file.

Is there a more elegant way? Perhaps using an internal representation Prolog has?

Please let me know if this is not the appropriate forum for this.

rmanhaeve commented 3 years ago

Hi

Although this wouldn't be impossible, I see no real reason to use ProbLog for this. Firstly, if this is purely deterministic and has no probabilistic aspect, plain Prolog should suffice. Secondly, using clauses like this to generate the graph seems somewhat confusing to me. Could you perhaps explain the goal / context a bit more so I can try to help you further?

Also, since this is not an issue, I'm closing it for now. Feel free to contact me directly.

Kind regards, Robin