Sunday, August 9, 2026

Enumerating timber and circles


A couple of days in the past I wrote a publish on counting rooted timber. That publish seemed on the sequence c(n) which counts the variety of rooted timber with n nodes. Right here one node is distinguished as the basis, however the nodes under the basis aren’t distinguished from one another; all that issues is how the nodes are linked.

The variety of rooted timber with n nodes is similar because the variety of methods to configure n − 1 non-overlapping circles. Not solely are the counts the identical, there’s a pure correspondence between the timber and the circles. It’s not apparent that there must be such a correspondence, with the appropriate notation the correspondence is kind of a pun.

The usual option to characterize unlabeled timber is as a multiset of their youngsters. We use a multiset, not a set, as a result of some parts will probably be repeated. We characterize a leaf as a pair of parentheses: ().

There is just one rooted tree with one node: ().

There is just one rooted tree with one two nodes: (()). Right here the outer parentheses characterize the basis node and the internal parentheses characterize its little one.

There are two rooted timber with three nodes, and we will characterize them as ((())) and ((),()). The primary is the straight line tree: a node that has a single little one node that has a single little one node. The second is a node that branches to 2 nodes. (Right here’s the place we’d like multisets.)

The 4 rooted timber with 4 nodes might be represented as (((()))), ((((),())), ((),(())), and ((),(),(),()).

Listed here are the 9 rooted timber with 5 nodes:

((((()))))
((((),())))
(((),(())))
(((),(),()))
((()),(()))
((),((())))
((),((),()))
((),(),(()))
((),(),(),())

The correspondence with non-overlapping circles removes the outer parentheses then joins the remainder to kind circles, with nested parentheses akin to concentric circles. A extra geometric option to see the correspondence is to begin on the backside of the tree, exchange leaves with circles, then work your means up circling linked parts.

Related Articles

Latest Articles