Exponential Generating Functions for Trees with Weighted Edges and Labeled Nodes

Wen-jin Woan^{1} Howard University Washington, DC 20059 USA

                     wjwoan@sbcglobal.net

Barbara Tankersley North Carolina Agricultural and Technical State University Greensboro, NC 27411 USA

                       tankers@ncat.edu

Abstract

We study labeled trees and find that this is a class of combinatorial objects which is perfect for the study of some exponential generating functions.

1 Introduction

In this paper we study the counting of various trees with labeled nodes and weighted edges and its exponential generating functions. Section 1 is about rooted plane trees. Section 2 is about labeled trees. In Section 3, we give some examples of labeled trees and its exponential generating functions. In Section 4, we discuss weighted and labeled trees and its exponential generating functions. In Chapter 1 of [4], two tree representations of permutations are studied, here we study the combinatorics of the second tree representation through generating functions and show the connections with some classical sequences. A similar study corresponding to the first tree representation of [4] has been done in [2, 7].

The counting of trees (rooted plane trees) is the Catalan sequence, c_{0} = 1, 1, 2, 5, 14, 42, … Traverse the tree starting from the root going up on the left side of the branches and coming down on the right side of the branches. On the way down if we encounter a right branch we go up. Label the nodes in order with [n] = {0, 1, 2, 3, …, n} by preorder, i.e., label the nodes at the first visit.

1Author’s current address: 2103 Opal Ridge, Vista, CA 92081, USA.

Example 1. Rooted plane trees of order n = 3, c_{3} = 5

[figure: 0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 2; 3]

2 Labeled Trees

In this section we define labeled trees and study some well known partitions of permutations. Let P = a_{1}a_{2}a_{3} ⋯ a_{n} be a permutation, locate the smallest number a_{i}. Partition P = F a_{i}B by F the part before a_{i} and B the part after a_{i}, then inductively label the first node of the left most branch by a_{i} and put the subtree for F on top of a_{i} and the subtree for B to the right of a_{i}. Note that the labeled tree satisfies the following conditions:

(1) Increasing on any path going up,

(2) Increasing from left to right of the immediate siblings of a node.

Definition 2. A labeled tree is a tree with nodes labeled by [n] = {0, 1, 2, 3, 4, …, n} which satisfies the above two conditions. It is also called an increasing tree, please refer to [4].

Example 3. We read the labeled trees in postorder and they correspond to permutations as follows: For n = 3, the third tree has two choices (2 or 3) for position 2 and the count is

s_{3} = 1 + 1 + 2 + 1 + 1 = 6.

Permutations: 321, 231, 213, 312, 132, 123.

[figure: 0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 3; 2; 0; 1; 2; 3; 0; 1; 2; 3]

It is well known that the counting of labeled trees is n!, please refer to [4, Prop. 1.3.16] for the properties of this section. You can also find related subjects in [1, 5].

3 Some Examples of Labeled Trees

In this section we study some examples of labeled trees and its exponential generating functions(EGF). Let A(x) = ∑ \frac{1}{n!}a_{n}x^{n} and B(x) = ∑ \frac{1}{n!}b_{n}x^{n} be the exponential generating functions for the sequences {a_{n}}, {b_{n}} , then

A(x)B(x) = ∑ \frac{1}{n!}(∑ \binom{n}{k}a_{k}b_{n−k})x^{n} (1)

On the other hand, if we let t_{n} be the number of labeled trees and partition the tree by the first node of the leftmost branch, then we have the recurrence

t_{n} = ∑_{k=0}^{n−1} \binom{n−1}{k}t_{k}t_{n−1−k}. (2)

We choose k numbers from {2, 3, 4, …, n} to form a subtree on top of node 1 and the rest to the right of node 1.

By the similarity of (1) and (2), it certainly is appropriate to study its exponential generating functions instead of ordinary generating functions.

Remark 4. A tree is said to be a 1-2 tree, if every vertex has outdegree at most two. The counting of 1-2 trees is the Motzkin sequence, 1, 1, 2, 4, 9, 21, 51, . . .. The counting of labeled 1-2 trees is the sequence of zig-zag permutations, t_{0} = 1, 1, 2, 5, 16, 61, 272, …

The following are the list of labeled 1-2 trees for n = 3, 4

[figure: 0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 3; 2; 0; 1; 2; 3]

t_{3} = (1 + 1 + 2 + 1 ) = 5,

[figure: 0; 1; 2; 3; 4; 0; 1; 2; 3; 4; 0; 1; 2; 3; 4; 0; 1; 2; 4; 3; 0; 1; 2; 3; 4; 0; 1; 2; 3; 4; 0; 1; 3; 2; 4; 0; 1; 4; 2; 3; 0; 1; 2; 3; 4; 0; 1; 2; 4; 3; 0; 1; 3; 4; 2; 0; 1; 2; 3; 4; 0; 1; 2; 3; 4; 0; 1; 2; 4; 3; 0; 1; 3; 4; 2; 0; 1; 2; 3; 4]

t_{4} = (1 + 1 + 2 + 1 + 3 + 3 + 1 + 3 + 1 ) = 16.

Theorem 5. Let b_{i} be the number of labeled 1-2 trees and y = f(x) = ∑_{i=0} b_{i} \frac{x^{i+1}}{(i+1)!} be the exponential generating function. Then f(x) = y = tan \frac{2x+π}{4} − 1 = sec x + tan x − 1, the exponential generating function of the sequence of zig-zag permutations.

Proof. Partition the trees by the out degrees of the root. We have the recurrence relation b_{n} = b_{n−1} + ∑_{k=0}^{n−2} \binom{n−1}{k}b_{k}b_{n−1−k−1} = b_{n−1} + ∑_{k=0}^{n−2} \frac{(n−1)!}{k!(n−k−1)!}b_{k}b_{n−k−2} (3) Thus y = f(x) satisfies the differential equation \frac{dy}{dx} = 1 + y + \frac{y2}{2}. Note that the second part in (3) is the coefficient [\frac{x^{n−1}}{(n−1)!}](y \frac{dy}{dx}), since we need the coefficient

of [\frac{x^{n}}{n!} ], so ∫ y \frac{dy}{dx}dx = \frac{y^{2}}{2} .

Solving the above differential equation, yields f(x) = y = tan \frac{2x+π}{4} − 1 = sec x + tan x − 1.

Example 6. The counting of the complete binary tree is 1, 0, 1, 0, 2, 0, 5, 0, … and the counting of labeled complete binary tree is 1, 0, 1, 0, 4, 0, 34, 0, 496, …

Let b_{i} be the number of labeled complete binary trees and the exponential generating function

y = f(x) = ∑_{i=0} b_{i} \frac{x^{i+1}}{(i+1)!}, then

\frac{dy}{dx} = 1 + \frac{1}{2!}y^{2}.

Solve the differential equation

y = \sqrt{2} tan \frac{x}{\sqrt{2}} = x + \frac{1}{6}x^{3} + \frac{1}{30}x^{5} + \frac{17}{2520}x^{7} + \frac{31}{22680}x^{9} + O(x^{11}).

Example 7. The counting of the labeled complete ternary trees is the sequence b_{0} = 1, 0, 0, 1, 0, 0, 15, 0, 0, 855, … Its exponential generating function satisfies the differential equation

\frac{dy}{dx} = 1 + \frac{y^{3}}{3!} .

Solving the differential equation and express x in terms of y

x = \frac{1}{3}(\sqrt[3]{6} ln(y+\sqrt[3]{6})− \frac{\sqrt[3]{6}}{2} ln(y^{2}−\sqrt[3]{6}y+(\sqrt[3]{6})^{2})+ \sqrt{3}(\sqrt[3]{6})(arctan(\frac{2}{\sqrt{3} \sqrt[3]{6}}y−\frac{1}{\sqrt{3}}))+\frac{1}{6} \sqrt{3}\sqrt[3]{6}π) = y − \frac{1}{24}y^{4} + \frac{1}{252}y^{7} − \frac{1}{2160}y^{10} + \frac{1}{16848}y^{13} − \frac{1}{124416}y^{16} + O(y^{19}). Using the Lagrange Inversion Formula, we find y = x + \frac{1}{4!}x^{4} + \frac{15}{7!}x^{7} + \frac{855}{10!}x^{10} + \frac{121605}{13!}x^{13} + …

Example 8. We define a Bell tree to be a 1-2 tree with the right branch a single file. For labeled Bell trees, the counting is the Bell number sequence 1, 1, 2, 5, 15, 52, 203, …

The recurrence relation is a_{n} = ∑ \binom{n−1}{k}a_{k} ∗ (1) and its exponential generating function y = ∑ a_{n} \frac{1}{(n+1)!}x^{n+1} satisfies the differential equation

\frac{dy}{dx} = ye^{x}.

Solving the differential equation we have

y = exp(exp(x) − 1) = 1 + x + x^{2} + \frac{5}{6}x^{3} + \frac{5}{8}x^{4} + \frac{13}{30}x^{5} + \frac{203}{720}x^{6} + \frac{877}{5040}x^{7} + O (x^{8}) .

For n = 4, there are 16 labeled 1-2 trees. The only labeled 1-2 tree that is not counted as Bell trees is the last one in Remark 4.

Example 9. Trees of height at most two. The recurrence relation is the same as in the previous example.

Example 10. Trees of height at most three. The recurrence relation is b_{n} = ∑ \binom{n−1}{k} a_{k} ∗ b_{n−1−k}, where a_{k} is the counting of trees of height at most two. y′ = yf, where f is EGF of {a_{n}} as in the previous example. ln y = ∫ f = ∫ exp(exp(x) − 1), y = exp(∫ (exp(exp(x) − 1))dx) = 1 + x + x^{2} + x^{3} + \frac{23}{24}x^{4} + \frac{53}{60}x^{5} + O(x^{6}).

4 Weighted Labeled 1-2 Trees

There is a bijection between labeled 1-2 trees and Motzkin paths. Here we use the idea in weighted Motzkin paths by assigning weights to the edges. For a node of out degree 1 we assign weight b for that single edge and for a node of out degree 2 we assign weight 1 for the left edge and weight c for the right edge. The weight of a weighted labeled tree is the product of the weights of all edges. Let W T_{n}(b, c) be the set of all labeled and weighted increasing trees of order n with weights b, c and w_{n} be the total weight of all trees in W T_{n}(b, c), then we have the following.

[figure: 0; 1; 2; 3; b; b; b; 0; 1; 2; 3; b; 1; c; 0; 1; 2; 3; 1; c; b; 0; 1; 3; 2; 1; c; b; 0; 1; 2; 3; 1; c; b]

w_{3} = 1(b^{3}) + 1(bc) + 2(bc) + 1(bc) = b^{3} + 4bc.

[figure: 0; 1; 2; 3; 4; b; b; b; b; 0; 1; 2; 3; 4; b; b; 1; c; 0; 1; 2; 3; 4; b; 1; c; b; 0; 1; 2; 4; 3; b; 1; c; b; 0; 1; 2; 3; 4; b; 1; c; b; 0; 1; 2; 3; 4; 1; c; b; b; 0; 1; 3; 2; 4; 1; c; b; b; 0; 1; 4; 2; 3; 1; c; b; b; 0; 1; 2; 3; 4; 1; c; b; b; 0; 1; 2; 4; 3; 1; c; b; b; 0; 1; 3; 4; 2; 1; c; b; b; 0; 1; 2; 3; 4; 1; c; b; b; 0; 1; 2; 3; 4; 1; c; 1; c; 0; 1; 2; 4; 3; 1; c; 1; c; 0; 1; 3; 4; 2; 1; c; 1; c; 0; 1; 2; 3; 4; 1; c; 1; c]

w_{4} = 1(b^{4}) + 1(b^{2}c) + 2(b^{2}c) + 1(b^{2}c) + 3(b^{2}c) + 3(b^{2}c) + 1(b^{2}c) + 3(c^{2}) + 1(c^{2}) = b^{4} + 11(b^{2}c) + 4c^{2}.

Theorem 11. Let y = f(x) = ∑ \frac{w_{n}}{(n+1)!}x^{n+1} be the exponential generating function of \{w_{n}\}. Then it satisfies the following differential equation y′ = \frac{dy}{dx} = 1 + by + \frac{c}{2!}y^{2} = \frac{c}{2}(y^{2} + \frac{2b}{c}y + \frac{2}{c}) = \frac{c}{2}((y + \frac{b}{c})^{2} + \frac{2c−b^{2}}{c^{2}} ). The solution is as follows:

Case 1. 2c − b^{2} = 0. y = \frac{−b}{c} − \frac{2b}{c(bx−2)} = \frac{−bbx+2b−2b}{c(bx−2)} = \frac{b^{2}x}{c(2−bx)},

Case 2. 2c − b^{2} > 0. y = \frac{−b}{c} + \frac{\sqrt{2c−b^{2}}}{c} tan(\frac{\sqrt{2c−b^{2}}x}{2} + arctan \frac{b}{\sqrt{2c−b^{2}}} ),

Case 3. 2c − b^{2} < 0. y = \frac{(exp(x\sqrt{b^{2}−2c})−1)}{r_{2}−r_{1} exp(x\sqrt{b^{2}−2c})} , r_{2} = \frac{b+\sqrt{b^{2}−2c}}{2}, r_{1} = \frac{b−\sqrt{b^{2}−2c}}{2}.

Proof. By similar idea in Theorem 5 we can obtain the differential equation, then solve the separable differential equation.

Example 12. Labeled 1-2 trees with weights b = 3, c = 4, the sequence is 1, 1, 3, 13, 75, 541, …, (\underline{A000670}). The sequence counts the number of ways n competitors can rank in a competition, allowing for the possibility of ties.

y′ = 1 + 3y + \frac{4}{2!}y^{2},

y = \frac{exp(x)−1}{2−exp(x)}.

Example 13. Labeled 1-2 trees with weights b=4, c=8, the sequence is 1, 4, 24, 192, … \underline{A002866}.

y′ = 1 + 4y + \frac{8}{2!}y^{2},

y = \frac{16x}{8(2−4x)} = \frac{x}{1−2x} = ∑ 2^{n}x^{n+1} = ∑ \frac{2^{n}(n+1)!}{(n+1)!}x^{n+1}.

Example 14. Labeled 1-2 trees with weights b = 1, c = 2 , the sequence is 1, 1, 3, 9, 39, 189, … (\underline{A080635}). It counts the number of permutations on n letters without double falls and without initial falls.

y′ = 1 + y + y^{2},

y = \frac{\sqrt{3}}{2} tan \frac{\sqrt{3}}{2}(x + \frac{π}{3\sqrt{3}}) − \frac{1}{2} = x + \frac{1}{2}x^{2} + \frac{1}{2}x^{3} + \frac{3}{8}x^{4} + \frac{13}{40}x^{5} + \frac{21}{80}x^{6} + O (x^{7}) .

Example 15. Labeled 1-2 trees with weights b = 5, c = 12, the sequence is 1, 5, 37, 365, …, (\underline{A050351}). It counts the number of 3-level labeled linear rooted trees with n leaves.

y′ = 1 + 5y + 6y^{2} .

y = \frac{exp(x)−1}{3−2 exp(x)} = x + \frac{5}{2}x^{2} + \frac{37}{6}x^{3} + \frac{365}{24}x^{4} + \frac{4501}{120}x^{5} + \frac{13321}{144}x^{6} + O (x^{7}) .

Example 16. Labeled 1-2 trees with weights b = 2, c = 4, the sequence is 1, 2, 8, 40, 256, … (\underline{A000828}).

y′ = 1 + 2y + \frac{4y^{2}}{2} ,

y = \frac{−2}{4} + \frac{2}{4}(tan(x + \frac{π}{4})) = x + x^{2} + \frac{4}{3}x^{3} + \frac{5}{3}x^{4} + \frac{32}{15}x^{5} + \frac{122}{45}x^{6} + O (x^{7}) .

References

[1] F. Bergeron, G. Labelle, P. Leroux, Combinatorial Species and Tree-like Structures, Cambridge University Press, 1998.

[2] L. Carlitz and R. Scoville, Some permutation problems, J. Combin. Theory Ser. A, (2) 22 (1977), 129-145.

[3] N. J. A. Sloane, The On-line Encyclopedia of Integer Sequences,

    http://www.research.att.com/~ njas/sequences.

[4] R. P. Stanley, Enumerative Combinatorics, Vol. 1, Cambridge University Press, 1997.

[5] R. P. Stanley, Enumerative Combinatorics, Vol. 2, Cambridge University Press, 1999.

[6] H. S. Wilf, Generatingfunctionology, Academic Press, 1994.

[7] J. Zeng, Enumération de permutations et J-fractions continues, European J. Combin., 14 (1993), 373–382.

2000 Mathematics Subject Classification: Primary 05A15. Keywords: labeled tree, Motzkin path, Catalan path, weighted labeled tree, exponential generating function.

(Concerned with sequences \underline{A000670}, \underline{A000828}, \underline{A002866}, \underline{A050351}, and \underline{A080635}.)

Received May 14 2007; revised version received August 7 2007. Published in Journal of Integer Sequences, August 13 2007.

Return to Journal of Integer Sequences home page.