/usr/share/Yap/clpbn/graphviz.yap is in yap 5.1.3-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | :- module(gviz, [clpbn2gviz/4]).
clpbn2gviz(Stream, Name, Network, Output) :-
format(Stream, 'digraph ~w {
graph [ rankdir="LR" ];~n',[Name]),
output_vars(Stream, Network),
info_ouput(Stream, Output),
format(Stream, '}~n',[]).
output_vars(_, []).
output_vars(Stream, [V|Vs]) :-
output_var(Stream, V),
output_vars(Stream, Vs).
output_var(Stream, V) :-
clpbn:get_atts(V,[key(Key),evidence(_)]),
output_key(Stream,Key),
format(Stream, ' [ shape=box, style=filled, fillcolor=red, fontsize=18.0 ]~n',[]),
fail.
output_var(Stream, V) :-
clpbn:get_atts(V,[key(Key),dist(_,Parents)]),
Parents = [_|_], !,
format(Stream, ' ',[]),
output_parents(Stream, Parents),
format(' -> ',[]),
output_key(Stream,Key),
nl(Stream).
output_var(_, _).
info_ouput(_, []).
info_ouput(Stream, [V|Output]) :-
clpbn:get_atts(V,[key(Key)]),
output_key(Stream,Key),
format(Stream, ' [ shape=box, style=filled, fillcolor=green, fontsize=18.0 ]~n',[]),
info_ouput(Stream, Output).
output_parents(Stream, [V]) :- !,
clpbn:get_atts(V,[key(Key)]),
output_key(Stream,Key).
output_parents(Stream, L) :-
format(Stream,'{ ',[]),
output_parents1(Stream,L),
format(Stream,'}',[]).
output_parents1(_,[]).
output_parents1(Stream,[V|L]) :-
clpbn:get_atts(V,[key(Key)]),
output_key(Stream,Key),
put_code(Stream, 0' ),
output_parents1(Stream,L).
output_key(Stream, Key) :-
output_key(Stream, 0, Key).
output_key(Stream, _, Key) :-
primitive(Key), !,
write(Stream, Key).
output_key(Stream, I0, Key) :-
Key =.. [Name|Args],
write(Stream, Name),
I is I0+1,
output_key_args(Stream, I, Args).
output_key_args(_, _, []).
output_key_args(Stream, I, [Arg|Args]) :-
format(Stream, '~*c', [I,0'_]),
output_key(Stream, I, Arg),
output_key_args(Stream, I, Args).
|