## `output::tree` -- display of trees

#### Introduction

`output::tree` formats internally represented trees to display graphically.

#### Call(s)

`output::tree(Tree <, indentdepth <, charlist> <, options>>)`

#### Parameters

`Tree` | - | the tree, given as a special list
`indentdepth` | - | indent depth for each subtree
`charlist` | - | the chars that illustrate the tree structure
`options` | - | option Small

#### Options

`Small` | - | suppresses the display of a space line between every tree entry

#### Returns

an string object to display

#### Related Functions

`adt::Tree`, `prog::exprtree`

#### Details

- `output::tree` displays trees given as specially MuPAD lists.
- The first object of the list is the root of the tree. All further objects are nodes or subtrees of the tree. A subtree is again a special list (as described), and any other MuPAD object will be interpreted as node of the tree.
- The elements of the tree will be printed by MuPAD, when the tree will be displayed, so it's recommended to use strings as objects or objects with a well defined display.
- The return value is a string that contains all chars to display the tree. With functions `print` and `fprint` and the option `Unquoted` the tree can be displayed.
- The parameter `charlist` is a list with five characters. The default value is `[", "+", ", ``", " "]`. The characters have the following meaning (described in the order of the list).
- The vertical lines of the tree, the connection between vertical and horizontal line (i.e., an arm, but not the last arm), an arm (vertical line), the last connection to an arm in a subtree, a char between an arm and the description of the arm.

#### Option: Small

- suppresses the display of a space line between every tree entry to reduce the height of the tree

#### Example 1

`output::tree` displayes special nested lists as trees:

    >> TREE := ["a1", "a2", ["b1", "b2", ["c1", "c2"], "b3"],
                      ["d1", "d2", "d3"]]:
       print(Unquoted, output::tree(TREE))

                                  a1
                                  |
                                  +-- a2
                                  |
                                  +-- b1
                                  |   |
                                  |   +-- b2
                                  |   |
                                  |   +-- c1
                                  |   |   |
                                  |   |   `-- c2
                                  |   |
                                  |   `-- b3
                                  |
                                  `-- d1
                                      |
                                      +-- d2
                                      |
                                      `-- d3

    >> print(Unquoted, output::tree(TREE, 3, Small)):

                                    a1
                                    +- a2
                                    +- b1
                                    |  +- b2
                                    |  +- c1
                                    |  |  `- c2
                                    |  `- b3
                                    `- d1
                                       +- d2
                                       `- d3

The chars can be defined by the user:

    >> print(Unquoted, output::tree(TREE, 6, ["|", "|", ".", "\\", " "])):

                               a1
                               |
                               |.... a2
                               |
                               |.... b1
                               |     |
                               |     |.... b2
                               |     |
                               |     |.... c1
                               |     |     |
                               |     |     \.... c2
                               |     |
                               |     \.... b3
                               |
                               \.... d1
                                     |
                                     |.... d2
                                     |
                                     \.... d3

#### Changes

- new function

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000