Skip to content

Commit

Permalink
This commit implements changes discussed in issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
So-Cool committed Dec 28, 2016
1 parent d1974e9 commit bfdc593
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions graphviz_swish.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
%%% Plotting terms as trees using Graphviz %%%

term_list_linear(false). % change to true for plotting lists linearly
:- dynamic write_to_file/1.
write_to_file(false). % write the dot structure to a file?

term(Term,Dot) :-
gv_start('term.dot'),
Expand Down Expand Up @@ -83,6 +85,7 @@
prove_d(B,Goal,N1,D1).

resolve(A,true) :-
write_to_file(true),
predicate_property(A,built_in),!,
call(A).
resolve(A,B):-
Expand Down Expand Up @@ -153,7 +156,7 @@
% open file and start new graph
gv_start(FileName) :-
retractall('$my_assert'(_)),
tell(FileName),
(write_to_file(true) -> tell(FileName); true),
writes(['digraph {']),
%writes(['graph [size="4,6"];']),
writes(['node [shape=plaintext, fontname=Courier, fontsize=12]']).
Expand All @@ -167,7 +170,7 @@
% finish graph and close file
gv_stop(Dot) :-
writes(['}']),
told,
(write_to_file(true) -> told; true),
get_dot(Dot).

% start new subgraph
Expand Down

0 comments on commit bfdc593

Please sign in to comment.