% Generated from the Typst sources of the paper (web edition) by a private % script of the repository: do not edit, regenerate. ```{title} Research report ``` # The Exact Stabilization Time of Self-Stabilizing Coloring: Mean, Variance, and Distribution ```{raw} html
``` ## Abstract ```{raw} html
The worst-case stabilization time of a self-stabilizing algorithm usually says little about its typical behavior beyond the order of magnitude. This paper revisits the classical self-stabilizing (Δ+1)-coloring algorithm with vertices activated at random, one at a time (the random central daemon). Considering the number of color changes as a random variable, we study its mean, variance and, on several families of graphs, its exact distribution. The analysis rests on a reduction: a vertex changes color, at most once, exactly when it is not a local maximum of a uniformly random labeling of the vertices, maxima being taken among the neighbors that share its initial color (the monochrome initial configuration is the slowest case). What can be predicted depends on what is known of the graph. The degree distribution (the view at distance one) gives the mean. The variance needs the view at distance two, in particular the triangles, and the full law needs the whole graph. We give closed-form results, from monochrome and from uniformly random initial configurations, on paths, cycles, random trees, Erdős-Rényi graphs and bipartite random graphs. From a monochrome start, the mean stays within a factor two of the worst case, whereas the variance ranges from zero (disjoint cliques) to order 𝑛2 (the star on 𝑛 vertices).

Keywords: self-stabilization, graph coloring, stabilization time, random daemon, average-case analysis, random permutations, random graphs

Software
https://github.com/balouf/tinto/tree/v0.1.0, archived at swh:1:rev:79d72a3026ff486616ef0ba83b70e192de339cee
Acknowledgements
We thank Stephan Wagner for bibliographic references on random trees.
``` {#introduction} ## 1 Introduction ```{raw} html

A self-stabilizing algorithm reaches a legitimate configuration (for a given specification) from any initial one and remains legitimate afterwards [Alt+19, Dij74, Dol00]. At each step a daemon chooses which of the enabled processes move. The stabilization time is the number of moves to legitimacy, in the worst case over the initial configuration and the daemon’s choices.

We consider the classical self-stabilizing (Δ+1)-coloring rule on a graph 𝐺=(𝑉,𝐸) whose vertices are the processes, each holding a color from a palette of at least Δ+1 colors, Δ being the maximum degree [Alt+19, Dol00, GT00, HJS03]. A process whose color is shared by a neighbor is enabled and, when activated, recolors itself with any color absent from its neighborhood (such a color always exists). Under the central daemon of Dijkstra’s original paper [Dij74] (exactly one enabled process per step), the worst case is easy: a recolored process is never in conflict again, so every process moves at most once [HJS03]. For any 𝐺, the longest execution, over initial configurations and schedules, makes 𝑛−𝜅(𝐺) moves, where 𝑛≔|𝑉| and 𝜅(𝐺) is the number of connected components of 𝐺. In other words, the worst case sees nothing of 𝐺 beyond 𝜅(𝐺). We wonder what the graph determines once the daemon’s choices are random. Beyond the worst case, self-stabilization mostly studies the expected stabilization time of randomized algorithms, Herman’s token ring being the classic example [Her90]: the expectation is over their coins, under a synchronous or worst-case daemon. Here, in contrast, we analyze a deterministic algorithm under a random daemon.

To study typical behavior, we consider the random version of the central daemon that draws the next mover uniformly among the enabled processes. The stabilization time of a deterministic algorithm then becomes a random variable [DTY15, Yam+12]. Observe that the random central daemon is a scheduling abstraction, not a centralized algorithm: each process reads only its neighbors’ colors, and every step is one recoloring by a process in conflict. Counted in recolorings, the stabilization time has the same law when each process is activated by the ticks of its own rate-1 Poisson clock (Proposition 1). Our objective is the law of this random variable: its mean and variance on every graph and from every initial configuration, its full distribution on several families of graphs.

The key to our approach is as follows: draw a uniformly random ordering of the processes, and let the daemon always serve the enabled process that comes first in it. The execution has the same law as under the random central daemon, and the ordering alone decides which processes move. We call a process a peak when it comes after every neighbor that shares its initial color. A process recolors if and only if it is not a peak, so the stabilization time is exactly 𝑛 minus the number of peaks of a random ordering, whatever free color each move picks.

From a monochrome start (one common color), the peaks are the local maxima of a random labeling of the graph, an object probability and combinatorics know well: on a path they are the peaks of a random permutation [DB62, Eli16], on a general graph their number is a standard example for Stein’s method [BRS89], and its expectation is the Caro-Wei bound on the independence number [Car79, Wei81]. We recall the classical results where they are used (Section 3, Section 5). To our knowledge, the link between peaks and stabilization time is new, and all our contributions follow from it.

The mean alone says little: from a monochrome start, on a graph without isolated vertices, it lies between 𝑛/2 and 𝑛−1, always within a factor two of the worst case (Proposition 3). We therefore study the whole distribution, and the more we know of the graph, the finer the prediction. The mean needs only the degree distribution (Theorem 1). The variance needs only, for each pair of processes at distance at most two, the sizes of their common and private neighborhoods, in particular the triangles (Theorem 3, Eq. (6)). The law needs the whole graph. The approach is general: the same proofs cover every graph and every initial configuration, whether monochrome, uniformly random with any number 𝑘 of colors, or fixed, through the subgraph of initially conflicting edges (Proposition 2); the monochrome start is the slowest for every ordering of the processes.

On graphs of bounded degree, the stabilization time is concentrated within order 𝑛 of its mean, and is asymptotically normal as soon as its variance grows linearly (Corollary 2). For a monochrome start, the extremes are explicit (Section 4): the variance vanishes exactly on disjoint unions of cliques, never exceeds 𝑛(𝑛+2)/12, and is maximized by the star for every 𝑛. Finally, on five families of graphs, we push the analysis to the law itself whenever possible (Section 5). Besides paths and cycles, these include three random models: uniform random trees, Erdős-Rényi graphs 𝐺(𝑛,𝑝) and their bipartite version. Random graphs are a common testbed for simulations in self-stabilization, yet they are rarely analyzed, a recent exception being [GZ23].

Related work. Stabilization time of self-stabilizing coloring. Self-stabilizing vertex coloring was first studied for feasibility on particular graph classes [GK93, SS93], then on arbitrary graphs with explicit stabilization bounds. Gradinariu and Tixeuil [GT00] give deterministic (Δ+1)-coloring algorithms that stabilize in 𝑂(𝑛Δ) moves under an unfair daemon, and a randomized one that stabilizes in 𝑂((Δ−1)log𝑛) expected steps of the distributed daemon, a step possibly moving many processes, the expectation being over the algorithm’s coin flips, against the worst schedule. Hedetniemi, Jacobs and Srimani [HJS03] give two algorithms for the central daemon, one reaching a Grundy coloring in a number of moves linear in the number of edges, the other a (Δ+1)-coloring in at most 𝑛 moves. Bernard, Devismes, Paroux, Potop-Butucaru and Tixeuil [Ber+10] analyze a probabilistic coloring algorithm on anonymous networks with one-way links under the unfair distributed daemon. The algorithm’s expected stabilization time, again over its coins and from the worst initial configuration and schedule, goes from 𝑂(𝑛Δ) moves with Δ+1 colors down to 𝑂(𝑛) as the palette grows. Other work on the problem is worst-case too: unidirectional coloring [Ber+09], transformers from local or synchronous to self-stabilizing algorithms [Joh+24, LSW09], dynamic and locally iterative coloring [BEG22, FYZ25]. Two notions of expected stabilization time coexist. In the randomized algorithms above the expectation is over the algorithm’s coins, under a fixed or adversarial daemon [DIM95], whereas in our work the algorithm is deterministic and the expectation is over a random daemon, possibly also over a random initial configuration or a random graph, so that for a given algorithm it is at most the worst case.

Average-case analyses in self-stabilization. The most studied case is Herman’s randomized token circulation on rings [Her90], whose expected stabilization time under synchrony has been bounded with increasing precision [FMP04, FZ15, Kie+11, Nak05]. Fribourg, Messika and Picaronny [FMP04, FMP06] use coupling to bound two measures of randomized self-stabilizing algorithms: the expected stabilization time and the time after which stabilization has occurred with probability at least 1−𝜀. Both bounds are worst case over the initial configuration, with the probability taken over the algorithm’s coins. Modeling the algorithm as a Markov decision process whose policies are the daemon’s choices, Fribourg and Messika [FM05] extend these bounds to arbitrary daemons, and Beauquier, Johnen and Messika [BJM06] reduce the expected stabilization time against the best or the worst daemon to a stochastic shortest-path problem. Exhaustive, symbolic or synthesis-based methods compute such recovery measures on bounded instances [ABT15, Fag+18, FB15, FBT13, Vol+22]. Turau bounds the mean time to repair a single fault for randomized coloring under synchrony [Tur18]. Instead of solving a Markov chain or decision process, or exploring bounded instances, we reduce the stabilization time to the number of peaks of a random ordering. Speculative stabilization [DG13] designs algorithms to be fast under a more likely daemon while keeping the worst-case guarantee, whereas here the algorithm is fixed and we measure how long its typical executions take. Closer to ours in spirit, Burman et al. [Bur+21] analyze leader election in population protocols under the uniform random pairwise scheduler, which is a random daemon, and Giakkoupis and Ziccardi [GZ23] give graph-dependent bounds for a synchronous randomized maximal-independent-set process from arbitrary initial states: 𝑂(log𝑛) expected rounds on cliques and trees, polylogarithmic rounds with high probability on 𝐺(𝑛,𝑝).

Organization. Section 2 fixes the model. Section 3 gives the reduction and the mean and variance theorems, Section 4 the extremal results, Section 5 treats the five families, and Section 6 discusses the other daemons and what is left open. The body proves Lemma 1, Theorem 4, Theorem 5 and the short corollaries, and sketches the other proofs. The complete proofs, the variance formulas of the 𝑘-colored tree and of the two random-graph families, the Poisson Galton-Watson tree, the figures and the numerical checks are in the appendix, which keeps the section order of the body. The AI-disclosure section follows the references.

``` {#sec-model} ## 2 Model ```{raw} html

The rule and the terminology below are standard in self-stabilization [Alt+19, Dij74, Dol00], and self-stabilizing (Δ+1)-coloring under a central daemon goes back to [GT00, HJS03]. Up to its palette, the rule below is the second algorithm of [HJS03].

Network. The network is an undirected graph 𝐺=(𝑉,𝐸) with 𝑛=|𝑉| vertices. Two vertices 𝑢,𝑣 are neighbors if 𝑢𝑣∈𝐸. The neighborhood of 𝑢 is 𝒩︀(𝑢), its degree 𝑑𝑢=|𝒩︀(𝑢)|, and Δ=max𝑢𝑑𝑢 is the maximum degree. Each vertex hosts a process, and we identify the two.

State, guard, action. Each process holds a color drawn from a palette of size 𝑞. We consider the classical self-stabilizing coloring rule with the conflict (or clash) guard: a process is enabled iff it shares its color with at least one neighbor. When activated, an enabled process recolors itself with any color absent from its neighborhood. We take the palette large enough that a free color always exists, 𝑞≥Δ+1, so an enabled process always has a color to move to. A configuration is legitimate iff no process is enabled, that is, iff the coloring is proper.

Daemon. We use the central (sequential) daemon, under which exactly one enabled process executes its action at each step, in its random version: the process is drawn uniformly at random among the enabled ones. The stabilization time 𝑇 is the number of activations, which is also the number of steps, until the configuration is legitimate. We write 𝑇𝑛 when the dependence on 𝑛 matters. By Lemma 1 below, 𝑇 does not depend on which free color a process picks. The random central daemon is our model, but two scheduler-free settings give the same number of recolorings in law (Proposition 1): a daemon that draws at each step a process uniformly among all 𝑛, enabled or not, and a network in which every process wakes up at the ticks of its own Poisson clock of rate 1 and moves if it is enabled, reading its neighbors and writing its color in one atomic step (composite atomicity).

Rounds. Rounds carry no information here: the set of enabled processes only shrinks along an execution (Lemma 1), so every execution from a non-legitimate configuration takes exactly one round (a round ends once every process enabled at its start has moved or ceased to be enabled), under any central daemon.

Initial configuration and colors. The algorithm may start from any configuration. Two reference distributions give explicit averaged formulas: the monochrome configuration, where all processes start with the same color, and the random configuration, where each process starts with an independent uniform color among 𝑘 colors (not necessarily a proper coloring). Here 𝑘≤𝑞, and 𝑘=1 is the monochrome case. The palette size 𝑞≥Δ+1 guarantees a free color and nothing else, so 𝑇 depends on 𝑞 only through this inequality, while 𝑘 enters our formulas through the probability 1/𝑘 that a given edge is initially in conflict.1

Variants. The choice of guard matters, the choice of action does not. Under the Grundy-type guard, where a process is enabled as soon as its color is not the smallest one absent from its neighborhood, a process may move several times and our analysis does not apply. Under the other daemons the law of 𝑇 is not covered: the order of the moves is no longer uniform (locally central), or neighbors may move together (synchronous, distributed). Section 6 discusses these cases.

``` {#sec-general} ## 3 General theorems for the mean and the variance ```{raw} html

Throughout, the vertices carry an initial coloring (fixed, monochrome, or i.i.d. uniform among 𝑘 colors) and a uniform random labeling by distinct integers, which the next lemma links to the daemon. Equivalently, the labels are i.i.d. uniform on [0,1], since only their relative order matters, and the proofs use this version. A vertex 𝑣 is a peak if its label is larger than the label of every neighbor sharing its color (in the ordering of the introduction, a large label is a late turn). A vertex with no same-colored neighbor is a peak. The number of peaks is written 𝑆, 𝑆𝑛, 𝑆(𝜎) or 𝑆(𝐻) according to what is fixed (the size, the labeling, the graph).

``` {#the-reduction-lemma} ### 3.1 The reduction lemma ```{raw} html
Lemma 1 (Reduction).

Fix an initial coloring, a palette 𝑞≥Δ+1 and a free-color recoloring policy that depends only on the current configuration and on internal coins independent of the labeling. Let 𝜎 be a labeling of 𝑉 by distinct integers and consider the smallest-label schedule, which at each step activates the enabled vertex of smallest label.

  1. Each vertex is activated at most once, and a vertex that is not enabled never becomes enabled.
  2. A vertex is activated if and only if it is not a peak of the initial coloring under 𝜎. The schedule therefore performs 𝑛−𝑆(𝜎) moves, 𝑆(𝜎) being the number of peaks.
  3. If 𝜎 is a uniform random labeling, the smallest-label schedule has the law of the random central daemon, so that 𝑇𝑛=𝑛−𝑆𝑛 in law, 𝑆𝑛 being the number of peaks of a uniform random labeling.

Proof. (1) A move recolors its process with a color absent from the neighborhood, so it never creates a conflict: a process that has moved has no conflict and never regains one, and a process without conflict never acquires one. Writing 𝐴𝑡 for the set of processes activated before step 𝑡 and 𝐸𝑡 for the set of enabled ones, 𝐸𝑡 consists of the processes outside 𝐴𝑡 that have a same-colored neighbor outside 𝐴𝑡, and 𝐸𝑡+1⊆𝐸𝑡∖{𝑢𝑡}, where 𝑢𝑡 is the process activated at step 𝑡.

(2) If 𝑣 is a peak, every same-colored neighbor 𝑤 of 𝑣 has a smaller label and, as long as 𝑣 holds its initial color, is enabled until it acts. Under the smallest-label schedule 𝑤 acts before 𝑣 and recolors away from 𝑣’s color, so once all of them have acted 𝑣 has no conflict and is never activated. If 𝑣 is not a peak, it has a same-colored neighbor 𝑢 of larger label. The two stay in conflict until one of them acts, 𝑢 cannot act first, and the schedule stops after at most 𝑛 moves by (1), so 𝑣 acts.

(3) The history of the schedule before step 𝑡, that is, the activated processes and the colors they chose, determines 𝐸𝑡. Given the policy’s coins, independent of 𝜎, this history is the event that 𝜎(𝑢𝑠)<𝜎(𝑥) for all 𝑥∈𝐸𝑠∖{𝑢𝑠} and all 𝑠<𝑡. Since 𝐸𝑡⊆𝐸𝑠∖{𝑢𝑠} for every 𝑠<𝑡 by (1), permuting the labels of 𝐸𝑡 among themselves leaves this event unchanged. Conditionally on the history, the relative order of the labels of 𝐸𝑡 is therefore uniform, and the process of smallest label in 𝐸𝑡, the one the schedule activates, is uniform on 𝐸𝑡. This is one step of the random central daemon, and the two executions have the same law by induction on 𝑡. ∎

The policy entered the proof only through “picks a free color”, and the daemon only through the uniform order of first activations, which two scheduler-free models share.

Proposition 1 (Scheduler-free readings). The number of moves has the law 𝑛−𝑆𝑛 of Lemma 1 in each of the two following models. (1) At each step a process is drawn uniformly among all 𝑛 processes and moves if it is enabled, doing nothing otherwise. The number of steps until legitimacy is then the time needed to draw 𝐽 distinct processes, 𝐽 being the rank of the last non-peak in the order of first draws (𝐽=0 if the initial configuration is legitimate). Its mean given 𝐽 is 𝑛(𝐻𝑛−𝐻𝑛−𝐽), with 𝐻𝑚 the 𝑚-th harmonic number, and since 𝐽≤𝑛−1 the mean number of steps is at most 𝑛(𝐻𝑛−1), with equality on the monochrome clique. (2) Every process carries an independent Poisson clock of rate 1 and moves at each of its ticks at which it is enabled. The time until legitimacy is the first tick of the last non-peak, in the order of first ticks.

The proof (Appendix A) labels every process by the rank of its first draw or first tick, a uniform random permutation, and observes that a process moves at its first activation iff it is not a peak, and never again.

Proposition 2 (Fixed initial configuration).

Let 𝛾 be an initial configuration and 𝐺𝛾 its conflict graph, the spanning subgraph of 𝐺 whose edges join two vertices with the same color under 𝛾, and let 𝑆(𝐻) be the number of local maxima of a labeling on 𝐻, 𝛼(𝐻) its independence number and 𝜅(𝐻) its number of connected components.

  1. 𝑇(𝐺,𝛾)=𝑛−𝑆(𝐺𝛾) in law: every monochrome result of this paper applies to 𝛾 once 𝐺 is replaced by 𝐺𝛾, and in particular 𝔼𝑇(𝐺,𝛾)=∑𝑣𝑑𝑣(𝛾)/(𝑑𝑣(𝛾)+1) with 𝑑𝑣(𝛾) the number of neighbors of 𝑣 sharing its color (Theorem 1 below).
  2. 𝑆(𝐺𝛾)≥𝑆(𝐺) for every labeling, so under a common labeling the monochrome configuration stabilizes last: it has the largest ℙ(𝑇≥𝑡) for every 𝑡.
  3. Over all central and locally central daemons (the latter activate at each step a set of pairwise non-adjacent enabled processes), random or not, the number of moves from 𝛾 takes exactly the values 𝑛−𝛼(𝐺𝛾),…,𝑛−𝜅(𝐺𝛾). The worst case over configurations and schedules is 𝑛−𝜅(𝐺).

Parts (1) and (2) are Lemma 1 read on 𝐺𝛾 and the fact that a local maximum of 𝐺 is one of its spanning subgraph 𝐺𝛾. The comparison in (2) is in law, not in variance: on 𝐾2,3, recoloring one vertex of the smaller side raises the variance from 9/20 to 11/16. For (3), labeling the processes of any execution in activation order makes it a smallest-label schedule by Lemma 1(1). A step of a locally central daemon can be serialized without changing the moves, and the sets of local maxima of labelings are exactly the independent sets that meet every component (Appendix A).

With 𝑚 the number of initially conflicting processes, the worst case reads 𝑛−𝜅(𝐺𝛾)=𝑚−𝜅′(𝐺𝛾), 𝜅′ counting the components of 𝐺𝛾 that have an edge. The folklore bound of 𝑚−1 moves (in each conflict component at least one process never moves) is thus tight exactly when there is one such component. The best schedule needs 𝑛−𝛼(𝐺𝛾) moves (NP-hard to compute) and the worst 𝑛−𝜅(𝐺𝛾) (linear time). By part (1) the random daemon exceeds the best schedule on average by exactly 𝛼(𝐺𝛾)−∑𝑣1/(𝑑𝑣(𝛾)+1), the slack of the Caro-Wei bound.

The peaks of a monochrome labeling are also a known object elsewhere: the vertices selected in the first round of the random-priority algorithm for maximal independent set [ABI86, Lub86, Mét+11]. The same random order drives the greedy algorithms whose parallel depth is studied by [BFS12] and [FN20], where every vertex eventually acts and the depth is the quantity of interest, whereas here the quantity is the number of moves.

``` {#the-mean} ### 3.2 The mean ```{raw} html
Theorem 1 (Mean).

Let 𝐺 be a graph on 𝑛 vertices, possibly random, and let 𝑝𝑑 be the probability that a uniformly random vertex has degree 𝑑 (averaged over 𝐺 when 𝐺 is random). Give every vertex an independent uniform color among 𝑘. The expected number of peaks is

𝔼(𝑆𝑛)=𝑛𝑘∑𝑑𝑝𝑑𝑑+1(1−(1−1𝑘)𝑑+1),
(1)
and hence the mean stabilization time is 𝔼(𝑇𝑛)=𝑛−𝔼(𝑆𝑛). For 𝑘=1 this gives the monochrome case 𝔼(𝑇𝑛)=𝑛∑𝑑𝑑𝑑+1𝑝𝑑.

The proof (Appendix A) conditions on the degree 𝑑 of a uniform vertex and on its number 𝑚∼Binomial(𝑑,1/𝑘) of same-colored neighbors, which it beats with probability 1/(𝑚+1)=∫01𝑡𝑚d𝑡. The mean depends on the graph only through its degree distribution 𝒑. The factor 1𝑘 is the probability that a given edge is initially in conflict: for the mean, a 𝑘-coloring on 𝐺 behaves like the monochrome case on the random subgraph where each edge is kept with probability 1𝑘 (on a forest the kept edges are independent and the equality holds in law, see Section 5.2). We write 𝜌𝑘(𝑑)=𝑘∫1−1/𝑘1𝑢𝑑d𝑢=𝑘/(𝑑+1)(1−(1−1/𝑘)𝑑+1) for the peak probability of a degree-𝑑 vertex, so that 𝜌1(𝑑)=1/(𝑑+1).

``` {#the-variance} ### 3.3 The variance ```{raw} html

By Lemma 1, Var(𝑇𝑛)=Var(𝑆𝑛), and Var(𝑆𝑛)=𝔼(𝑆𝑛(𝑆𝑛−1))+𝔼(𝑆𝑛)−𝔼(𝑆𝑛)2, so the variance follows from the second factorial moment 𝔼(𝑆𝑛(𝑆𝑛−1))=∑𝑢≠𝑣ℙ(𝑢,𝑣both peaks). Whether two vertices are both peaks depends on how their neighborhoods overlap, so the variance, unlike the mean, sees more of the graph than degrees. For an ordered pair of distinct vertices (𝑢,𝑣), let 𝑎 be the number of neighbors of 𝑢 that are neither 𝑣 nor a neighbor of 𝑣, 𝑐 the symmetric count for 𝑣, and 𝑏 the number of common neighbors. In the monochrome case only non-adjacent pairs contribute, since two adjacent vertices of the same color are never both peaks.

Theorem 2 (Second factorial moment, monochrome).

In the monochrome case, the two vertices of an ordered non-adjacent pair with parameters (𝑎,𝑏,𝑐) are both peaks with probability

𝐽(𝑎,𝑏,𝑐)=1𝑎+𝑏+𝑐+2(1𝑎+𝑏+1+1𝑏+𝑐+1),
(2)

and those of an adjacent pair never are. With 𝑝𝑎,𝑏,𝑐 the probability that a random ordered pair is non-adjacent with parameters (𝑎,𝑏,𝑐),

𝔼(𝑆𝑛(𝑆𝑛−1))=𝑛(𝑛−1)∑𝑎,𝑏,𝑐𝑝𝑎,𝑏,𝑐𝑎+𝑏+𝑐+2(1𝑎+𝑏+1+1𝑏+𝑐+1).
(3)

The proof (Appendix A) conditions on the uniform labels 𝑠,𝑡 of 𝑢,𝑣: a private neighbor of 𝑢 ranks below 𝑢 with probability 𝑠, a common neighbor below both with probability min(𝑠,𝑡), and 𝐽(𝑎,𝑏,𝑐) is the integral of 𝑠𝑎𝑡𝑐min(𝑠,𝑡)𝑏 over the unit square. With 𝑘 colors the same computation applies to 𝑠=(𝑘−1+𝑥)/𝑘, the probability that a given neighbor of a vertex of label 𝑥 fails to beat it (wrong color, or same color and lower label). Then 𝑠 is uniform on [1−1/𝑘,1]. A common neighbor beats neither of two same-colored vertices with probability min(𝑠,𝑡), and neither of two differently colored ones with probability 𝑠+𝑡−1.

Theorem 3 (Second factorial moment).

With every vertex colored uniformly among 𝑘 colors, the two vertices of an ordered pair 𝑢,𝑣 with parameters (𝑎,𝑏,𝑐) are both peaks with probability 𝜋same(𝑎,𝑏,𝑐)+𝜋dist(𝑎,𝑏,𝑐) if non-adjacent and 𝜋dist(𝑎,𝑏,𝑐) if adjacent, where 𝜋same (resp. 𝜋dist) is the probability that 𝑢 and 𝑣 are both peaks and received the same color (resp. distinct colors):

𝜋same(𝑎,𝑏,𝑐)=𝑘∫1−1/𝑘1∫1−1/𝑘1𝑠𝑎𝑡𝑐min(𝑠,𝑡)𝑏d𝑠d𝑡,𝜋dist(𝑎,𝑏,𝑐)=(𝑘−1)𝑘∫1−1/𝑘1∫1−1/𝑘1𝑠𝑎𝑡𝑐(𝑠+𝑡−1)𝑏d𝑠d𝑡.
(4)

Then, with 𝑞𝑎,𝑏,𝑐 the probability that a random ordered pair is adjacent with parameters (𝑎,𝑏,𝑐),

𝔼(𝑆𝑛(𝑆𝑛−1))=𝑛(𝑛−1)∑𝑎,𝑏,𝑐[𝑝𝑎,𝑏,𝑐(𝜋same+𝜋dist)+𝑞𝑎,𝑏,𝑐𝜋dist].
(5)
At 𝑘=1 one has 𝜋dist=0 and 𝜋same=𝐽, recovering Theorem 2. Both integrals are elementary, and their values as finite sums are given in Appendix A, where the theorem is proved.
Corollary 1 (Pairs without common neighbor). At 𝑏=0 both integrands factorize, with 𝜌𝑘(𝑎)=𝑘∫1−1/𝑘1𝑠𝑎d𝑠 as in Theorem 1: 𝜋same(𝑎,0,𝑐)=𝜌𝑘(𝑎)𝜌𝑘(𝑐)/𝑘 and 𝜋dist(𝑎,0,𝑐)=(𝑘−1)𝜌𝑘(𝑎)𝜌𝑘(𝑐)/𝑘. Two non-adjacent vertices without common neighbor are thus independent peaks, for every 𝑘, and the covariance of two peak indicators vanishes beyond distance two. If 𝐺 is triangle-free, adjacent pairs have 𝑏=0 and contribute (𝑘−1)𝜌𝑘(𝑎)𝜌𝑘(𝑐)/𝑘 each.

The variance is therefore a sum over the pairs at distance at most two,

Var(𝑇)=∑𝑣𝜌𝑘(𝑑𝑣)(1−𝜌𝑘(𝑑𝑣))+∑𝑢≠𝑣,dist(𝑢,𝑣)≤2[ℙ(𝑢,𝑣both peaks)−𝜌𝑘(𝑑𝑢)𝜌𝑘(𝑑𝑣)],
(6)

and it sees the profile (𝑎,𝑏,𝑐) of these pairs, in particular the triangle count, and nothing else: the cycle 𝐶6 and two disjoint triangles, both 2-regular, have the same mean 4 and variances 12/45 and 0. The maximum degree nevertheless bounds the fluctuations.

Corollary 2 (Concentration and normal approximation).

Let 𝐺 have maximum degree Δ, with a fixed initial configuration or a uniform random 𝑘-coloring.

  1. For every 𝑡>0, ℙ(|𝑇−𝔼𝑇|≥𝑡)≤2exp(−2𝑡2/(𝑛(Δ+1)2)).
  2. The Kolmogorov distance (the supremum distance between distribution functions) between the law of (𝑇−𝔼𝑇)/Var(𝑇) and the standard normal law is at most 𝐶Δ4𝑛/Var(𝑇)3/2 for an absolute constant 𝐶. Along a sequence of graphs of bounded degree, 𝑇𝑛 is therefore asymptotically normal whenever Var(𝑇𝑛)/𝑛2/3→∞, in particular when Var(𝑇𝑛) is of order 𝑛.

The proof (Appendix A) is the bounded differences inequality [McD89], the rank and color of a vertex influencing at most Δ+1 peak indicators, and the normal approximation theorem for sums of variables with a dependency graph (a graph on the summands in which families with no edge between them are independent) [BR89, Rin94], indicators at distance at least 3 depending on disjoint sets of variables. The number of local maxima of a random labeling is a standard example of this method [BRS89, Gol05].

``` {#sec-extremal} ## 4 Extremal graphs ```{raw} html

Fix the number of vertices 𝑛. We work in the monochrome regime (𝑘=1), where a peak is a local maximum. By Proposition 2 the statements apply to any fixed configuration, once the graph is replaced by its conflict graph restricted to the initially conflicting processes and 𝑛 by their number. The statements about the mean extend to every 𝑘, while those about the variance are specific to 𝑘=1, a single edge having positive variance once 𝑘≥2. We use repeatedly that 𝔼(𝑆)=∑𝑣1/(𝑑𝑣+1) (Theorem 1, the Caro-Wei bound) and that the peaks form an independent set containing the vertex of largest label, so 1≤𝑆≤𝛼(𝐺). Throughout, 𝐺 is a fixed graph and the randomness is the labeling (randomized analogues in Appendix B).

``` {#extremes-of-the-mean} ### 4.1 Extremes of the mean ```{raw} html
Proposition 3 (Mean extremes). Among graphs on 𝑛 vertices with no isolated vertex, 𝔼(𝑇) is minimized by the perfect matching (for even 𝑛, the graph of 𝑛/2 disjoint edges, every vertex of degree 1), at 𝑛/2, and maximized by the clique 𝐾𝑛, at 𝑛−1. Hence 𝔼(𝑇)∈[𝑛/2,𝑛−1]. For odd 𝑛 the minimum is (3𝑛+1)/6, attained by a path on three vertices together with a perfect matching of the other vertices. The extremal graphs are the same for every 𝑘.

The proof (Appendix B) is the termwise bound 1/𝑛≤1/(𝑑𝑣+1)≤1/2, and the same for 𝜌𝑘, which is decreasing.

``` {#zero-variance} ### 4.2 Zero variance ```{raw} html
Theorem 4 (Zero variance). In the monochrome case, Var(𝑇)=0 if and only if 𝐺 is a disjoint union of cliques, in which case 𝑇=𝑛−𝜅(𝐺) deterministically, 𝜅(𝐺) being the number of connected components.
Proof. If 𝐺 is a disjoint union of cliques, every labeling of a clique has a unique local maximum, so 𝑆=𝜅(𝐺) under any labeling. Conversely, a graph that is not such a union contains an induced path 𝑎𝑏𝑐. Give 𝑎,𝑏,𝑐 the three largest labels and fix the others. Every other vertex has the same peak status in all such labelings, while ranking 𝑏 below both 𝑎 and 𝑐 gives two peaks among {𝑎,𝑏,𝑐} and ranking it above both gives one, so 𝑆 is not constant. ∎
``` {#maximal-variance-the-star} ### 4.3 Maximal variance: the star ```{raw} html

At the other end the variance can be of order 𝑛2. On the star the stabilization time is essentially the rank of the center’s label, so it does not concentrate at all. To avoid clashing with the peak count 𝑆, we write St𝑛 for the star on 𝑛 vertices (one center, 𝑛−1 leaves), that is, the complete bipartite graph 𝐾1,𝑛−1.

Proposition 4 (Star law and variance).

On the monochrome star St𝑛, ℙ(𝑇=𝑗)=1/𝑛 for 𝑗∈{1,…,𝑛−2} and ℙ(𝑇=𝑛−1)=2/𝑛. Hence

𝔼(𝑇)=(𝑛−1)𝑛+22𝑛,Var(𝑇)=(𝑛−1)2𝑛2+5𝑛−66𝑛−(𝑛−1)2(𝑛+2)24𝑛2=𝑛212−1312+𝑜(1).
(7)

A leaf is a peak iff its label exceeds the center’s, so 𝑇 is the label rank of the center, except that the rank 𝑛 also gives 𝑇=𝑛−1 (Appendix B). Since every leaf is compared with the same center, 𝑆 is almost uniform on {1,…,𝑛−1}. The matching upper bound for general graphs comes from a classification of the pairwise covariances, computed from Theorem 2 (proof in Appendix B).

Lemma 2 (Pairwise covariance).

Let 𝑢,𝑣 be distinct vertices with peak indicators 𝑋𝑢,𝑋𝑣. If 𝑢 and 𝑣 are adjacent, Cov(𝑋𝑢,𝑋𝑣)=−𝔼(𝑋𝑢)𝔼(𝑋𝑣)<0. If they are non-adjacent with parameters (𝑎,𝑏,𝑐), then

Cov(𝑋𝑢,𝑋𝑣)=𝑏(𝑎+𝑏+1)(𝑏+𝑐+1)(𝑎+𝑏+𝑐+2),
(8)
that is 𝑏𝔼(𝑋𝑢)𝔼(𝑋𝑣) divided by the number of vertices at distance at most one from 𝑢 or from 𝑣. Hence Cov(𝑋𝑢,𝑋𝑣)=0 when 𝑏=0; Cov(𝑋𝑢,𝑋𝑣)=1/(2(𝑐+2)(𝑐+3)) when (𝑎,𝑏)=(0,1), which is 1/12 at 𝑐=0 and at most 1/24 otherwise; Cov(𝑋𝑢,𝑋𝑣)≤1/24 when 𝑏=1 and (𝑎,𝑐)≠(0,0); and Cov(𝑋𝑢,𝑋𝑣)≤𝑏/((𝑏+1)2(𝑏+2))≤1/18 when 𝑏≥2. In particular Cov(𝑋𝑢,𝑋𝑣)≤1/12 always, with equality exactly when 𝑢 and 𝑣 are two leaves hanging from the same vertex.
Theorem 5 (Variance upper bound). For every graph on 𝑛 vertices, monochrome, Var(𝑇)≤𝑛(𝑛+2)/12. Hence the maximum variance over 𝑛-vertex graphs is 𝑛2/12(1+𝑜(1)), with sharp leading constant 1/12, attained to leading order by the star (Var(𝑇)=𝑛2/12−13/12+𝑜(1) on St𝑛 by Eq. (7)).
Proof. Write Var(𝑇)=Var(𝑆)=∑𝑣Var(𝑋𝑣)+∑𝑢≠𝑣Cov(𝑋𝑢,𝑋𝑣). Each Var(𝑋𝑣)=1𝑑𝑣+1(1−1𝑑𝑣+1)≤1/4, so the first sum is at most 𝑛/4. In the second, adjacent ordered pairs contribute negatively and, by Lemma 2, each of the at most 𝑛(𝑛−1) ordered pairs contributes at most 1/12, so the sum is at most 𝑛(𝑛−1)/12. Adding, Var(𝑇)≤𝑛/4+𝑛(𝑛−1)/12=𝑛(𝑛+2)/12. The star’s variance Eq. (7) has the same leading term 𝑛2/12, so the constant is sharp. ∎
Theorem 6 (Exact variance maximizer). For every 𝑛≥3, among all graphs on 𝑛 vertices, Var(𝑇) is maximized by the star St𝑛 and by no other graph.

The proof (Appendix B) sorts the vertices into leaves (degree one) and the others, bounds the variance through Lemma 2 in terms of the number of leaves and of the largest number of leaves at a single vertex, and compares the bound with the star: it falls short of the star’s variance for every 𝑛≥7 unless the graph is the star itself, and exhaustive enumeration settles 𝑛≤6. Isolated vertices are peaks of every labeling, so a graph that has some is compared with a smaller star.

``` {#sec-families} ## 5 Applications to graph families ```{raw} html

The mean of each family comes from Theorem 1 alone and the variance from Theorem 3 through the local formula Eq. (6), and only 𝐺(𝑛,𝑝) has triangles, that is, adjacent pairs with common neighbors. On paths, cycles and random trees the variance grows linearly in 𝑛 and, from a monochrome start, the law is asymptotically normal. In the two Erdős-Rényi models at fixed 𝑝, the expected number of peaks stays bounded and the peak count converges in law without normalization. The companion code checks the formulas below numerically (Appendix G).

``` {#path-and-cycle} ### 5.1 Path and cycle ```{raw} html

The cycle 𝐶𝑛 (𝑛≥3) is 2-regular, and the path 𝑃𝑛 (𝑛≥2) has two vertices of degree 1 and 𝑛−2 of degree 2. Both are triangle-free for 𝑛≥4. Monochrome, they are the classical settings of peaks in permutations [CS74, DB62], the simplest consecutive pattern [Eli16, EN12], and in cyclic permutations [Dom+22]. The monochrome means, variances and central limit theorems below are classical [FKL22, WS96], the 𝑘-colored statements are new.

Corollary 3 (Path and cycle, mean).

Under a uniform random 𝑘-coloring,

𝔼(𝑇𝐶𝑛)=𝑛(1𝑘−13𝑘2),𝔼(𝑇𝑃𝑛)=𝑛(1𝑘−13𝑘2)−(1𝑘−23𝑘2).
(9)
In the monochrome case (𝑘=1) these are 2𝑛/3 and (2𝑛−1)/3, and for three colors the path gives (8𝑛−7)/27.
Proof. By Theorem 1, with 𝜌𝑘(2)=1−1/𝑘+1/(3𝑘2) and 𝜌𝑘(1)=1−1/(2𝑘). ∎
Corollary 4 (Path and cycle, variance).

Under a uniform random 𝑘-coloring, with 𝑛≥5 for the cycle and 𝑛≥4 for the path,

Var(𝑇𝐶𝑛)=𝑛(1𝑘−2𝑘2+43𝑘3−1345𝑘4),Var(𝑇𝑃𝑛)=Var(𝑇𝐶𝑛)−(1𝑘−3𝑘2+83𝑘3−3245𝑘4).
(10)
In the monochrome case these are Var(𝑇𝐶𝑛)=2𝑛/45 and Var(𝑇𝑃𝑛)=(2𝑛+2)/45.

This follows from Eq. (6) by a census of the pairs at distance one and two (Appendix C). The two families share the leading coefficient and differ by a constant boundary term, exactly as for the mean.

Beyond the moments, the path and the cycle have explicit laws, read off generating functions as follows. We root each path at an endpoint, so that labeled monochrome paths correspond bijectively to permutations. For a family of labeled, possibly colored, graphs let ℱ︀(𝑧,𝑣)=∑𝑛(𝑧𝑛/𝑛!)∑𝐺of size𝑛𝑣peaks(𝐺), the labels 1,…,𝑛 of a labeled graph serving as 𝜎, and write [𝑧𝑛]ℱ︀ for the coefficient of 𝑧𝑛 in ℱ︀. Then 𝔼(𝑣𝑆𝑛)=[𝑧𝑛]ℱ︀(𝑧,𝑣)/[𝑧𝑛]ℱ︀(𝑧,1), which gives the law of 𝑆𝑛 and of 𝑇𝑛=𝑛−𝑆𝑛.

Theorem 7 (Path and cycle, full law).

The generating function of monochrome paths (permutations by peaks, a peak being a local maximum with endpoints included) is

𝑃(𝑧,𝑣)=𝑣tan(𝑧𝑣−1)𝑣−1−tan(𝑧𝑣−1),
(11)

the solution of the Riccati equation 𝜕𝑧𝑃=𝑣+2𝑃+𝑃2, 𝑃(0,𝑣)=0 [Ent69, Zhu16]. The generating functions of 𝑘-colored paths and of monochrome oriented cycles are

𝑘𝑃(𝑧,𝑣)1−(𝑘−1)𝑃(𝑧,𝑣)and𝑌(𝑧,𝑣)=𝑧+∫0𝑧𝑃(𝑦,𝑣)d𝑦=−log(cos(𝑧𝑣−1)−sin(𝑧𝑣−1)𝑣−1),
(12)

and that of 𝑘-colored oriented cycles is

𝑘𝑧+∫0𝑧(1+(𝑘−1)𝑣)𝑃same(𝑦,𝑣)d𝑦+∫0𝑧(2+(𝑘−2)𝑣)𝑃dist(𝑦,𝑣)d𝑦,
(13)
where 𝑃same and 𝑃dist, rational in 𝑃 and given in Appendix C, count 𝑘-colored paths whose two endpoints have the same, respectively distinct, colors.

Cycles are oriented, which does not change the peak count, and the series describe 𝐶𝑛 for 𝑛≥3. Up to the factor 𝑣 due to the endpoints, 𝑃 is the generating function of interior peaks (OEIS A008303). 𝑌 counts cyclic peaks [Eli16, Ent69]. Opening a cycle at its minimum is the idea of [ES21], whose theorem does not cover peaks. The 𝑘-colored series are derived in Appendix C.

Corollary 5 (Central limit theorem on the path and the cycle). On the path and on the cycle, for every 𝑘≥1, (𝑇𝑛−𝔼(𝑇𝑛))/Var(𝑇𝑛) converges in distribution to a standard normal law, with the mean and variance of Corollary 3 and Corollary 4.

This is Corollary 2 with Δ=2: the variance coefficient (45𝑘3−90𝑘2+60𝑘−13)/(45𝑘4) of Corollary 4 is positive for every 𝑘≥1 (it is 2/45 at 𝑘=1 and its numerator has derivative 15(3𝑘−2)2), and the Kolmogorov distance to the Gaussian is 𝑂(1/𝑛). For the monochrome path this is the theorem of Warren and Seneta [WS96].

``` {#sec-trees} ### 5.2 Random trees ```{raw} html

We take the uniform random rooted labeled tree on 𝑛 vertices (a Cayley tree, not to be confused with the infinite regular tree). There are 𝑛𝑛−1 such trees. A peak depends only on the labeling, not on the root, so the law of the peak count is the same for the 𝑛𝑛−2 unrooted labeled trees. Let 𝐶(𝑧)=∑𝑚≥1𝑚𝑚−1𝑧𝑚/𝑚!, with 𝐶=𝑧𝑒𝐶, be the Cayley tree function [Drm09, FS09]. Marking every peak by 𝑣, the generating function of monochrome trees by their peak count is

𝐹(𝑧,𝑣)=𝐶(𝑧𝑒(𝑣−1)𝑧)+(𝑣−1)𝑧.
(14)
Theorem 8 (Random tree, exact law).

Monochrome, the number of rooted labeled trees of size 𝑛 with exactly 𝑠 peaks is 𝑛!/𝑠!{𝑛−1𝑛−𝑠}, where {𝑎𝑏} is the Stirling number of the second kind, so

ℙ(𝑆𝑛=𝑠)=1𝑛𝑛−1𝑛!𝑠!{𝑛−1𝑛−𝑠}.
(15)

This is Theorem 5.2.1 of [Sei11], stated there for local minima. The law is the classical law of the number of leaves of a uniform rooted labeled tree [FS09, Rén59], and Eq. (14) is the leaf generating function, the solution of 𝐹=𝑧(𝑒𝐹+𝑣−1). See [Pan21] for the law of other small patterns in rooted trees.

Proposition 5 (Peaks and leaves). On a uniform random rooted labeled tree the number of peaks and the number of leaves (nodes with no children) have the same distribution.

This is Corollary 5.2.2 of [Sei11], which also gives a direct bijection. The moments follow, and the mean and the variance are explicit under a random coloring as well.

Corollary 6 (Random tree, mean and variance).

Monochrome, 𝔼(𝑆𝑛)=𝑛(1−1𝑛)𝑛−1 and 𝔼(𝑆𝑛(𝑆𝑛−1))=𝑛(𝑛−1)(1−2𝑛)𝑛−1, so

𝔼(𝑇𝑛)=𝑛−𝑛(1−1𝑛)𝑛−1=(1−1𝑒)𝑛−12𝑒+𝑜(1),Var(𝑇𝑛)=(𝑒−1−2𝑒−2)𝑛+𝑂(1)≈0.0972𝑛.
(16)

Under a uniform random 𝑘-coloring, since the degree of a fixed vertex of a uniform labeled tree is 1+Binomial(𝑛−2,1/𝑛),

𝔼(𝑇𝑛)=𝑛−𝑛𝑘∫1−1/𝑘1𝑡(𝑛−1+𝑡𝑛)𝑛−2d𝑡=(1−𝑒−1/𝑘)𝑛+𝑂(1),
(17)

and

Var(𝑇𝑛)=(𝑒−1/𝑘−(1+𝑘−2)𝑒−2/𝑘)𝑛+𝑂(1),
(18)
both reducing to Eq. (16) at 𝑘=1.

The monochrome moments are read off Eq. (14). The 𝑘-colored mean combines Theorem 1 with the degree law of a vertex of a Cayley tree, and the 𝑘-colored variance Theorem 3 with the joint degree law of two vertices at distance one or two. The exact value of this variance is a double integral (Proposition 10 in Appendix D).

Theorem 9 (Central limit theorem on the random tree). Monochrome, on the uniform random labeled tree (𝑇𝑛−𝔼(𝑇𝑛))/Var(𝑇𝑛) converges in distribution to a standard normal law as 𝑛→∞, with 𝔼(𝑇𝑛) and Var(𝑇𝑛) given by Corollary 6.

This is the classical central limit theorem for the number of leaves of a conditioned Galton-Watson tree [Drm09], imported through Proposition 5 as in [Sei11] (Corollary 5.2.3). Appendix D also treats the Poisson Galton-Watson tree, which gives the Cayley tree once conditioned on its size (Proposition 11).

The Cayley analysis extends to rooted labeled trees with an arbitrary offspring distribution, and the 𝑘-colored law to a functional equation (Proposition 12 in Appendix D), which Lagrange inversion solves in the Cayley case.

Theorem 10 (Random tree, exact law under a 𝑘-coloring).

Under a uniform random 𝑘-coloring of the uniform random rooted labeled tree on 𝑛 vertices, with 𝑘≥2 and 𝐹 the monochrome generating function Eq. (14),

𝔼(𝑣𝑆𝑛)=𝑛!(𝑘−1)𝑘𝑛−1𝑛𝑛[𝑧𝑛]𝑒(𝑘−1)𝑛𝐹(𝑧,𝑣).
(19)

Each non-root vertex has its parent’s color with probability 1/𝑘, independently of the others: the conflicting edges are a random subset of the tree edges, and the 𝑘-colored peak count is in law the monochrome peak count of this random forest. The trees containing a given spanning forest with component sizes 𝑐1,…,𝑐𝑚 number 𝑛𝑚−2𝑐1⋯𝑐𝑚 [Moo70, Pit99], and summing over the forests gives 𝑒(𝑘−1)𝑛𝐹 (Appendix D).

``` {#erdos-renyi-g-n-p} ### 5.3 Erdős-Rényi 𝐺(𝑛,𝑝) ```{raw} html

In 𝐺(𝑛,𝑝) [JŁR00] a uniform vertex has degree 𝑑∼Binomial(𝑛−1,𝑝). The peak count has an explicit generating function. List the vertices by decreasing label, let ℎ𝑗 be the number of vertices preceding the 𝑗-th one that share its color, and attribute each edge to its endpoint of smaller label: the 𝑗-th vertex is a peak iff none of its ℎ𝑗 edges to these vertices is present, and these edge sets are disjoint for distinct 𝑗, so that, given the colors, the 𝑗-th vertex is a peak independently of the others with probability (1−𝑝)ℎ𝑗. Marking peaks by 𝑣, 𝔼(𝑣𝑆𝑛)=𝔼∏𝑗=1𝑛(1+(𝑣−1)(1−𝑝)ℎ𝑗). Monochrome, ℎ𝑗=𝑗−1, so 𝑆𝑛 has probability generating function

𝐺𝑛,𝑝(𝑣)=∏𝑗=1𝑛(1+(𝑣−1)(1−𝑝)𝑗−1).
(20)

With 𝑘 colors, ℎ𝑗∼Binomial(𝑗−1,1/𝑘). Conditioning instead on the color composition (𝑛1,…,𝑛𝑘), which is multinomial, gives the product of the monochrome series of the color classes,

𝐺𝑛,𝑝,𝑘(𝑣)=1𝑘𝑛∑𝑛1+⋯+𝑛𝑘=𝑛(𝑛𝑛1,⋯,𝑛𝑘)∏𝑖=1𝑘𝐺𝑛𝑖,𝑝(𝑣).
(21)

These series, and all random-graph formulas below, describe the joint law over the graph, the coloring and the labeling (Appendix E).

Proposition 6 (Erdős-Rényi, mean).

Under a uniform random 𝑘-coloring and a palette 𝑞≥Δ+1,

𝔼(𝑆)=𝑘𝑝(1−(1−𝑝𝑘)𝑛),𝔼(𝑇)=𝑛−𝑘𝑝(1−(1−𝑝𝑘)𝑛).
(22)
Moreover the mean at (𝑛,𝑝,𝑘) equals the mean at (𝑛,𝑝/𝑘,1): for the mean, though not for the variance, a random 𝑘-coloring at edge probability 𝑝 behaves like the monochrome case at edge probability 𝑝/𝑘.

The mean is ∑𝑗𝔼[(1−𝑝)ℎ𝑗]=∑𝑗=1𝑛(1−𝑝/𝑘)𝑗−1. The variance is in Appendix E in two closed forms: a direct one, from the same reading of the series (Proposition 13), and one that averages Theorem 3 over the multinomial neighborhood profile of a random pair (Proposition 14), which the bipartite computation reuses. At fixed 𝑝 the expected number of peaks tends to 𝑘/𝑝 and the variance tends to a constant, instead of growing linearly in 𝑛.

Proposition 7 (Erdős-Rényi, limiting law).

Monochrome, 𝑆𝑛=∑𝑖=0𝑛−1𝐵𝑖 with 𝐵𝑖∼Bernoulli((1−𝑝)𝑖) independent, 𝐵𝑖 being the indicator that the vertex with exactly 𝑖 higher-labeled vertices is a peak. As 𝑛→∞:

  1. For fixed 𝑝∈(0,1), 𝑆𝑛 converges in distribution to the non-degenerate integer-valued law of 𝑆∞=∑𝑖≥0𝐵𝑖, with probability generating function 𝔼(𝑣𝑆∞)=∏𝑖≥0(1+(𝑣−1)(1−𝑝)𝑖) and mean 1/𝑝, so that the stabilization time is 𝑛 minus an 𝑂(1) random quantity that never becomes deterministic.
  2. For 𝑝=𝑝𝑛→0 with 𝑛𝑝𝑛→∞, (𝑆𝑛−𝔼(𝑆𝑛))/Var(𝑆𝑛) converges to a standard normal law, with 𝔼(𝑆𝑛)∼1/𝑝 and Var(𝑆𝑛)∼1/(2𝑝).

With 𝑘 initial colors, 𝑆∞ is replaced by the sum of 𝑘 independent copies of itself in the first regime, and in the second the normal limit persists, with 𝔼(𝑆𝑛)∼𝑘/𝑝 and Var(𝑆𝑛)∼𝑘/(2𝑝).

The proof (Appendix E) reads the factorization of Eq. (20) as a sum of independent indicators, applies Borel-Cantelli at fixed 𝑝 and the central limit theorem for 𝑝→0, and conditions on the color classes for 𝑘≥2.

``` {#bipartite-graphs} ### 5.4 Bipartite graphs ```{raw} html

For the bipartite Erdős-Rényi model 𝐺(𝑛1,𝑛2,𝑝), a uniform vertex lies in the first side (degree Binomial(𝑛2,𝑝)) with probability 𝑛1/𝑛 and in the second side (degree Binomial(𝑛1,𝑝)) with probability 𝑛2/𝑛, where 𝑛=𝑛1+𝑛2.

Proposition 8 (Bipartite Erdős-Rényi, mean).

Under a uniform random 𝑘-coloring and a palette 𝑞≥Δ+1,

𝔼(𝑇)=𝑛−𝑘𝑝(𝑛1𝑛2+1(1−(1−𝑝𝑘)𝑛2+1)+𝑛2𝑛1+1(1−(1−𝑝𝑘)𝑛1+1)).
(23)

The proofs are in Appendix F, with the variance, which follows from the same averaging over the multinomial neighborhood counts as for 𝐺(𝑛,𝑝), split according to the sides of the pair (Proposition 15). The peak count again has a product structure, now conditional on how the two sides and the colors interleave in the label order.

Proposition 9 (Bipartite Erdős-Rényi, generating function and limit law).

List the vertices by decreasing label and let ℎ𝑗 be the number of vertices preceding the 𝑗-th one that lie on the other side of the bipartition and share its color. Conditionally on the sequence of sides and colors, the 𝑗-th vertex is a peak independently of the others with probability (1−𝑝)ℎ𝑗, so 𝔼(𝑣𝑆𝑛)=𝔼∏𝑗=1𝑛(1+(𝑣−1)(1−𝑝)ℎ𝑗), the outer expectation being over the uniform interleaving of 𝑛1 and 𝑛2 sides and over the colors. If 𝑝 is fixed and 𝑛1/𝑛→𝜆∈(0,1), then, monochrome, 𝑆𝑛 converges in distribution to an almost surely finite random variable 𝑆∞′, with

𝔼(𝑆∞′)=𝜆(1−𝜆)𝑝+1−𝜆𝜆𝑝,
(24)
and with 𝑘 initial colors the limit is the sum of 𝑘 independent copies of 𝑆∞′.

In the regime 𝑝→0 the law should again be Gaussian, but the interleaving contributes to the variance at the same order as the conditional fluctuations, and we leave this regime open.

``` {#sec-conclusion} ## 6 Conclusion and future work ```{raw} html

Everything here follows from Lemma 1, which holds for every initial configuration and makes the monochrome one the slowest for every labeling. We leave open the central limit theorem for the 𝑘-colored tree, which the linear variance Eq. (18) and the 𝑛-th power in Eq. (19) suggest, and the regime 𝑝→0 of the bipartite model.

On the model side, the Grundy-type guard and the daemons beyond the central one change the dynamics. Under the locally central daemon the executions, once serialized, and the range of the number of moves are the same as under the central daemon (Proposition 2), but a random locally central daemon no longer induces a uniform order, and its mean number of moves is open. Under the synchronous daemon and an adversarial distributed daemon the deterministic rule does not stabilize in anonymous networks, which is why the algorithms of [GT00] and [Ber+10] use identifiers or coins. Since it converges whenever the moves are serialized, it is weak-stabilizing, and under a randomized distributed daemon it stabilizes with probability one [DTY15]. The law of its number of moves is then open. Finally, the reduction needs only that a process which has moved never moves again and never enables a neighbor. Under the Grundy-type guard a process may move several times, and what replaces the peak count for such rules is open.

``` {#bibliography} ## Bibliography ```{raw} html
``` {#ai-disclosure} ## AI disclosure ```{raw} html

We disclose that Claude (Anthropic) was used as an assistive tool during the preparation of this manuscript. Under the authors’ direction, it helped with editing and drafting parts of the text, with the companion verification code, and with checking and writing up some derivations. The authors reviewed and verified all AI-assisted output and take full responsibility for the content of this paper.

``` {#appendix} ## Appendix ```{raw} html

The appendix mirrors the structure of the paper. Appendices A and B restate the results whose proofs were deferred, keeping their numbers, and the other appendices refer to the body statements by number. All add the results that the body only mentions.

``` {#sec-app-general} ## A Proofs for Section 3 ```{raw} html
Proposition 1 (restated). Under a daemon drawing uniformly among all processes, with null activations, and under independent Poisson clocks, the number of moves has the law 𝑛−𝑆𝑛.
Proof of Proposition 1. Label every process by the rank of its first draw, or of its first tick. This gives a uniform random permutation. At the first activation of a process 𝑣, its same-colored neighbors of smaller label have been activated earlier, while 𝑣 still held its initial color, hence in conflict, and have moved away from that color, while those of larger label still hold it. So 𝑣 moves at its first activation iff it is not a peak, and never again by Lemma 1(1). The configuration becomes legitimate when the last non-peak is activated for the first time, since every initially conflicting edge has a non-peak endpoint and moves never create conflicts. In model (1) the gaps between successive first draws are independent of the order in which the processes first appear, so given that order the number of steps until the 𝐽-th distinct process is drawn has mean ∑𝑖=0𝐽−1𝑛/(𝑛−𝑖)=𝑛(𝐻𝑛−𝐻𝑛−𝐽). The last process drawn carries the largest label and is always a peak, so 𝐽≤𝑛−1, with 𝐽=𝑛−1 on the monochrome clique, where every other process is a non-peak. ∎
Proposition 2 (restated). For an initial configuration 𝛾 with conflict graph 𝐺𝛾: (1) 𝑇(𝐺,𝛾)=𝑛−𝑆(𝐺𝛾) in law, hence 𝔼𝑇(𝐺,𝛾)=∑𝑣𝑑𝑣(𝛾)/(𝑑𝑣(𝛾)+1); (2) 𝑆(𝐺𝛾)≥𝑆(𝐺) for every labeling; (3) over all central and locally central daemons the number of moves takes exactly the values 𝑛−𝛼(𝐺𝛾),…,𝑛−𝜅(𝐺𝛾).
Proof of Proposition 2. (1) Under 𝛾 two neighbors are in conflict exactly when they are adjacent in 𝐺𝛾, and a peak is a local maximum of 𝐺𝛾, so this is Lemma 1 with the definition unfolded, and the mean follows from ℙ(𝑣is a peak)=1/(𝑑𝑣(𝛾)+1). (2) A vertex whose label exceeds those of its neighbors in 𝐺 exceeds those of its neighbors in the subgraph 𝐺𝛾. (3) Every execution under a central daemon is the smallest-label schedule of some labeling: label the processes activated in the execution 1,…,𝑇 in activation order and the others arbitrarily above 𝑇. By Lemma 1(1) an activated process is never enabled again, so at step 𝑡 the enabled process of smallest label is the one labeled 𝑡, and the execution has 𝑛−𝑆(𝐺𝛾) moves for that labeling. A step of a locally central daemon activates pairwise non-adjacent processes and can be serialized in any order without changing the moves, so the same holds for these daemons. Conversely every labeling yields an execution. Local maxima form an independent set meeting every component (each component contains its largest label), so 𝜅(𝐺𝛾)≤𝑆(𝐺𝛾)≤𝛼(𝐺𝛾), and every independent set 𝐼 meeting every component is the set of local maxima of some labeling: give the largest labels to 𝐼 and let the other labels decrease with the distance to 𝐼. Removing vertices one at a time from a maximum independent set, inside the components where it has at least two, gives such sets of every size between 𝛼(𝐺𝛾) and 𝜅(𝐺𝛾). Finally 𝜅(𝐺𝛾)≥𝜅(𝐺), with equality for the monochrome configuration. ∎
Theorem 1 (restated). Under a uniform 𝑘-coloring the expected number of peaks is given by Eq. (1).

Proof of Theorem 1. By linearity, 𝔼(𝑆𝑛)=𝑛⋅ℙ(𝑣is a peak) for a uniformly random vertex 𝑣. Condition on the degree of 𝑣 being 𝑑. The 𝑑 neighbors of 𝑣 each share 𝑣’s color independently with probability 1𝑘, so the number 𝑚 of same-colored neighbors is Binomial(𝑑,1𝑘). Given 𝑚, the labels of 𝑣 and these 𝑚 neighbors are in uniform random relative order, so 𝑣 is the maximum with probability 1𝑚+1=∫01𝑡𝑚d𝑡. Hence

ℙ(𝑣is a peak|𝑑)=∫01𝔼[𝑡𝑚]d𝑡=∫01(𝑘−1+𝑡𝑘)𝑑d𝑡=𝑘∫1−1/𝑘1𝑢𝑑d𝑢=𝑘𝑑+1(1−(1−1𝑘)𝑑+1).
(25)
Averaging over 𝑑 with weights 𝑝𝑑 and multiplying by 𝑛 gives Eq. (1). ∎
Theorem 2 (restated).

In the monochrome case, the two vertices of an ordered non-adjacent pair with parameters (𝑎,𝑏,𝑐) are both peaks with probability

𝐽(𝑎,𝑏,𝑐)=1𝑎+𝑏+𝑐+2(1𝑎+𝑏+1+1𝑏+𝑐+1),

and those of an adjacent pair never are. With 𝑝𝑎,𝑏,𝑐 the probability that a random ordered pair is non-adjacent with parameters (𝑎,𝑏,𝑐),

𝔼(𝑆𝑛(𝑆𝑛−1))=𝑛(𝑛−1)∑𝑎,𝑏,𝑐𝑝𝑎,𝑏,𝑐𝑎+𝑏+𝑐+2(1𝑎+𝑏+1+1𝑏+𝑐+1).
Proof of Theorem 2. Assign i.i.d. uniform [0,1] ranks. Since the peak condition depends only on relative order, these have the same law as a uniform random labeling. Condition on the ranks 𝑠,𝑡 of 𝑢,𝑣: each of the 𝑎 private neighbors of 𝑢 must rank below 𝑠, each of the 𝑐 private neighbors of 𝑣 below 𝑡, and each of the 𝑏 common neighbors below min(𝑠,𝑡), so ℙ(𝑢,𝑣both peaks)=∫01∫01𝑠𝑎𝑡𝑐min(𝑠,𝑡)𝑏d𝑠d𝑡, and splitting on 𝑠≤𝑡 and 𝑠≥𝑡 evaluates this to 𝐽(𝑎,𝑏,𝑐). Summing over pairs with weights 𝑝𝑎,𝑏,𝑐 and using Lemma 1 gives Eq. (3). ∎
Theorem 3 (restated). The joint peak probabilities of a pair with parameters (𝑎,𝑏,𝑐) under a uniform 𝑘-coloring are the double integrals 𝜋same and 𝜋dist of Eq. (4), and the second factorial moment is given by Eq. (5).

Proof of Theorem 3. Realize the labeling by i.i.d. uniform ranks and condition on the ranks 𝑥,𝑦 and on the colors of 𝑢 and 𝑣. A neighbor of 𝑢 prevents 𝑢 from being a peak iff it has the color of 𝑢 and a rank above 𝑥, an event of probability (1−𝑥)/𝑘, independently across neighbors, so each private neighbor of 𝑢 leaves 𝑢 a peak with probability 𝑠=(𝑘−1+𝑥)/𝑘, and each private neighbor of 𝑣 leaves 𝑣 a peak with probability 𝑡=(𝑘−1+𝑦)/𝑘. A common neighbor leaves both 𝑢 and 𝑣 peaks with probability min(𝑠,𝑡) when 𝑢 and 𝑣 share a color (it needs another color, or a rank below both) and 𝑠+𝑡−1 when they do not (it must avoid two disjoint events of probabilities (1−𝑥)/𝑘 and (1−𝑦)/𝑘). Given the colors and the ranks, both are therefore peaks with probability 𝑠𝑎𝑡𝑐min(𝑠,𝑡)𝑏 in the first case and 𝑠𝑎𝑡𝑐(𝑠+𝑡−1)𝑏 in the second. As 𝑥,𝑦 are uniform on [0,1], the variables 𝑠,𝑡 are uniform on [1−1/𝑘,1] with density 𝑘 each, and the two cases have probabilities 1/𝑘 and (𝑘−1)/𝑘: this is Eq. (4). Two adjacent vertices of the same color are never both peaks, and adjacency does not enter the second case, so adjacent pairs contribute 𝜋dist only. Summing over ordered pairs with the weights 𝑝𝑎,𝑏,𝑐 and 𝑞𝑎,𝑏,𝑐 gives Eq. (5). In the original variables, with 𝑠=(𝑘−1+𝑥𝑦)/𝑘≤𝑡=(𝑘−1+𝑦)/𝑘 parametrizing the half of the square where 𝑠≤𝑡 (Jacobian 𝑦/𝑘2) and 𝑠=(𝑘−1+𝑥)/𝑘, 𝑡=(𝑘−1+𝑦)/𝑘 in 𝜋dist,

𝜋same(𝑎,𝑏,𝑐)=1𝑘∫01∫01𝑦[(𝑘−1+𝑥𝑦𝑘)𝑎+𝑏(𝑘−1+𝑦𝑘)𝑐+(𝑘−1+𝑥𝑦𝑘)𝑏+𝑐(𝑘−1+𝑦𝑘)𝑎]d𝑥d𝑦,𝜋dist(𝑎,𝑏,𝑐)=𝑘−1𝑘∫01∫01(𝑘−1+𝑥𝑘)𝑎(𝑘−1+𝑦𝑘)𝑐(𝑥+𝑦+𝑘−2𝑘)𝑏d𝑥d𝑦,
(26)
the forms used in the random-graph computations of Appendix E and Appendix F. ∎
Corollary 7 (Explicit finite sums).

For 𝑘≥2 the integrals of Eq. (26) evaluate to

𝜋same(𝑎,𝑏,𝑐)=1𝑘𝑎+𝑏+𝑐+1[∑𝑖=0𝑎+𝑏∑𝑗=0𝑐(𝑎+𝑏𝑖)(𝑐𝑗)(𝑘−1)𝑎+𝑏+𝑐−𝑖−𝑗(𝑖+1)(𝑖+𝑗+2)+(𝑎↔𝑐)],𝜋dist(𝑎,𝑏,𝑐)=(𝑘−1𝑘)𝑎+𝑐+1𝑘𝑏∑𝑗=0𝑏∑𝑖=0𝑗(𝑏𝑗)(𝑗𝑖)(𝑘−2)𝑏−𝑗𝐾𝑎(𝑖)𝐾𝑐(𝑗−𝑖),with𝐾𝑎(𝑖)=∑𝑚=0𝑎(𝑎𝑚)1(𝑘−1)𝑚(𝑖+𝑚+1),
(27)
where (𝑎↔𝑐) is the first double sum with 𝑎 and 𝑐 exchanged.
Proof. Expand the binomials in Eq. (26) and integrate term by term. (At 𝑘=2 the factor (𝑘−2)𝑏−𝑗 is read as 00=1 when 𝑗=𝑏.) ∎
Corollary 2 (restated). On a graph of maximum degree Δ, ℙ(|𝑇−𝔼𝑇|≥𝑡)≤2exp(−2𝑡2/(𝑛(Δ+1)2)), and the Kolmogorov distance between the standardized stabilization time and the normal law is at most 𝐶Δ4𝑛/Var(𝑇)3/2.
Proof of Corollary 2. Realize the labeling by i.i.d. uniform ranks 𝑈𝑣 and the colors by independent variables 𝐶𝑣, and group (𝑈𝑣,𝐶𝑣) into one variable per vertex. The peak count is a function of these 𝑛 independent variables, and changing one of them changes the peak status of 𝑣 and of its neighbors only, hence by at most Δ+1, so (1) is the bounded differences inequality [McD89]. For (2), the indicator that 𝑣 is a peak depends only on the variables of 𝑣 and its neighbors, so two families of indicators whose vertices are pairwise at distance at least 3 depend on disjoint sets of independent variables and are independent. The graph joining pairs at distance at most 2, of maximum degree at most Δ2, is thus a dependency graph for the indicators, and the normal approximation theorem for sums of bounded variables with a dependency graph [BR89, Rin94] bounds the Kolmogorov distance by a constant times 𝑛𝐷2/𝜎3+𝑛𝐷3/2/𝜎2+𝐷/𝜎 with 𝐷=Δ2+1 (one plus the maximum degree of the dependency graph) and 𝜎2=Var(𝑇). Since 𝜎2≤𝑛(Δ+1)2/2 by the Efron-Stein inequality applied to the same 𝑛 variables, and (Δ+1)2≤2𝐷, the first term dominates the other two, and 𝐷2≤4Δ4. The bound tends to 0 exactly when 𝜎2/𝑛2/3→∞. For a slower growth of the variance it says nothing, and we do not claim normality there. ∎

On the path the second factorial moment reproduces Var(𝑇𝑃𝑛)=(2𝑛+2)/45 for 𝑛≥4.

``` {#sec-app-extremal} ## B Proofs for Section 4 ```{raw} html

Randomized analogues of the extremal graphs. On a random graph the mean simply averages over the degree law (Theorem 1), and the extremal graphs of Section 4 have immediate randomized analogues: a uniform random perfect matching for the minimal mean, a uniform random partition of the vertices into a fixed number 𝜅 of cliques for zero variance (the stabilization time stays 𝑛−𝜅, so it is still deterministic even though the graph is genuinely random once 𝜅≥2), and a star with a uniformly random center for the maximal variance.

Proposition 3 (restated). Among graphs on 𝑛 vertices without isolated vertices, 𝔼(𝑇) ranges from 𝑛/2 (perfect matching, 𝑛 even) or (3𝑛+1)/6 (𝑛 odd) to 𝑛−1 (clique). The extremal graphs are the same for every 𝑘.
Proof of Proposition 3. From 𝔼(𝑇)=𝑛−∑𝑣1/(𝑑𝑣+1) and the strict decrease of 1/(𝑑+1) in 𝑑: every degree obeys 1≤𝑑𝑣≤𝑛−1, so 1/𝑛≤1/(𝑑𝑣+1)≤1/2, and summing gives 1≤∑𝑣1/(𝑑𝑣+1)≤𝑛/2. The right bound is met iff every 𝑑𝑣=1 (the perfect matching, 𝑛 even), whence 𝔼(𝑇)=𝑛/2, and the left bound iff every 𝑑𝑣=𝑛−1 (the clique 𝐾𝑛), whence 𝔼(𝑇)=𝑛−1. For odd 𝑛 at least one vertex has degree at least 2, since the number of odd-degree vertices is even, so ∑𝑣1/(𝑑𝑣+1)≤(𝑛−1)/2+1/3, with equality for a path on three vertices plus a perfect matching of the other vertices. For general 𝑘 the same termwise argument applies to 𝔼(𝑇)=𝑛−∑𝑣𝜌𝑘(𝑑𝑣), because 𝜌𝑘 is strictly decreasing: 𝜌𝑘(𝑑)−𝜌𝑘(𝑑+1)=𝑘∫1−1/𝑘1𝑢𝑑(1−𝑢)d𝑢>0. ∎
Theorem 4 (restated). Monochrome, Var(𝑇)=0 iff 𝐺 is a disjoint union of cliques.
Proof of Theorem 4. If 𝐺 is a disjoint union of cliques then, since every labeling of a clique has a unique local maximum, each clique contributes exactly one peak under any labeling, so 𝑆=𝜅(𝐺) and 𝑇=𝑛−𝜅(𝐺) are constant (isolated vertices are cliques of size 1, each its own component). Conversely, a graph is a disjoint union of cliques iff it contains no induced path on three vertices. So if 𝐺 is not such a union it has vertices 𝑎,𝑏,𝑐 with 𝑎𝑏,𝑏𝑐∈𝐸 and 𝑎𝑐∉𝐸. Fix any assignment of the 𝑛−3 smallest labels to 𝑉\{𝑎,𝑏,𝑐}, and give 𝑎,𝑏,𝑐 the three largest labels. The peak status of every vertex outside {𝑎,𝑏,𝑐} is then identical in all such labelings: such a vertex ranks below 𝑎,𝑏,𝑐, hence is a non-peak if adjacent to any of them and otherwise sees only the fixed outside labels. Among {𝑎,𝑏,𝑐}, 𝑎 is a peak iff 𝑎>𝑏 (its only possibly-larger neighbor), likewise 𝑐 iff 𝑐>𝑏, and 𝑏 iff it exceeds both 𝑎 and 𝑐. Ranking 𝑏 below both 𝑎 and 𝑐 gives 2 peaks, and ranking 𝑏 above both gives 1. The two labelings are equally likely and give peak counts differing by 1, so 𝑆 is non-constant and Var(𝑇)>0. ∎
Proposition 4 (restated). On the monochrome star, ℙ(𝑇=𝑗)=1/𝑛 for 𝑗∈{1,…,𝑛−2} and ℙ(𝑇=𝑛−1)=2/𝑛, with the mean and variance of Eq. (7).
Proof of Proposition 4. By Lemma 1, 𝑇=𝑛−𝑆. On the star a leaf is a peak iff its label exceeds the center’s (its only neighbor), and the center is a peak iff it holds the maximum label. Let 𝑐 be the label rank of the center. For 𝑐<𝑛 the 𝑛−𝑐 leaves above the center are the peaks, so 𝑇=𝑐. For 𝑐=𝑛 the center is the unique peak and 𝑇=𝑛−1. As 𝑐 is uniform on {1,…,𝑛}, the value 𝑛−1 arises from both 𝑐=𝑛−1 and 𝑐=𝑛, giving the stated law. The moments and their expansion are a direct computation. ∎
Lemma 2 (restated). For distinct vertices 𝑢,𝑣 with peak indicators 𝑋𝑢,𝑋𝑣, Cov(𝑋𝑢,𝑋𝑣)≤1/12, with the finer classification stated in the body.

Proof of Lemma 2. Adjacent vertices are never both peaks, so there Cov(𝑋𝑢,𝑋𝑣)=−𝔼[𝑋𝑢]𝔼[𝑋𝑣]<0. For non-adjacent 𝑢,𝑣 with parameters (𝑎,𝑏,𝑐) (𝑎=𝑑𝑢−𝑏, 𝑐=𝑑𝑣−𝑏), draw i.i.d. uniform [0,1] values (equivalent to a random labeling) and condition on the values 𝑠,𝑡 of 𝑢,𝑣: a private neighbor of 𝑢 must fall below 𝑠, one of 𝑣 below 𝑡, and a common neighbor below min(𝑠,𝑡), so

𝔼[𝑋𝑢𝑋𝑣]=∫01∫01𝑠𝑎𝑡𝑐min(𝑠,𝑡)𝑏d𝑠d𝑡=1𝑎+𝑏+𝑐+2(1𝑎+𝑏+1+1𝑏+𝑐+1),
(28)
the square being split along its diagonal: on 𝑡<𝑠 the inner integral is 𝑠𝑎+𝑏+𝑐+1/(𝑏+𝑐+1), on 𝑠<𝑡 it is 𝑡𝑎+𝑏+𝑐+1/(𝑎+𝑏+1). Subtracting 𝔼[𝑋𝑢]𝔼[𝑋𝑣]=1/((𝑎+𝑏+1)(𝑏+𝑐+1)) over the common denominator gives Eq. (8), the numerator being (𝑎+𝑏+1)+(𝑏+𝑐+1)−(𝑎+𝑏+𝑐+2)=𝑏. The rest is read off Eq. (8). The covariance vanishes with 𝑏. For 𝑏≥1 the three factors of the denominator are at least 𝑏+1, 𝑏+1 and 𝑏+2, with equality iff 𝑎=𝑐=0, whence the bound 𝑏/((𝑏+1)2(𝑏+2)), which is 1/12 at 𝑏=1, 1/18 at 𝑏=2 and decreases afterwards (there 𝑏(𝑏+2)(𝑏+3)>(𝑏+1)3). For 𝑏=1 and (𝑎,𝑐)≠(0,0) one of the first two factors is at least 3 and the third at least 4, whence 1/24. For (𝑎,𝑏)=(0,1) the denominator is 2(𝑐+2)(𝑐+3). Equality in Cov(𝑋𝑢,𝑋𝑣)≤1/12 thus requires 𝑏=1 and 𝑎=𝑐=0: two leaves with the same single neighbor. ∎
Theorem 6 (restated). For every 𝑛≥3, among all graphs on 𝑛 vertices, Var(𝑇) is maximized by the star St𝑛 and by no other graph.

Proof of Theorem 6. We first prove the statement among graphs without isolated vertices, for every 𝑛≥2. For 𝑛=2 the only such graph is the edge St2, and for 3≤𝑛≤6 the statement was checked by exhaustive enumeration of all labeled graphs without isolated vertices (Appendix G). Let 𝑛≥7 and let 𝐺 be a graph on 𝑛 vertices without isolated vertices, other than St𝑛. Call a vertex of degree 1 a leaf and its unique neighbor its hub. Write ℓ𝑤 for the number of leaves at 𝑤, 𝐿=∑𝑤ℓ𝑤 for the number of leaves, 𝑥=𝑛−𝐿 for the number of vertices of degree at least 2, and ℓ∗=max𝑤ℓ𝑤≤𝐿. The star is the graph with ℓ∗=𝑛−1. If 𝑥=0 then 𝐺 is a perfect matching and Var(𝑇)=0 by Theorem 4, so let 𝑥≥1. We bound Var(𝑇)=∑𝑣Var(𝑋𝑣)+∑𝑢≠𝑣Cov(𝑋𝑢,𝑋𝑣) class by class with Lemma 2, writing 𝑝𝑣=1/(𝑑𝑣+1) for 𝔼(𝑋𝑣).

Diagonal. Var(𝑋𝑣)=𝑝𝑣(1−𝑝𝑣) is 1/4 for a leaf and at most 2/9 for a vertex of degree at least 2: at most 𝐿/4+2𝑥/9 in all.

Two leaves. Two leaves at the same hub have parameters (0,1,0) and covariance 1/12. Two leaves at distinct hubs have no common neighbor and covariance 0, unless they form an isolated edge, with negative covariance. The ordered pairs of leaves at a common hub number ∑𝑤ℓ𝑤(ℓ𝑤−1)≤𝐿(ℓ∗−1).

A leaf and a vertex of degree at least 2. Let 𝑢 be a leaf at 𝑤 and 𝑣≠𝑤 a vertex of degree at least 2. The pair is non-adjacent, and has a common neighbor iff 𝑣 is adjacent to 𝑤. Its parameters are then (0,1,𝑑𝑣−1) and its covariance 1/(2(𝑑𝑣+1)(𝑑𝑣+2))≤1/24. Every neighbor of 𝑤 that is not a leaf at 𝑤 has degree at least 2, so these unordered pairs number ∑𝑤ℓ𝑤(𝑑𝑤−ℓ𝑤)≤𝐿(𝑥−1) (a hub of degree at least 2 is one of the 𝑥 vertices and has at most 𝑥−1 such neighbors, and a hub of degree 1 has none), and they contribute at most 𝐿(𝑥−1)/12 to the sum over ordered pairs.

Two vertices of degree at least 2. If non-adjacent with a common neighbor, their covariance is at most 1/18 by Lemma 2 (they are not two leaves at the same hub). The ordered non-adjacent pairs among these 𝑥 vertices number 𝑥(𝑥−1)−2𝑒′, where 𝑒′ counts the edges between them. A vertex of degree at least 2 carrying no leaf has at least two such edges and at most 𝐿 vertices carry a leaf, so 2𝑒′≥2(𝑥−𝐿)+.

Adjacent pairs have negative covariance, and we keep only the two ordered pairs formed by a leaf and its hub 𝑤, which contribute −2𝑝𝑢𝑝𝑤=−𝑝𝑤≤−1/𝑛 together when 𝑤 has degree at least 2. The two vertices of an isolated edge are each other’s hub, and the edge contributes −1/2≤−2/𝑛 for its two leaves once 𝑛≥4. In all, the kept pairs contribute at most −𝐿/𝑛.

Adding up,

Var(𝑇)≤𝐿4+2𝑥9+𝐿(ℓ∗−1)12+𝐿(𝑥−1)12+𝑥(𝑥−1)−2(𝑥−𝐿)+18−𝐿𝑛,
(29)

to be compared with VarSt𝑛(𝑇)=(𝑛−1)/4+(𝑛−1)(𝑛−2)/12−(𝑛−1)/𝑛+(𝑛−1)/𝑛2, the value of the same decomposition on the star (it is Eq. (7)).

Case 𝑥=1. Then 𝐿=𝑛−1 and ℓ∗≤𝑛−2 since 𝐺 is not the star, and Eq. (29) gives Var(𝑇)≤VarSt𝑛(𝑇)+2/9−(𝑛−1)/𝑛2−(𝑛−1)/12<VarSt𝑛(𝑇).

Case 𝑥≥2. The right-hand side of Eq. (29) increases with ℓ∗, so ℓ∗ may be replaced by 𝐿=𝑛−𝑥, after which VarSt𝑛(𝑇) minus the right-hand side equals

𝐷(𝑥)=𝑥−14−2𝑥9+(𝑥−1)(𝑛−2)12−𝑥(𝑥−1)−2(2𝑥−𝑛)+18−𝑥−1𝑛+𝑛−1𝑛2.
(30)

As a function of a real variable, 𝐷 is concave on [2,𝑛/2] and on [𝑛/2,𝑛] (its only non-linear terms are −𝑥(𝑥−1)/18 and (2𝑥−𝑛)+/9, and the second is convex, which is why the interval is split), so on each interval it is at least the smaller of its values at the endpoints:

𝐷(2)=3𝑛−1736−1𝑛2,𝐷(𝑛/2)=(𝑛−2)(𝑛−3)36+𝑛−1872−𝑛−22𝑛+𝑛−1𝑛2,𝐷(𝑛)=(𝑛−3)(𝑛+1)36−(𝑛−1)2𝑛2.
(31)

At 𝑛=7 these are 4/36−1/49, 0.168… and 32/36−36/49, all positive. For 𝑛≥8, 𝐷(2) increases with 𝑛 from 7/36−1/64, 𝐷(𝑛/2)≥(𝑛−2)(𝑛−3)/36+(𝑛−18)/72−1/2≥30/36−10/72−1/2 and 𝐷(𝑛)≥(𝑛−3)(𝑛+1)/36−1≥1/4. Hence 𝐷(𝑥)>0 for every integer 𝑥∈{2,…,𝑛}, that is Var(𝑇)<VarSt𝑛(𝑇).

Isolated vertices. Let 𝑛≥3 and let 𝐺 have 𝑖≥1 isolated vertices. They are peaks of every labeling, so Var(𝑇) equals the variance on the graph 𝐺′ obtained by deleting them, which has no isolated vertex: either 𝐺′ is empty and Var(𝑇)=0, or 𝐺′ has 𝑛−𝑖≥2 vertices and Var(𝑇)≤VarSt𝑛−𝑖(𝑇) by the above. By Eq. (7), VarSt𝑛(𝑇)=(𝑛2−1)/12−(𝑛−2)/𝑛−1/𝑛2, which increases strictly with 𝑛≥2 (its increments are (2𝑛+1)/12−2/(𝑛(𝑛+1))+1/𝑛2−1/(𝑛+1)2>0), so Var(𝑇)<VarSt𝑛(𝑇) in both cases. ∎

The companion code checks this result on various families of graphs, including all graphs on 𝑛≤7 vertices.

``` {#sec-app-path-cycle} ## C Path and cycle: proofs and derivations ```{raw} html

Degree-driven means. The path and cycle are two cases of a general pattern: by Theorem 1 the mean depends on the graph through its degrees alone, so it is a simple closed form the moment the degree sequence is known. For a graph on 𝑛 vertices with ℓ leaves and 𝑛−ℓ vertices of degree 𝑑, the monochrome mean is

𝔼(𝑇)=ℓ2+(𝑛−ℓ)𝑑𝑑+1,
(32)

and for general 𝑘 the two terms become ℓ(1−𝜌𝑘(1)) and (𝑛−ℓ)(1−𝜌𝑘(𝑑)). Taking ℓ=0 gives the 𝑑-regular graphs. The cycle is (ℓ,𝑑)=(0,2) and the path is (ℓ,𝑑)=(2,2), while the 𝑑-regular trees have ℓ>0 (though ℓ>0 does not force a tree). The variance is not degree-driven this way: it depends on the joint degrees of neighboring vertices through Theorem 3, so no comparable closed form holds for it.

Proof of Corollary 4. By Eq. (6) only the pairs at distance one and two contribute. On the cycle with 𝑛≥5 every vertex is a peak with probability 𝜌=𝜌𝑘(2), its two neighbors form with it ordered pairs with parameters (1,0,1) and its two vertices at distance two pairs with parameters (1,1,1), so

Var(𝑇𝐶𝑛)=𝑛[𝜌(1−𝜌)+2(𝜋dist(1,0,1)−𝜌2)+2((𝜋same+𝜋dist)(1,1,1)−𝜌2)],
(33)
and evaluating the integrals of Eq. (4) at these parameters gives the stated coefficient. On the path with 𝑛≥4 the two endpoints are peaks with probability 𝜌𝑘(1), the four ordered adjacent pairs they belong to have parameters (0,0,1) or (1,0,0) and the four ordered pairs at distance two (0,1,1) or (1,1,0). The 2(𝑛−3) other adjacent pairs and 2(𝑛−4) other pairs at distance two are as on the cycle. The difference with the cycle is the stated boundary term. At 𝑘=1, 𝜌=1/3, 𝜋dist=0 and 𝜋same(1,1,1)=2/15, so Var(𝑇𝐶𝑛)/𝑛=2/9−2/9+2(2/15−1/9)=2/45. The monochrome moments of the path are classical [Hiv+07, WS96]. ∎

Proof of Theorem 7. Monochrome path. Removing the smallest value of a permutation of size at least 2 splits it either at an end (leaving one permutation) or in the interior (leaving two independent ones). The removed element is never a peak, and its neighbors beat it, so their peak status is unchanged once they become endpoints of the pieces, while the permutation of size 1 is a peak. This gives the Riccati equation 𝜕𝑧𝑃=𝑣+2𝑃+𝑃2 with 𝑃(0,𝑣)=0, whose solution is Eq. (11) [Ent69, Zhu16]. The probability generating function of 𝑇𝑛 follows by marking non-peaks, 𝔼(𝑢𝑇𝑛)=𝑢𝑛[𝑧𝑛]𝑃(𝑧,1/𝑢). Coefficient extraction gives 𝔼(𝑇𝑛)=(2𝑛−1)/3 and, for 𝑛≥4, Var(𝑇𝑛)=(2𝑛+2)/45, in agreement with Corollary 3 and Corollary 4.

𝑘-colored path. Under a uniform 𝑘-coloring a vertex is a peak when it exceeds its same-color neighbors only, so the path breaks at every color change into maximal monochromatic runs whose peaks are independent. Each run is a monochrome path, counted by 𝑃(𝑧,𝑣), and consecutive runs carry distinct colors. Summing over the number of runs gives 𝑘𝑃/(1−(𝑘−1)𝑃), whose value at 𝑣=1 is 𝑘𝑧/(1−𝑘𝑧), i.e. [𝑧𝑛/𝑛!]=𝑛!𝑘𝑛, the number of labeled 𝑘-colored paths.

Monochrome oriented cycle. The cycle of length 1 is a loop and its vertex is not a peak, by convention. In an oriented cycle of size at least 2, removing the minimum-labeled vertex, which is never a peak, produces an oriented path whose endpoints keep their peak status, hence 𝑌(𝑧,𝑣)=𝑧+∫0𝑧𝑃(𝑦,𝑣)d𝑦, which integrates to the closed form of Eq. (12). In particular the peak count of 𝐶𝑛+1 has the law of that of 𝑃𝑛, which transfers the monochrome moments and the central limit theorem of the path to the cycle. The mean 𝑛/3 and variance 2𝑛/45 (for 𝑛≥5) of the series are those of 𝑆𝑛=𝑛−𝑇𝑛 in Corollary 3 and Corollary 4.

𝑘-colored oriented cycle. Let 𝑃same(𝑧,𝑣) (resp. 𝑃dist(𝑧,𝑣)) count 𝑘-colored paths whose first and last vertices have the same (resp. distinct) colors. Any path is in one of the two cases, and a path with same-color ends is either monochrome, or decomposes uniquely as a path with distinct-color ends followed by a monochrome path of the color of its starting point, so

𝑃same+𝑃dist=𝑘𝑃1−(𝑘−1)𝑃,𝑃same=𝑘𝑃+𝑃dist𝑃,
(34)

hence

𝑃same=(1−(𝑘−2)𝑃)𝑘𝑃(1+𝑃)(1−(𝑘−1)𝑃),𝑃dist=𝑘(𝑘−1)𝑃2(1+𝑃)(1−(𝑘−1)𝑃).
(35)

A 𝑘-colored oriented cycle of size 1 contributes 𝑘𝑧. Otherwise, removing the vertex of label 1 leaves a 𝑘-colored path whose ends keep their peak status, and the removed vertex is a peak in the cycle iff its color differs from the colors of both ends of this path: when the ends share a color, 𝑘−1 colors make it a peak and one does not, whereas when they differ, 𝑘−2 do and two do not. This is Eq. (13), which collapses to 𝑌 at 𝑘=1. The cycles of length 1 and 2, a loop and a double edge, are outside the simple-graph model. Their terms are the normalizations that make the differential equations hold, and the series describe 𝐶𝑛 for 𝑛≥3. ∎

The companion code checks all four series.

``` {#sec-app-trees} ## D Random trees: proofs and derivations ```{raw} html

The companion code checks the moments of Corollary 6.

The 𝑘-colored mean. By Theorem 1, 𝔼(𝑆𝑛)=𝑛𝔼[𝜌𝑘(𝐷)] with 𝐷 the degree of a uniform vertex and 𝜌𝑘(𝑑)=𝑘∫1−1/𝑘1𝑡𝑑d𝑡. The number of labeled trees on 𝑛 vertices in which a given vertex has degree 𝑑 is (𝑛−2𝑑−1)(𝑛−1)𝑛−1−𝑑, so 𝐷−1∼Binomial(𝑛−2,1/𝑛) and 𝔼[𝑡𝐷]=𝑡((𝑛−1+𝑡)/𝑛)𝑛−2, which is Eq. (17). Since ((𝑛−1+𝑡)/𝑛)𝑛−2=𝑒𝑡−1(1+𝑂(1/𝑛)) uniformly on [0,1] and 𝑘∫1−1/𝑘1𝑡𝑒𝑡−1d𝑡=𝑒−1/𝑘, the mean is (1−𝑒−1/𝑘)𝑛+𝑂(1). In closed form, with 𝑚=𝑛−2, 𝑎=(𝑛−1)/𝑛 and 𝑏=1/𝑛, the integral of Eq. (17) is

∫1−1/𝑘1𝑡(𝑎+𝑏𝑡)𝑚d𝑡=[𝑡(𝑎+𝑏𝑡)𝑚+1𝑏(𝑚+1)−(𝑎+𝑏𝑡)𝑚+2𝑏2(𝑚+1)(𝑚+2)]1−1/𝑘1,
(36)

so that 𝔼(𝑆𝑛)=𝑛𝑘 times this bracket. At 𝑘=1 the bracket equals (1−1/𝑛)𝑛−1 and the formula reduces to 𝔼(𝑆𝑛)=𝑛(1−1/𝑛)𝑛−1.

The 𝑘-colored variance. By Corollary 1 only the pairs at distance at most two contribute to the covariance, and in a tree the neighborhood profile of such a pair is read off the degrees of its two vertices: with the parameters (𝑎,𝑏,𝑐) of Section 3, 𝑏≤1, and (𝑎,𝑐)=(𝑑𝑢−1,𝑑𝑣−1) when 𝑢𝑣 is an edge or when 𝑢 and 𝑣 are at distance two (then 𝑏=1), (𝑎,𝑐)=(𝑑𝑢,𝑑𝑣) beyond.

Lemma 3 (Pairs of vertices in a Cayley tree).

In the uniform random labeled tree on 𝑛≥4 vertices, for two fixed distinct vertices 𝑢,𝑣 and all real 𝑠,𝑡:

  1. 𝔼[𝑠𝑑𝑢𝑡𝑑𝑣]=𝑠𝑡((𝑠+𝑡+𝑛−2)/𝑛)𝑛−2: the vector (𝑑𝑢−1,𝑑𝑣−1) is multinomial with 𝑛−2 trials and probabilities 1/𝑛,1/𝑛.
  2. 𝑢 and 𝑣 are adjacent with probability 2/𝑛, and then 𝔼[𝑠𝑎𝑡𝑐]=𝑠+𝑡2((𝑠+𝑡+𝑛−2)/𝑛)𝑛−3: (𝑎,𝑐) is the sum of a multinomial vector with 𝑛−3 trials and probabilities 1/𝑛,1/𝑛 and of a vector uniform on {(1,0),(0,1)}.
  3. 𝑢 and 𝑣 are at distance two with probability 3(𝑛−2)/𝑛2, and then 𝔼[𝑠𝑎𝑡𝑐]=𝑠+𝑡+13((𝑠+𝑡+𝑛−2)/𝑛)𝑛−4: (𝑎,𝑐) is the sum of a multinomial vector with 𝑛−4 trials and probabilities 1/𝑛,1/𝑛 and of a vector uniform on {(1,0),(0,1),(0,0)}.

Proof. Let 𝐶(𝑧) be the Cayley tree function of Section 5.2, with 𝐶(𝑧)=𝑧𝑒𝐶(𝑧), the exponential generating function of rooted labeled trees. A tree with an ordered pair of distinct distinguished vertices 𝑢,𝑣 is the path 𝑢=𝑥0,𝑥1,…,𝑥𝑘=𝑣 (𝑘≥1) together with a rooted tree hanging from each 𝑥𝑖. Mark by 𝑠 (resp. 𝑡) the children of the root of the tree hanging from 𝑢 (resp. 𝑣), that is, the 𝑑𝑢−1 (resp. 𝑑𝑣−1) neighbors of 𝑢 (resp. 𝑣) off the path. A rooted tree whose root has its children marked by 𝑠 has generating function 𝑧𝑒𝑠𝐶(𝑧). Summing over all 𝑘≥1, keeping 𝑘=1 only, or keeping 𝑘=2 only gives, for all pairs, adjacent pairs and pairs at distance two,

𝐴1(𝑧)=𝑧2𝑒(𝑠+𝑡)𝐶(𝑧)1−𝐶(𝑧),𝐴2(𝑧)=𝑧2𝑒(𝑠+𝑡)𝐶(𝑧),𝐴3(𝑧)=𝑧2𝐶(𝑧)𝑒(𝑠+𝑡)𝐶(𝑧),
(37)

and in the last two cases (𝑑𝑢−1,𝑑𝑣−1)=(𝑎,𝑐). Since 𝑧=𝐶(𝑧)𝑒−𝐶(𝑧), each 𝐴𝑖(𝑧) is 𝐻𝑖(𝐶(𝑧))/(1−𝐶(𝑧)) with 𝐻1(𝑢)=𝑢2𝑒(𝑠+𝑡−2)𝑢, 𝐻2(𝑢)=(1−𝑢)𝑢2𝑒(𝑠+𝑡−2)𝑢 and 𝐻3(𝑢)=(1−𝑢)𝑢3𝑒(𝑠+𝑡−2)𝑢. The Lagrange inversion formula [𝑧𝑛]𝐻(𝐶(𝑧))/(1−𝐶(𝑧))=[𝑢𝑛]𝐻(𝑢)𝑒𝑛𝑢 [FS09] then gives

𝑛![𝑧𝑛]𝐴1(𝑧)=𝑛(𝑛−1)(𝑠+𝑡+𝑛−2)𝑛−2,𝑛![𝑧𝑛]𝐴2(𝑧)=𝑛(𝑛−1)(𝑠+𝑡)(𝑠+𝑡+𝑛−2)𝑛−3,𝑛![𝑧𝑛]𝐴3(𝑧)=𝑛(𝑛−1)(𝑛−2)(𝑠+𝑡+1)(𝑠+𝑡+𝑛−2)𝑛−4.
(38)
All pairs play the same role, and there are 𝑛(𝑛−1)𝑛𝑛−2 trees with an ordered pair of distinct vertices. Dividing by this number gives 𝔼[𝑠𝑑𝑢−1𝑡𝑑𝑣−1], hence (1), and 𝔼[𝑠𝑎𝑡𝑐] restricted to adjacent pairs and to pairs at distance two. At 𝑠=𝑡=1 these give the probabilities 2/𝑛 and 3(𝑛−2)/𝑛2, and dividing by them gives the conditional expectations of (2) and (3). The descriptions as a multinomial vector plus a uniform vector are read off these products. ∎
Proposition 10 (Random tree, variance under a 𝑘-coloring).

Write ⟨𝑓⟩=𝑘2∫1−1/𝑘1∫1−1/𝑘1𝑓(𝑠,𝑡)d𝑠d𝑡 and 𝜑=(𝑠+𝑡+𝑛−2)/𝑛. Under a uniform random 𝑘-coloring of the uniform random labeled tree on 𝑛≥4 vertices,

𝔼(𝑆𝑛(𝑆𝑛−1))=𝑛(𝑛−1)⟨𝑠𝑡𝜑𝑛−2⟩+2(𝑛−1)⟨𝑠+𝑡2𝜑𝑛−3(𝑘−1𝑘−𝑠𝑡)⟩+3(𝑛−1)(𝑛−2)𝑛⟨𝑠+𝑡+13𝜑𝑛−4(min(𝑠,𝑡)𝑘+𝑘−1𝑘(𝑠+𝑡−1)−𝑠𝑡)⟩,
(39)
and Var(𝑇𝑛)=𝔼(𝑆𝑛(𝑆𝑛−1))+𝔼(𝑆𝑛)−𝔼(𝑆𝑛)2 with 𝔼(𝑆𝑛) given by Eq. (17). As 𝑛→∞, Var(𝑇𝑛)=𝜎𝑘2𝑛+𝑂(1) with 𝜎𝑘2=𝑒−1/𝑘−(1+𝑘−2)𝑒−2/𝑘, as stated in Eq. (18).

Proof. By Theorem 3, in the variables of Eq. (4), two vertices with parameters (𝑎,𝑏,𝑐) are both peaks with probability ⟨𝑠𝑎𝑡𝑐min(𝑠,𝑡)𝑏⟩/𝑘+(𝑘−1)⟨𝑠𝑎𝑡𝑐(𝑠+𝑡−1)𝑏⟩/𝑘 if non-adjacent and (𝑘−1)⟨𝑠𝑎𝑡𝑐(𝑠+𝑡−1)𝑏⟩/𝑘 if adjacent, while 𝜌𝑘(𝑎)𝜌𝑘(𝑐)=⟨𝑠𝑎𝑡𝑐⟩. Split the ordered pairs of distinct vertices into adjacent pairs (𝑏=0), pairs at distance two (𝑏=1) and the others, which are both peaks with probability 𝜌𝑘(𝑑𝑢)𝜌𝑘(𝑑𝑣) by Corollary 1. Summing 𝜌𝑘(𝑑𝑢)𝜌𝑘(𝑑𝑣) over all pairs and correcting the first two classes,

𝔼(𝑆𝑛(𝑆𝑛−1))𝑛(𝑛−1)=𝔼[𝜌𝑘(𝑑𝑢)𝜌𝑘(𝑑𝑣)]+ℙ(𝑢𝑣∈𝐸)𝔼[𝜋dist(𝑎,0,𝑐)−𝜌𝑘(𝑎+1)𝜌𝑘(𝑐+1)|𝑢𝑣∈𝐸]+ℙ(dist(𝑢,𝑣)=2)𝔼[(𝜋same+𝜋dist)(𝑎,1,𝑐)−𝜌𝑘(𝑎+1)𝜌𝑘(𝑐+1)|dist(𝑢,𝑣)=2],
(40)

Every term is a bracket ⟨𝑠𝑎𝑡𝑐𝑔(𝑠,𝑡)⟩ with 𝑔 independent of (𝑎,𝑐), so the expectation over the tree can be taken inside the bracket, where Lemma 3 gives 𝔼[𝑠𝑎𝑡𝑐] in each class: this is Eq. (39). For the asymptotics write 𝔼(𝑆𝑛)=𝑛𝜇𝑛 and 𝔼(𝑆𝑛(𝑆𝑛−1))=𝑛(𝑛−1)𝜈𝑛. Uniformly for bounded 𝑧, (1+𝑧/𝑛)𝑛−𝑗=𝑒𝑧(1−(𝑧2/2+𝑗𝑧)/𝑛+𝑂(𝑛−2)), so 𝜇𝑛=𝜇+𝜇1/𝑛+𝑂(𝑛−2) and 𝜈𝑛=𝜈+𝜈1/𝑛+𝑂(𝑛−2) with 𝜇=𝑘∫1−1/𝑘1𝑠𝑒𝑠−1d𝑠=𝑒−1/𝑘, 𝜈=⟨𝑠𝑡𝑒𝑠+𝑡−2⟩=𝜇2,

𝜇1=−𝑘∫1−1/𝑘1𝑠𝑒𝑠−1((𝑠−1)22+2(𝑠−1))d𝑠,𝜈1=−⟨𝑠𝑡𝑒𝑠+𝑡−2((𝑠+𝑡−2)22+2(𝑠+𝑡−2))⟩+⟨(𝑠+𝑡)𝑒𝑠+𝑡−2(𝑘−1𝑘−𝑠𝑡)⟩+⟨(𝑠+𝑡+1)𝑒𝑠+𝑡−2(min(𝑠,𝑡)𝑘+𝑘−1𝑘(𝑠+𝑡−1)−𝑠𝑡)⟩.
(41)
Then Var(𝑆𝑛)=𝑛2(𝜈−𝜇2)+𝑛(𝜈1−𝜈+𝜇−2𝜇𝜇1)+𝑂(1), the first term vanishes, and the elementary integrals give 𝜇1=(2𝑘−1)𝑒−1/𝑘/(2𝑘2) and 𝜈1=2(𝑘−1)𝑒−2/𝑘/𝑘2, whence 𝜎𝑘2=𝜈1−𝜇2+𝜇−2𝜇𝜇1=𝜇(1−𝜇)−𝜇2/𝑘2=𝑒−1/𝑘−(1+𝑘−2)𝑒−2/𝑘. ∎

The value of 𝜇1 sharpens Eq. (17) to 𝔼(𝑇𝑛)=(1−𝑒−1/𝑘)𝑛−(2𝑘−1)𝑒−1/𝑘/(2𝑘2)+𝑂(1/𝑛), whose constant is −1/(2𝑒) at 𝑘=1 as in Eq. (16). In the slope, 𝜇=𝑒−1/𝑘 and 𝜇/𝑘 are the probabilities that a Poisson variable of mean 1/𝑘 equals 0 and 1, so 𝜎𝑘2=𝑝0(1−𝑝0)−𝑝12. Numerically 𝜎22≈0.147 and 𝜎32≈0.146, and 𝜎𝑘2=1/𝑘−5/(2𝑘2)+𝑂(𝑘−3), so that the variance and the mean of 𝑇𝑛 become equivalent as 𝑘 grows.

Proof of Theorem 9. By Proposition 5 the peak count 𝑆𝑛 has the same law as the number of leaves of a uniform random labeled tree. The number of leaves, and more generally the number of vertices of any fixed degree, of a uniform random labeled tree (equivalently a Galton-Watson tree conditioned on its size) obeys a central limit theorem [Drm09]. Its variance is of order 𝑛 by Corollary 6, so the limit is nondegenerate. Since 𝑇𝑛=𝑛−𝑆𝑛 is affine in 𝑆𝑛, it is asymptotically normal with the stated centering and scaling. ∎
Proposition 11 (Poisson Galton-Watson tree).

For the Galton-Watson tree with Poisson(1) offspring, the probability generating function of the number of peaks is

𝐶(𝑒(𝑣−1)/𝑒−1)+𝑣−1𝑒,valid for|𝑣|≤1.
(42)

Proof. Write 𝐹(𝑧,𝑣)=𝐶(𝑧𝑒(𝑣−1)𝑧)+(𝑣−1)𝑧 for Eq. (14), so that 𝑛![𝑧𝑛]𝐹(𝑧,𝑣)=∑|𝜏|=𝑛𝑣peaks(𝜏) over the 𝑛𝑛−1 rooted labeled trees of size 𝑛. A Poisson(1) Galton-Watson tree has total-progeny law ℙ(|𝒯︀|=𝑚)=𝑒−𝑚𝑚𝑚−1/𝑚! and, conditioned on its size 𝑚 and given a uniform random vertex labeling, is a uniform rooted labeled tree (a Cayley tree) [Drm09]. As a peak depends only on the relative order of labels, its peak probability generating function is therefore

∑𝑚≥1ℙ(|𝒯︀|=𝑚)1𝑚𝑚−1∑|𝜏|=𝑚𝑣peaks(𝜏)=∑𝑚≥1𝑒−𝑚[𝑧𝑚]𝐹(𝑧,𝑣)=𝐹(1/𝑒,𝑣).
(43)
Since (1/𝑒)𝑒(𝑣−1)/𝑒=𝑒(𝑣−1)/𝑒−1, this equals 𝐶(𝑒(𝑣−1)/𝑒−1)+(𝑣−1)/𝑒. Equivalently, it is Eq. (14) composed with the Poisson size generating function 𝐴(𝑧)=𝐶(𝑧/𝑒). It converges for |𝑣|≤1, where the argument has modulus at most 1/𝑒, the radius of convergence of 𝐶. ∎

The Poisson(1) tree is critical, so its size, and with it its peak count, has infinite mean. Conditioning on the size 𝑛 returns the exact law of Theorem 8 and the finite moments of Corollary 6. By Proposition 5 this is also the leaf probability generating function of the Poisson(1) tree.

General rooted trees. Consider rooted labeled plane trees (ordered children) carrying a weight 𝜑𝑐 on each node of out-degree 𝑐, with Φ(𝑧)=∑𝑐𝜑𝑐𝑧𝑐, so that the unmarked generating function obeys the classical 𝐴(𝑧)=𝑧Φ(𝐴(𝑧)). For the Cayley weights 𝜑𝑐=1/𝑐! this is the uniform unordered labeled tree. To mark peaks we use a catalytic variable 𝑥 that records the holes of a node (the slots where a further child could be inserted), so a node of out-degree 𝑐 with 𝑑 holes weighs (𝑐+𝑑𝑐)𝜑𝑐+𝑑 and a full child-and-hole set has generating function Φ(𝑧+𝑥).

Proposition 12 (General rooted trees and Galton-Watson trees).

Let 𝐴(𝑧,𝑣,𝑥) be the generating function of weighted rooted labeled trees in which 𝑧 marks the nodes, 𝑣 the peaks and 𝑥 the holes. It is characterized by

𝜕𝑧𝐴=(𝑣−1)Φ(𝑥)+Φ(𝐴+𝑥)+(𝜕𝑥𝐴)Φ(𝐴+𝑥),
(44)

and the monochrome peak generating function is 𝐴(𝑧,𝑣,0). For Φ(𝑧)=𝑒𝑧 it is Eq. (14). If Φ is a probability generating function of mean at most 1, other than Φ(𝑧)=𝑧, then 𝐴(1,𝑣,0) is the peak probability generating function of the Galton-Watson tree with offspring law Φ. Under a uniform 𝑘-coloring, the generating function 𝐵𝑘(𝑧,𝑣) of trees whose root has a prescribed color satisfies

𝐵𝑘(𝑧,𝑣)=𝐴(𝑧,𝑣,(𝑘−1)𝐵𝑘(𝑧,𝑣)),
(45)
and the generating function of all 𝑘-colored trees is 𝑘𝐵𝑘(𝑧,𝑣).

Proof. Letting 𝑧 mark nodes, 𝑣 peaks and 𝑥 holes, removing the smallest-labeled node gives Eq. (44): the removed node is either the root (first two terms, according to whether it is a peak, which happens iff it has no children) or an internal node whose removal turns its parent slot into a hole (last term). The quantity of interest is 𝐴(𝑧,𝑣,0). For the Cayley weights 𝜑𝑐=1/𝑐!, i.e. Φ(𝑧)=𝑒𝑧, a hole behaves like a marked child slot at a single node and 𝐴(𝑧,𝑣,𝑥)=𝐹(𝑧𝑒𝑥,𝑣) with 𝐹 as in Eq. (14), which satisfies the equation and reduces at 𝑥=0 to Eq. (14). If Φ is a probability generating function of mean at most 1, other than Φ(𝑧)=𝑧 (so that the tree is almost surely finite), then 𝐴(1,𝑣,0) is well defined for |𝑣|≤1 and is the peak probability generating function of the Galton-Watson tree with offspring law Φ. The Poisson(1) case recovers Proposition 11. Unlike the Cayley case, peaks and leaves are not equidistributed in general: for the full binary offspring law the tree on three vertices has peak generating function (2𝑣+𝑣2)/3 and leaf generating function 𝑣2.

For the random coloring, consider a 𝑘-colored general rooted tree with holes and keep only the vertices of some fixed color, say red. The connected component containing the root is a monochrome (red) general rooted tree with holes, in which each hole either was already a hole in the original tree, or held the root of a 𝑘-colored subtree whose root is one of the 𝑘−1 non-red colors. Since a hole and such an attached non-red subtree play the same structural role at a red vertex, a child slot that does not affect the red vertex’s peak status, the two combine additively in the holes variable. Writing 𝐵𝑘(𝑧,𝑣) for the generating function of 𝑘-colored general rooted trees with a red root and no hole, this gives Eq. (45), and summing over the 𝑘 root colors gives 𝑘𝐵𝑘(𝑧,𝑣). In the Cayley case 𝐵𝑘=𝐹(𝑧𝑒(𝑘−1)𝐵𝑘,𝑣), which Lagrange inversion solves (Theorem 10).

Proof of Theorem 10. Orient the edges away from the root (peaks do not depend on it) and condition on the set 𝑀 of initially conflicting edges. Each non-root vertex has the color of its parent with probability 1/𝑘, independently of the others, so ℙ(𝑀=𝑀0)=𝑘−|𝑀0|(1−1/𝑘)𝑛−1−|𝑀0| for every 𝑀0⊆𝐸(𝑇), and a vertex is a peak iff it is a local maximum of the forest (𝑉,𝑀), whose components are monochrome: given 𝑀 with components Φ1,…,Φ𝑚 of sizes 𝑐1,…,𝑐𝑚, 𝑣𝑆𝑛=∏𝑖𝑣peaks(Φ𝑖). The rooted trees containing a given spanning forest Φ with these components number 𝑛𝑚−1𝑐1⋯𝑐𝑚, that is 𝑛 roots times the unrooted count 𝑛𝑚−2𝑐1⋯𝑐𝑚 [Moo70, Pit99], which is the weighted Cayley formula ∑𝜏∏𝑖𝑥𝑖deg𝜏(𝑖)=𝑥1⋯𝑥𝑚(𝑥1+⋯+𝑥𝑚)𝑚−2 over the trees 𝜏 on the 𝑚 contracted components, at 𝑥𝑖=𝑐𝑖. Summing over the trees containing Φ, then over the spanning forests with 𝑚 components,

𝔼(𝑣𝑆𝑛)=1𝑛𝑛−1∑𝑚=1𝑛𝑘−(𝑛−𝑚)(1−1𝑘)𝑚−1𝑛𝑚−1∑Φ∏𝑖=1𝑚𝑐𝑖𝑣peaks(Φ𝑖).
(46)
The factor 𝑐𝑖 roots the component Φ𝑖, and rooted labeled trees by peaks have the exponential generating function 𝐹, so the inner sum is 𝑛![𝑧𝑛]𝐹(𝑧,𝑣)𝑚/𝑚!. Since 𝑘−(𝑛−𝑚)(1−1/𝑘)𝑚−1=(𝑘−1)𝑚−1𝑘−(𝑛−1), the sum over 𝑚 is 𝑛!𝑘−(𝑛−1)[𝑧𝑛]∑𝑚≥1((𝑘−1)𝑛𝐹)𝑚/((𝑘−1)𝑛𝑚!), which is Eq. (19). At 𝑣=1, 𝐹(𝑧,1)=𝐶(𝑧) and [𝑧𝑛]𝑒𝑎𝐶(𝑧)=𝑎(𝑎+𝑛)𝑛−1/𝑛! [FS09] give 𝔼(1)=1. Alternatively, with 𝑢=𝑧𝑒(𝑘−1)𝐵𝑘 the fixed point of Proposition 12 reads 𝑧=𝑢𝑒−(𝑘−1)𝐹(𝑢,𝑣), and Lagrange inversion gives [𝑧𝑛]𝐵𝑘=[𝑢𝑛]𝑒(𝑘−1)𝑛𝐹(𝑢,𝑣)/((𝑘−1)𝑛). As 𝑛![𝑧𝑛]𝐵𝑘 counts the colored trees whose root has a prescribed color, 𝔼(𝑣𝑆𝑛)=𝑛![𝑧𝑛]𝐵𝑘/(𝑘𝑛−1𝑛𝑛−1), the same formula. Expanded, the right-hand side of Eq. (19) is a polynomial in 𝑘, whose value at 𝑘=1 is 𝑛![𝑧𝑛]𝐹(𝑧,𝑣)/𝑛𝑛−1, the monochrome law of Theorem 8. ∎

A binary-tree observation. On rooted full binary plane trees with 2𝑚+1 labeled vertices, the number of labelings with exactly one peak appears to be (2𝑚)![𝑧2𝑚]cos(𝑧)−4, the sequence OEIS A395382: we checked the identity for 𝑚≤10 but have not proved it.

``` {#sec-app-er} ## E Erdős-Rényi graphs: proofs and variance ```{raw} html
Proof of Proposition 6. List the vertices by decreasing label as in Section 5, so that the 𝑗-th vertex has the 𝑗-th largest label. It is a peak with probability 𝔼[(1−𝑝)ℎ𝑗] with ℎ𝑗∼Binomial(𝑗−1,1/𝑘), that is (1−𝑝/𝑘)𝑗−1. Summing over 𝑗 gives 𝔼(𝑆)=(𝑘/𝑝)(1−(1−𝑝/𝑘)𝑛) and 𝔼(𝑇)=𝑛−𝔼(𝑆). This expression depends on 𝑝 and 𝑘 only through 𝑝/𝑘, so the mean under a uniform 𝑘-coloring at edge probability 𝑝 equals the monochrome mean at edge probability 𝑝/𝑘. Indeed, a vertex of larger label than the 𝑗-th prevents it from being a peak iff it shares its color and is adjacent to it, an event of probability 𝑝/𝑘, as in the monochrome case at 𝑝/𝑘. This equality fails for the variance, which depends on pairs of vertices. The conflicting edges form 𝑘 separate random graphs, one per color class, not a single 𝐺(𝑛,𝑝/𝑘): two vertices of distinct colors never interact. For instance, at 𝑛=20, 𝑝=0.2, 𝑘=2 the variance is 3.38, against 3.60 monochrome at 𝑝=0.1. ∎

The same reading gives the second factorial moment in a few lines.

Proposition 13 (Erdős-Rényi, second factorial moment).

On 𝐺(𝑛,𝑝) with 𝑘 colors, with 𝑠=1−𝑝/𝑘, 𝑡1=1−(2𝑝−𝑝2)/𝑘, 𝑡2=1−2𝑝/𝑘 and 𝐹(𝑔)=(𝑘/𝑝)[(1−𝑔𝑛)/(1−𝑔)−(𝑠𝑛−𝑔𝑛)/(𝑠−𝑔)],

𝔼(𝑆(𝑆−1))=2[1−𝑝𝑘𝐹(𝑡1)+𝑘−1𝑘𝐹(𝑡2)].
(47)
At 𝑘=1 this is (∑𝑖<𝑛(1−𝑝)𝑖)2−∑𝑖<𝑛(1−𝑝)2𝑖, the second factorial moment of the independent sum of Proposition 7.
Proof. Given the colors the peak indicators are independent, so 𝔼(𝑆(𝑆−1))=2∑𝑗<𝑗′𝔼[(1−𝑝)ℎ𝑗+ℎ𝑗′], the expectation being over the colors. If the 𝑗-th and 𝑗′-th vertices share their color (probability 1/𝑘), each of the 𝑗−1 vertices of larger label than the 𝑗-th is counted in both ℎ𝑗 and ℎ𝑗′ with probability 1/𝑘, whence a factor (𝑘−1)/𝑘+(1−𝑝)2/𝑘=𝑡1 each; each of the 𝑗′−𝑗−1 vertices in between is counted in ℎ𝑗′ with probability 1/𝑘, whence a factor 𝑠; and the 𝑗-th vertex itself is counted in ℎ𝑗′, whence the factor 1−𝑝. If their colors differ (probability (𝑘−1)/𝑘), a vertex of larger label than the 𝑗-th is counted once with probability 2/𝑘, whence a factor 𝑡2, the vertices in between contribute 𝑠 each and the 𝑗-th vertex 1. Summing the geometric series over 𝑗<𝑗′ gives Eq. (47). ∎

Random graph and fixed graph. The generating functions Eq. (20) and Eq. (21) and every random-graph formula of the paper describe the joint law over the graph, the coloring and the labeling. For a fixed graph the peak indicators are dependent, and the joint variance is the mean, over the graph, of the variance on a fixed graph, plus the variance, over the graph, of the mean on a fixed graph. Only the first term measures the fluctuations of the stabilization time on one fixed network. The second measures the differences between networks.

Palette on random graphs. On 𝐺(𝑛,𝑝) the maximum degree Δ is random, so the condition 𝑞≥Δ+1 concerns the palette relative to a random quantity. Taking 𝑞=𝑛 always satisfies it. More economically, for constant 𝑝 one has Δ=(1+𝑜(1))𝑛𝑝 with high probability [JŁR00], so any palette 𝑞≥(1+𝜀)𝑛𝑝 meets 𝑞≥Δ+1 with probability 1−𝑜(1). On that event 𝑇=𝑛−𝑆 holds exactly and the excluded draws contribute a vanishing correction. When 𝑛𝑝 stays bounded, this fails: the mean degree is constant but Δ=Θ(log𝑛/loglog𝑛), so the palette must grow at least that fast. The peak statistic 𝑆, and hence every mean and variance formula, is defined for any 𝑘 with no palette constraint. The bound 𝑞≥Δ+1 is only what ties it to the algorithm’s recoloring count.

Variance through the second factorial moment theorem. Unlike the triangle-free families, 𝐺(𝑛,𝑝) has triangles, so its variance exercises the full Theorem 3, and the computation below is the one that the bipartite model reuses (Appendix F). Averaging over the random graph makes the neighborhood profile of a pair explicit: for a random ordered pair (𝑢,𝑣), each of the other 𝑛−2 vertices is independently a common neighbor with probability 𝛽=𝑝2, a private neighbor of 𝑢 (resp. 𝑣) with probability 𝛼=𝑝(1−𝑝), or neither with probability 𝛿=(1−𝑝)2, so (𝑎,𝑏,𝑐) is multinomial. Since 𝜋same and 𝜋dist are expectations of products whose exponents are exactly 𝑎,𝑏,𝑐, this multinomial average collapses the sum of Eq. (5) into closed forms.

Proposition 14 (Erdős-Rényi, variance).

On 𝐺(𝑛,𝑝) with 𝑘 colors, write 𝛼=𝑝(1−𝑝), 𝛽=𝑝2, 𝛿=(1−𝑝)2. The variance of the stabilization time is Var(𝑇)=𝔼(𝑆(𝑆−1))+𝔼(𝑆)−𝔼(𝑆)2 with 𝔼(𝑆)=(𝑘/𝑝)(1−(1−𝑝/𝑘)𝑛) as in Eq. (22) and

𝔼(𝑆(𝑆−1))=𝑛(𝑛−1)[𝐼dist+(1−𝑝)𝐼same],
(48)

where, with 𝑚=𝑛−2, 𝐼dist and 𝐼same are the closed forms

𝐼dist=𝑘−1𝑘(𝐴+2𝐵)𝑚+2−2(𝐴+𝐵)𝑚+2+𝐴𝑚+2𝐵2(𝑚+1)(𝑚+2),𝐼same=2(𝛼+𝛽)(𝑚+1)(𝑚+2)(1−𝐶𝑚+2𝐸−(𝐶+𝐷)𝑚+2−𝐶𝑚+2𝐷),
(49)
with 𝐴=𝛿+(2𝛼(𝑘−1)+𝛽(𝑘−2))/𝑘, 𝐵=(𝛼+𝛽)/𝑘, 𝐶=(𝑘−1)(2𝛼+𝛽)/𝑘+𝛿, 𝐷=𝛼/𝑘, and 𝐸=(2𝛼+𝛽)/𝑘 (so 𝐶+𝐸=1). This is the joint variance over the random graph, the random coloring, and the random labeling.

Proof. Adjacency of 𝑢 and 𝑣 is independent of the other vertices, so a pair is adjacent with probability 𝑝 (contributing 𝜋dist only, by Theorem 3) and non-adjacent with probability 1−𝑝 (contributing 𝜋same+𝜋dist), hence 𝔼(𝑆(𝑆−1))=𝑛(𝑛−1)𝔼[𝜋dist+(1−𝑝)𝜋same]. Taking the multinomial expectation of Eq. (26) and using 𝔼[𝜉𝑎𝑎𝜉𝑏𝑏𝜉𝑐𝑐]=(𝛼𝜉𝑎+𝛽𝜉𝑏+𝛼𝜉𝑐+𝛿)𝑛−2 leaves an integrand affine in each variable, which ∫01(𝐴+𝐵𝑡)𝑚d𝑡=((𝐴+𝐵)𝑚+1−𝐴𝑚+1)/(𝐵(𝑚+1)), applied once for 𝐼dist and twice for 𝐼same, evaluates to the closed forms above (the two symmetric 𝜋same terms coincide because 𝛼 multiplies both private counts). In integral form,

𝐼dist=𝑘−1𝑘∫01∫01(𝛿+2𝛼(𝑘−1)+𝛽(𝑘−2)+(𝛼+𝛽)(𝑥+𝑦)𝑘)𝑚d𝑥d𝑦,𝐼same=2𝑘∫01∫01𝑦((𝛼+𝛽)𝑘−1+𝑥𝑦𝑘+𝛼𝑘−1+𝑦𝑘+𝛿)𝑚d𝑥d𝑦.
(50)
∎
Proof of Proposition 7. The factorization of Eq. (20) is the probability generating function of the independent sum ∑𝑖𝐵𝑖. For fixed 𝑝, ∑𝑖≥0(1−𝑝)𝑖<∞, so by Borel-Cantelli only finitely many 𝐵𝑖 equal 1 almost surely and 𝑆𝑛→𝑆∞, whose mean is ∑𝑖(1−𝑝)𝑖=1/𝑝. When 𝑝𝑛→0 with 𝑛𝑝𝑛→∞ the summands are bounded and Var(𝑆𝑛)=∑𝑖<𝑛(1−𝑝)𝑖(1−(1−𝑝)𝑖)∼1/(2𝑝) diverges, so Lindeberg’s condition holds and 𝑆𝑛 is asymptotically normal. With 𝑘 colors, condition on the color classes: they induce vertex-disjoint subgraphs with independent edge sets, a class of size 𝑚 carries a peak count distributed as Eq. (20) with 𝑛 replaced by 𝑚, and all class sizes tend to infinity almost surely (with 𝑚𝑝→∞ in the second regime), so the 𝑘 conditionally independent counts converge jointly to 𝑘 independent copies of the monochrome limit. In the second regime the fluctuation of the conditional mean must be compared with the conditional variance, which is (1+𝑜(1))𝑘/(2𝑝) in probability, while, by the Berry-Esseen bound for independent bounded indicators, the conditional law is within Kolmogorov distance 𝑂(𝑝/𝑘) of the normal law, uniformly over the class sizes. Writing 𝑁𝑖 for the class sizes, the conditional mean is ∑𝑖(1−(1−𝑝)𝑁𝑖)/𝑝, so its deviation from 𝔼(𝑆𝑛) is 𝐷=−(1/𝑝)∑𝑖[(1−𝑝)𝑁𝑖−(1−𝑝/𝑘)𝑛] and, by Cauchy-Schwarz, Var(𝐷)≤(𝑘2/𝑝2)Var((1−𝑝)𝑁) with 𝑁∼Binomial(𝑛,1/𝑘). Now Var((1−𝑝)𝑁)=(1−(2𝑝−𝑝2)/𝑘)𝑛−(1−𝑝/𝑘)2𝑛, a difference of 𝑛-th powers of two numbers at distance 𝑝2(𝑘−1)/𝑘2, hence at most 𝑛𝑝2(𝑘−1)𝑘−2𝑒−2(𝑛−1)𝑝(1−𝑝/2)/𝑘≤𝑛𝑝2(𝑘−1)𝑘−2𝑒−𝑛𝑝/𝑘 for 𝑝≤1/2 and 𝑛≥3. Therefore Var(𝐷)/Var(𝑆𝑛)=𝑂((𝑘−1)𝑛𝑝𝑒−𝑛𝑝/𝑘), which tends to 0 when 𝑛𝑝→∞, and the conditionally Gaussian limit is Gaussian. ∎

At fixed 𝑝 the mean degree grows with 𝑛, so the expected number of peaks 𝔼(𝑆)→𝑘/𝑝 stays bounded and the variance tends to a constant rather than growing linearly (visible in Figure 2). The closed forms track this limit exactly. The companion code checks these formulas.

``` {#sec-app-bip} ## F Bipartite graphs: proofs and variance ```{raw} html
Proof of Proposition 8. As in Eq. (22), with 𝔼[𝑡𝑑]=(1−𝑝+𝑝𝑡)𝑛2 on the first side and (1−𝑝+𝑝𝑡)𝑛1 on the second, weighted by 𝑛1 and 𝑛2: integrate 𝑘∫1−1𝑘1 term by term. ∎

Variance. Same-side pairs (both in the first side, or both in the second) are non-adjacent and have their common and private neighbors among the opposite side, so they reuse the 𝐺(𝑛,𝑝) integrals 𝐼dist(𝑚) and 𝐼same(𝑚) of Eq. (48) with the exponent 𝑛−2 replaced by the opposite-side size. Cross pairs (one endpoint on each side) can have no common neighbor, so 𝑏=0. Their private-neighbor counts are independent binomials, and adjacency occurs with probability 𝑝.

Proposition 15 (Bipartite Erdős-Rényi, variance).

Write 𝐼dist(𝑚),𝐼same(𝑚) for the closed forms of Eq. (48), set 𝑟=1−𝑝/𝑘, and

𝐿dist=(𝑘−1)𝑘𝑝2𝑛1𝑛2(1−𝑟𝑛1)(1−𝑟𝑛2),𝐿same=Λ(𝑛2−1,𝑛1−1)+Λ(𝑛1−1,𝑛2−1),withΛ(𝑀,𝑀′)=𝑘𝑝2(𝑀+1)(1−𝑟𝑀+𝑀′+2𝑀+𝑀′+2−𝑟𝑀+11−𝑟𝑀′+1𝑀′+1).
(51)

Then, with 𝔼(𝑆) as in Eq. (23),

𝔼(𝑆(𝑆−1))=𝑛1(𝑛1−1)[𝐼same(𝑛2)+𝐼dist(𝑛2)]+𝑛2(𝑛2−1)[𝐼same(𝑛1)+𝐼dist(𝑛1)]+2𝑛1𝑛2[𝑝𝐿dist+(1−𝑝)(𝐿same+𝐿dist)],
(52)

and Var(𝑇)=𝔼(𝑆(𝑆−1))+𝔼(𝑆)−𝔼(𝑆)2. In integral form,

𝐿dist=𝑘−1𝑘∫01∫01(1−𝑝(1−𝑥)𝑘)𝑛2−1(1−𝑝(1−𝑦)𝑘)𝑛1−1d𝑥d𝑦,𝐿same=1𝑘∫01∫01𝑦[(1−𝑝(1−𝑥𝑦)𝑘)𝑛2−1(1−𝑝(1−𝑦)𝑘)𝑛1−1+(1−𝑝(1−𝑥𝑦)𝑘)𝑛1−1(1−𝑝(1−𝑦)𝑘)𝑛2−1]d𝑥d𝑦.
(53)

The companion code checks this formula.

Proof of Proposition 9. Conditional independence. Attribute each edge to its endpoint of smaller label. Ordering the vertices by decreasing label, the 𝑗-th vertex is a peak iff none of its edges to the ℎ𝑗 opposite-side vertices of larger label that share its color is present. These edge sets are disjoint for distinct 𝑗, so conditionally on the sequence of sides and colors the peak indicators are independent with the stated probabilities, which gives the stated generating function.

Limit at fixed 𝑝, monochrome. Write 𝑆𝑛=∑𝑗≥1𝐵𝑗 with 𝐵𝑗 the indicator that the vertex of 𝑗-th largest label is a peak. Given the sides, ℎ𝑗 counts the vertices of the opposite side among the 𝑗−1 vertices of larger label. The sequence of sides is a uniform arrangement of 𝑛1 first-side and 𝑛2 second-side symbols, so for a first-side vertex ℎ𝑗 is hypergeometric (a sample of size 𝑗−1 without replacement from the other 𝑛−1 vertices, 𝑛2 of which lie on the second side), with mean (𝑗−1)𝑛2/(𝑛−1), and symmetrically. By Hoeffding’s comparison of sampling without and with replacement for convex functions [Hoe63], 𝔼[(1−𝑝)ℎ𝑗]≤(1−𝑝𝑛2/(𝑛−1))𝑗−1 for a first-side vertex and 𝔼[(1−𝑝)ℎ𝑗]≤(1−𝑝𝑛1/(𝑛−1))𝑗−1 for a second-side one. Both are bounded by 𝜃𝑗−1 with 𝜃=1−𝑝min(𝜆,1−𝜆)/2<1 for all 𝑛≥𝑛0 and all 𝑗, since 𝑛1/𝑛→𝜆∈(0,1). Hence ∑𝑗>𝐽𝔼(𝐵𝑗)≤𝜃𝐽/(1−𝜃) uniformly in 𝑛: the tail of 𝑆𝑛 beyond the top 𝐽 vertices is negligible in probability, uniformly in 𝑛. For fixed 𝐽 the top 𝐽 sides converge in law to i.i.d. Bernoulli(𝜆) draws, so ∑𝑗≤𝐽𝐵𝑗 converges in law to its i.i.d. counterpart. Letting 𝐽→∞ gives 𝑆𝑛→𝑆∞′=∑𝑗≥1𝐵𝑗∞, where, given i.i.d. sides with ℙ(first side)=𝜆, the 𝐵𝑗∞ are independent Bernoulli((1−𝑝)ℎ𝑗). The limit 𝑆∞′ is almost surely finite since its mean is. The mean follows: a first-side vertex at position 𝑗 has ℎ𝑗∼Binomial(𝑗−1,1−𝜆), so 𝔼[(1−𝑝)ℎ𝑗]=(1−𝑝(1−𝜆))𝑗−1, and summing over 𝑗 with weight 𝜆, plus the symmetric term, gives 𝜆/(𝑝(1−𝜆))+(1−𝜆)/(𝑝𝜆).

𝑘 colors. Conditionally on the colors, the color classes induce vertex-disjoint bipartite subgraphs with independent edge sets, each with sides of sizes 𝑛1/𝑘+𝑂(𝑛) and 𝑛2/𝑘+𝑂(𝑛) in probability, hence with the same side proportion 𝜆 in the limit. The 𝑘 conditionally independent peak counts converge jointly to 𝑘 independent copies of 𝑆∞′. ∎

``` {#sec-app-numerics} ## G Numerical checks ```{raw} html

Two independent programs were used. The first runs the actual recoloring dynamics under the random central daemon (an event loop that draws a uniformly random enabled process at each step and recolors it with a random free color) and records the number of moves. It does not use Lemma 1 and serves to check it. The second is a peak-oracle sampler: by Lemma 1 one sample of the stabilization time needs only a coloring and a labeling, not a run of the dynamics, which makes large campaigns cheap. On fourteen test graphs (at most seven vertices, listed with the companion code), the law of the move count under the first agrees with the exact law of 𝑛−𝑆, computed by enumeration, for 𝑘=1,2,3 initial colors. In addition, every generating function and closed form of the paper was compared with exact enumeration for small sizes:

The following were also checked:

The figures below plot the closed forms against the peak-oracle Monte Carlo across 𝑛 for all five families, monochrome (Figure 1, Figure 2) and under a random 3-coloring (Figure 3, Figure 4). Each point averages 6×104 samples and agreement is within sampling error throughout. Figure 5 compares the exact law of the monochrome path with its Gaussian limit at 𝑛=60. The simulation code, the closed-form implementations and the code of every check above and of the figures are in the companion notebook of the Python package tinto, version 0.1.0, docs/companion/exact_stabilization_time.ipynb, archived by Software Heritage as swh:1:rev:79d72a3026ff486616ef0ba83b70e192de339cee. Its current version, executed, is in the documentation of tinto, balouf.github.io/tinto.

Figure 1: Mean stabilization time: closed forms (lines) against Monte Carlo (markers), monochrome initial coloring, for the path, cycle, random tree, 𝐺(𝑛,0.1) and balanced bipartite 𝐺(𝑛/2,𝑛/2,0.1). The path and cycle lines coincide, the two means differing by 1/3.
Figure 2: Variance of the stabilization time: closed forms (lines) against Monte Carlo (markers), monochrome initial coloring. For the bounded-degree families (path, cycle, tree) the variance grows linearly in 𝑛. For the fixed-density random-graph families 𝐺(𝑛,0.1) and bipartite 𝐺(𝑛/2,𝑛/2,0.1), whose mean degree grows so that the peak count stays bounded, it tends to a constant.
Figure 3: Mean stabilization time under a random 3-coloring: closed forms (lines) against Monte Carlo (markers), for the path, cycle, random tree, 𝐺(𝑛,0.1) and balanced bipartite 𝐺(𝑛/2,𝑛/2,0.1).
Figure 4: Variance under a random 3-coloring: closed forms (lines) against Monte Carlo (markers), for the path, cycle, random tree (exact double integral of Proposition 10, with slope 𝜎32≈0.146 by Eq. (18)), 𝐺(𝑛,0.1) and balanced bipartite 𝐺(𝑛/2,𝑛/2,0.1).
Figure 5: Empirical law of the stabilization time on the monochrome path at 𝑛=60 (Monte Carlo, markers) against the Gaussian limit of Corollary 5 (mean (2𝑛−1)/3=39.67, variance (2𝑛+2)/45≈2.71).
  1. 1On a random graph Δ is random, but 𝑞=𝑛 always works, and the peak statistic itself needs no palette constraint (Appendix E).
```