Star#

Monochrome star \(\mathrm{St}_n\), one center and n - 1 leaves: the graph of largest variance (Theorem “Exact variance maximizer” of the exact stabilization-time paper).

A leaf is a peak iff its label exceeds the center’s, and the center is a peak iff its label is the largest: with the center of label rank r among n, \(S = n - r\) for r < n and \(S = 1\) for r = n.

tinto.theory.star.law(n)[source]#

Exact law of the number of peaks on the monochrome star with n nodes.

\(P(S = 1) = 2/n\) and \(P(S = s) = 1/n\) for \(2 \le s \le n - 1\), that is \(P(T = j) = 1/n\) for \(1 \le j \le n - 2\) and \(P(T = n - 1) = 2/n\).

Parameters:

n (int) – Number of nodes, n >= 2.

Returns:

\(P(S = s)\) for s = 0, ..., n.

Return type:

list of Fraction

Examples

>>> [str(x) for x in law(4)]
['0', '1/2', '1/4', '1/4', '0']
tinto.theory.star.mean(n)[source]#

Exact mean stabilization time on the monochrome star with n nodes.

\[\mathbb E\, T = \frac{(n-1)(n+2)}{2n}.\]
Parameters:

n (int) – Number of nodes, n >= 2.

Return type:

Fraction

Examples

>>> mean(4)
Fraction(9, 4)
tinto.theory.star.variance(n)[source]#

Exact variance of the stabilization time on the monochrome star with n nodes.

\[\mathrm{Var}\, T = \frac{(n-1)(2n^2 + 5n - 6)}{6n} - \frac{(n-1)^2 (n+2)^2}{4n^2} = \frac{n^2}{12} - \frac{13}{12} + o(1).\]
Parameters:

n (int) – Number of nodes, n >= 2.

Return type:

Fraction

Examples

>>> variance(4)
Fraction(11, 16)