3

I have a tree where, at each node, it splits into $b$ branches for a total number of $n$ levels.

I enumerate the paths from the root to the leaf nodes. For example, if $n = b = 2$ then I have the following paths from the root node to the leaf nodes:

{1,1}, {1,2}, {2,1}, {2,2}. (there are $n^b$ leaf nodes)

However, I'm only interested in paths that have unique sets, regardless of order. In the example I gave above, {1,2} and {2,1} are equivalent. I'm only interested in the elements.

For $n = 2, b = 3$, I have:

{1,1,1}, {1,1,2}, {1,2,1}, {1,2,2}, {2,1,1}, {2,1,2}, {2,2,1}, {2,2,2}

Where the bold sets represent the unique results.

Unless I've made a mistake in my enumeration, I've worked out the the first few examples by hand to try and get some insight into the problem:

$n$, $b$, unique results:
1, $k$, 1 (for arbitrary $k$)
2, 1, 2
2, 2, 3
2, 3, 4
3, 1, 3
3, 2, 6
3, 3, 10

How do I work out what the closed form is for the result I'm looking for given arbitrary $n$ and $b$?

  • There seem to be some inconsistencies in the usage of $n$ and $b$. At first, $n$ seems to be the number of levels not including the root, but in the table, it seems to be the number of levels including the root. You say there are $n^b$ leaf nodes, but this should be $b^n$. The "$n=2,b=3$" listing is actually $n=3,b=2$. In the table, rows 2 through 4 seem to be off by one. If you patch up these issues, I think the pattern will become clearer! – Chris Culter Aug 19 '13 at 01:02
  • Sorry! I just introduced the notation for the question. I'll fix it up. – progenitor27718 Aug 19 '13 at 01:08
  • So it looks like for a given leaf, you only care about the number of times you took each branch number. This observation might help you make sense of the given answers. – Evan Aug 19 '13 at 01:11

1 Answers1

3

You’re looking for the number of distinct multisets of cardinality $n$ whose elements all come from a set of cardinality $k$. This is sometimes written $\left(\!\!\left(k\atop n\right)\!\!\right)$ and is given by the formula

$$\left(\!\!\left(k\atop n\right)\!\!\right)=\binom{k+n-1}n=\binom{k+n-1}{k-1}\;.$$

The linked article has a reasonably clear derivation of the formula.

Brian M. Scott
  • 616,228