Package COM.INFORMATIMAGO.COMMON-LISP.DIAGRAM.TREE-TO-DIAGRAM


This package generates a Diagram! text file drawing a tree.
The tree drawn is a list whose car is the node displayed, and
whose cdr is the list of children.


License:

    AGPL3

    Copyright Pascal J. Bourguignon 1994 - 2012

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.
    If not, see <http://www.gnu.org/licenses/>
(tree-depth tree)
function
PRE:    tree is a cons of the node and the list of children.
RETURN: the depth of the tree.
(tree-generate-random depth width)
function
RETURN:  A random tree with random number as node, of maximal depth `depth'
         and where each node has a maximum of `width` children.
NOTE:    The result can easily be degenreate (a single node,
         or a much smaller tree).
(tree-size tree)
function
PRE:    tree is a cons of the node and the list of children.
RETURN: The size of the tree (number of nodes)
(tree-to-diagram tree)
function
PRE:    tree is a cons of the node and the list of children.
DOES:   writes to the *standard-output* the Diagram file text.