If your Prolog system has a custom debugger, you can easily write your own runtime graph collection code. Suppose a Prolog system has a call_tracing / 2 callback, as in Jekejeke Prolog . Then we can continue and check the current frame and the parent frame to create a link on the chart. Here is the code:
goal_tracing(call, F) :- frame_property(F, sys_call_indicator(N, A)), frame_property(F, sys_parent_frame(G)), frame_property(G, sys_call_indicator(M, B)), !, update_link(N / A, M / B). goal_tracing(_, _). :- dynamic link/2. update_link(A, B) :- link(A, B), !. update_link(A, B) :- assertz(link(A, B)).
As you can see, we only check the call port, and we look only at the predicate indicator. But other approaches that have more data are possible. Now we need a utility to display the result. Here there is only a reset, which must be called before the assembly, and the show, which is called after the collection:
reset :- retract(link(_, _)), fail. reset. show :- write('http://yuml.me/diagram/scruffy/class/'), link(A, B), write(([B] -> [A])), write(', '), fail. show.
We create a link that is understood as yuml.me. Let's try with the peano facultative program. The program code is as follows:
add(n, X, X). add(s(X), Y, Z) :- add(X, s(Y), Z). mul(n, _, n). mul(s(X), Y, Z) :- mul(X, Y, H), add(Y, H, Z). fac(n, s(n)). fac(s(X), Y) :- fac(X, H), mul(s(X), H, Y).
We can run the collector as follows:
?- reset. ?- trace. ?- fac(s(s(n)),X). X = s(s(n)) ?- nodebug. ?- show. http://yuml.me/diagram/scruffy/class/[fac / 2] -> [fac / 2], [fac / 2] -> [mul / 3], [mul / 3] -> [mul / 3], [mul / 3] -> [add / 3], [add / 3] -> [add / 3], Yes
You can then paste the URL into the browser and see the diagram. Remove the "Yes" at the end of the URL. Here is the result:

Best wishes