4
$\begingroup$

In regards to the new tree functionality in Mathematica 12.3, apparently the display is collapsed/summarized when an element has more than 10 sub-elements, so what I was expecting to be displayed as 11 is replaced by a <<1>>:

RulesTree[1 -> Range[11]] 

tree

is there an way of preventing this to display the full tree?

UPDATE: I have found that there is a symbol Trees`$VisualizationMaxChildren which is protected. It can be unprotected and changed to avoid the truncation. I'll leave the question open as this is kind of a hack, but it works.

$\endgroup$

2 Answers 2

4
$\begingroup$

There's a protected, internal parameter you can tweak:

Unprotect[Trees`$VisualizationMaxChildren]; Trees`$VisualizationMaxChildren = 12; Protect[Trees`$VisualizationMaxChildren]; RulesTree[1 -> Range[12]] Unprotect[Trees`$VisualizationMaxChildren]; Trees`$VisualizationMaxChildren = 10; Protect[Trees`$VisualizationMaxChildren]; 

enter image description here

The value is used at the time MakeBoxes[] is called, so if you change the value of $VisualizationMaxChildren back to 10 within a code before the tree is returned and converted to boxes, it won't work.

Does not work:

Block[{Trees`$VisualizationMaxChildren = 12}, RulesTree[1 -> Range[12]] ] 

Works:

Block[{Trees`$VisualizationMaxChildren = 12}, With[{expr = RulesTree[1 -> Range[12]]}, MakeBoxes[expr, StandardForm] // RawBoxes] ] 
$\endgroup$
2
  • $\begingroup$ Oh, well, I was lazy. I answered the Q before reading it completely.... :) $\endgroup$ Commented Jul 9, 2021 at 21:33
  • $\begingroup$ Thanks, you added much more detail to my update in the question. $\endgroup$ Commented Jul 12, 2021 at 13:31
3
$\begingroup$

Trees are still being considered as Experimental in 12.3, and there are no visualization options yet (source).

I think you will have to rely on TreePlot:

TreePlot[Flatten@Table[{1 -> i}, {i, 2, 12}], VertexLabeling -> True] 

TreePlot

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.