Did you know ... Search Documentation:
Pack modeling -- prolog/drawtree.pl
PublicShow source
author
- Francois Fages
version
- 0.0.1
?- term_to_text(this(is, not, a(pipe))).
this
 is
 not
 a
  pipe
true.

Used in library(tracesearch) to draw search trees with predicate search_tree_tikz/1

Used in library((clp) and library(modeling) to draw labeling search trees with a new option trace/0 added to predicate labeling/2. E.g. traced search tree for the 4 queens problem and written in tikz:

\begin{tikzpicture}[
           ->,
           level/.style={sibling distance=6cm/#1}, % sensitive parameter to adjust manually
           level distance=2cm
          ]
\node {{labeling([x1,x2,x3,x4])}}
child {
 node {{x1=1}}
 child {
  node {{x2=3}}
 }
 child {
  node {{x2$\neq$3}}
 }
}
child {
 node {{x1$\neq$1}}
 child {
  node {{x1=2}}
  child {
   node {{[2,4,1,3]}}
  }
 }
 child {
  node {{x1$\neq$2}}
  child {
   node {{x1=3}}
   child {
    node {{[3,1,4,2]}}
   }
  }
  child {
   node {{x1$\neq$3}}
   child {
    node {{x2=1}}
   }
   child {
    node {{x2$\neq$1}}
   }
  }
 }
}
;
\end{tikzpicture}

Note that in the generated LaTeX tikz picture, the distance parameters generally needs to be ajusted manually.

 term_to_latex(+Term)
same as term_to_latex(current_output, Term).
 term_to_latex(+Output, +Term)
writes on Output file or stream a complete LaTeX document that generates an image in pdf of the tree structure of Term. Unfortunately tikz does not accept verbatim mode for node labels, hence special characters like _ or \ in the writing of Term create LaTeX errors and should be treated first.
 term_to_tikz(+Term)
same as term_to_tikz(current_output, Term).
 term_to_tikz(+Output, +Term)
writes on output Output LaTeX tikz picture code for drawing the tree structure of Term. Unfortunately tikz does not accept verbatim mode for node labels, hence special characters like _ or \ in the writing of Term create LaTeX errors and should be treated first.
 term_to_text(+Term)
% draws the tree structure of Term in text.
 term_to_text(+Output, +Term)
% draws the tree structure of Term in text on Output.