> urticator.net

> About This Site

> Navigation
  Rating System
  Site Dynamics
  Legal Stuff

  Prose Explanation
> Notes on the Table of Contents
  Notes on the Index
  Notes on the History Block

> Width Three Is Best
  Exceptions to the Tree Structure

Width Three Is Best

For a tree of depth D and width W, the number of nodes is given by

N = 1 + W + … + WD = (WD+1 - 1) / (W - 1).

Or, for a fixed number of nodes, the depth can be computed from the width, and vice versa.

D = { ln [ 1 + N(W-1) ] / ln W } - 1

When fully expanded, the table of contents for such a tree will occupy one line for the root node plus W content lines and one blank line per layer of depth.

L = 1 + D(W+1)

Given a fixed number of nodes, we can substitute for D to obtain the number of lines L as a function of W, then minimize over W to determine the optimum width. I couldn't find a nice analytical solution, but here are some numerical results, courtesy of Mathematica.


These are surprising results—for all practical purposes, width three is best, with width four being next best. By the way, Mathematica couldn't find a nice analytical solution either, but it had a different way of saying so.

The equations appear to involve transcendental functions of the variables in an essentially non-algebraic way.

A better way to look at the problem is to consider the number of lines L as fixed, and see how the number of nodes varies as a function of W. The case L = 37 is both realistic and numerically convenient.

2312  8191
34  929524
45  7.228824.76
56  619531
67  5.1412052.99
78  4.5  7411.02

* * *

The above arguments show that width three is best, if the only criterion is the number of lines in the table of contents … but of course there are other criteria. One might like to reduce the number of mouse clicks needed to reach the bottom of the tree, i.e., minimize the depth; equivalently, one might like to increase the amount of contextual information presented to the user, i.e., maximize the width.

As often happens, the different criteria are in opposition; some intermediate balance must be found. Since widths three and four are both pretty good as far as number of lines is concerned, width four, or even five, might actually be best.


  See Also

  Memes (2)
  Tree Rearrangement

@ March (2000)
o January (2001)