Uniform labeled tree#
Uniform labeled trees (Cayley trees).
- tinto.theory.cayley.adjacent_pair_degrees(n, a, c)[source]#
Law of the other degrees of two adjacent nodes of the uniform labeled tree.
Given that u and v are adjacent, with \(a = d_u - 1\) and \(c = d_v - 1\),
\[P(a, c) = \binom{n-3}{a+c-1}\binom{a+c}{a} \left(\frac2n\right)^{a+c-1} \left(1 - \frac2n\right)^{n-2-a-c} 2^{-(a+c)}.\]- Parameters:
- Return type:
Examples
>>> sum(adjacent_pair_degrees(5, a, c) for a in range(4) for c in range(4)) Fraction(1, 1)
- tinto.theory.cayley.distance_two_pair_degrees(n, a, c)[source]#
Law of the other degrees of two nodes at distance two in the uniform labeled tree.
Given that u and v have a common neighbor, with \(a = d_u - 1\) and \(c = d_v - 1\), summing over the degree D of the middle node without u and v,
\[P(a, c) = \sum_D \binom{n-4}{D-1} \left(\frac3n\right)^{D-1} \left(1 - \frac3n\right)^{n-3-D} \binom{D}{a}\binom{D-a}{c} 3^{-D}.\]- Parameters:
- Return type:
Examples
>>> sum(distance_two_pair_degrees(6, a, c) for a in range(5) for c in range(5)) Fraction(1, 1)
- tinto.theory.cayley.mean(n, k=1)[source]#
Mean stabilization time on the uniform labeled tree with n nodes, k colors.
The degree of a fixed node is
1 + Binomial(n - 2, 1/n); averagingrho()over it gives \(\mathbb E S / n\). Monochrome, \(\mathbb E T = n - n(1 - 1/n)^{n-1}\).Examples
>>> round(mean(200), 6) 126.239634
A single node never moves:
>>> mean(1) 0.0
- tinto.theory.cayley.pair_degrees(n, i, j)[source]#
Joint law of the degrees of two distinct nodes of the uniform labeled tree.
\[P(d_u = i, d_v = j) = \binom{n-2}{i-1}\binom{n-i-1}{j-1} n^{2-i-j} \left(1 - \frac2n\right)^{n-i-j}.\]- Parameters:
- Return type:
Examples
>>> sum(pair_degrees(5, i, j) for i in range(1, 5) for j in range(1, 5)) Fraction(1, 1)
- tinto.theory.cayley.pair_distances(n)[source]#
Probabilities that two distinct nodes of the uniform labeled tree are adjacent, or at distance two.
Examples
>>> pair_distances(5) (Fraction(2, 5), Fraction(9, 25))
- tinto.theory.cayley.pgf(n, k, v)[source]#
Probability generating function of the number of peaks on the uniform labeled tree, k >= 2 colors.
Percolating the monochrome edges and Lagrange inversion give
\[\mathbb E\, v^{S_n} = \frac{n!}{(k-1) k^{n-1} n^n} [z^n] \exp\big((k-1) n F(z, v)\big), \quad F = C\big(z e^{(v-1) z}\big) + (v-1) z,\]with C the Cayley tree function. The coefficient is computed by power series arithmetic in z, at a numeric v.
- Parameters:
- Return type:
Examples
>>> round(pgf(10, 3, 1.0), 12) 1.0
- tinto.theory.cayley.slope(k=1)[source]#
Asymptotic slope of the variance on the uniform labeled tree.
\[\lim_{n \to \infty} \frac{\mathrm{Var}\, T_n}{n} = e^{-1/k} - \left(1 + \frac{1}{k^2}\right) e^{-2/k}.\]Examples
>>> round(slope(), 6) 0.097209
- tinto.theory.cayley.variance(n, k=1)[source]#
Variance of the stabilization time on the uniform labeled tree with n nodes, k colors.
Monochrome, the closed form \(n(n-1)(1-2/n)^{n-1} + m - m^2\) with \(m = n(1-1/n)^{n-1}\). With
k >= 2colors, the double integrals over the labels of a pair of nodes, split by their distance (adjacent, at distance two, further) through the pair-degree laws of the Cayley tree. The kink ofmin(s, t)is integrated on the two triangles separately.- Parameters:
- Return type:
Examples
>>> round(variance(200), 6) 19.422343 >>> round(variance(200, 3), 6) 29.174695