TreeOutline

TreeOutline[tree]

gives an outline of the data in tree as a nested OpenerView.

TreeOutline[tree,pos]

gives an outline of the data in tree initially opened to the subtree at the position specified by pos.

TreeOutline[tree,{pos1,pos2,}]

opens the outline to several positions.

Details

  • Outlines are useful for interactively browsing a Tree object with many subtrees. TreeOutline also supports initially opening the outline to specific positions, allowing the tree structure to be easily viewed.
  • TreeOutline[Tree[data,{child1,child2,}]] gives OpenerView[{data,openers},False], where openers is a column of the TreeOutline[childi]. »
  • TreeOutline[tree,pos] uses OpenerView[,True] if tree has a proper subtree at position pos and OpenerView[,False] otherwise. »
  • TreeOutline[tree,{i,j,}] gives an outline opened to the position {i,j,}.
  • TreeOutline can use the position specifications returned by TreePosition as well as extended forms as used in functions such as TreeExtract and TreeInsert.
  • An individual position specification pos can be given as {part1,part2,}, where part specifications parti include:
  • ithe i^(th) child
    -ithe i^(th) child from the end
    {i1,i2,}the list of children with part numbers i1, i2,
    patternthe children with part number matching patt
  • Patterns can include constructs such as __, representing position specifications of variable lengths.
  • In TreeOutline[tree,{p1,p2,}], {p1,p2,} is interpreted as a list of individual position specifications if all the pi are lists. Otherwise, {p1,p2,} will be taken to be an individual position specification.

Examples

open allclose all

Basic Examples  (2)

Get an outline of a tree:

Open the first level of the tree:

Open all levels of the tree:

Open to a list of positions:

Scope  (3)

Open to the second child:

Open to the second child from the end of the first child:

Open to a list of positions:

Applications  (1)

Create an outline from the hierarchy of files in a directory:

Properties & Relations  (8)

TreeOutline returns an OpenerView object:

Leaves do not have openers:

TreeOutline[tree,pos] opens all subtrees that contain a proper subtree at positions specified by pos:

If the positions specified by pos do not exist, then the outline is left closed:

A pattern p that is not explicitly a list matches against the immediate children:

In that case, p is equivalent to {p}:

TreeOutline can use the lists of positions returned by TreePosition:

TreeOutline[tree,i] is equivalent to TreeOutline[tree,j] if the i^(th) and j^(th) children both exist:

This is similar if both children do not exist:

TreeOutline[tree] is equivalent to TreeOutline[tree,{}]:

Possible Issues  (2)

Opening to the root does not open any subtrees:

To open the root subtree, specify a position at level 1:

Negative integers are not supported in patterns:

Negative integers can be used in explicit positions:

Wolfram Research (2021), TreeOutline, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeOutline.html (updated 13).

Text

Wolfram Research (2021), TreeOutline, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeOutline.html (updated 13).

CMS

Wolfram Language. 2021. "TreeOutline." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 13. https://reference.wolfram.com/language/ref/TreeOutline.html.

APA

Wolfram Language. (2021). TreeOutline. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TreeOutline.html

BibTeX

@misc{reference.wolfram_2021_treeoutline, author="Wolfram Research", title="{TreeOutline}", year="13", howpublished="\url{https://reference.wolfram.com/language/ref/TreeOutline.html}", note=[Accessed: 24-May-2022 ]}

BibLaTeX

@online{reference.wolfram_2021_treeoutline, organization={Wolfram Research}, title={TreeOutline}, year={13}, url={https://reference.wolfram.com/language/ref/TreeOutline.html}, note=[Accessed: 24-May-2022 ]}