SWI-Prolog Did You Know Did you know? you can turn terms into graphviz (.dot) files Search Documentation:
Predicate prolog_trace_interception/4