---
title: Local Evolution of Prim's Algorithm
url: https://www.emergentmind.com/topics/local-evolution-of-prim-s-algorithm
type: topic
---

# Local Evolution of Prim's Algorithm

Searching arXiv for the cited Prim-related papers to ground the article.
arXiv search query: all:"Local limit of Prim's algorithm"
Local evolution of Prim’s algorithm denotes a family of viewpoints in which Prim’s classical greedy MST construction is not treated as a single terminal computation, but as a process whose intermediate states, induced orderings, local perturbations, or implementation-level state transitions are themselves the primary object of study. Across the literature, this notion includes stepwise enumeration of increasingly costly spanning trees from an initial MST, recursive recovery of subtree structure from the vertex insertion order generated by Prim’s algorithm, asymptotic analysis of rank-dependent statistics in random graphs, process-level local limits on the \(tn+o(n)\) time scale, and memory-oriented augmentations that preserve the greedy backbone while altering the state representation [1209.4206] [1911.00223] [2601.15520] [2507.04867] [2305.05121].

## 1. Classical Prim dynamics and the meaning of locality

Prim’s algorithm is described in the cited work in its standard incremental form. Starting from a seed vertex or root, it maintains a connected tree fragment and repeatedly adds the minimum-weight edge crossing from the current fragment to an outside vertex. In the notation used for rooted weighted graphs, the process begins with
\[
T_1=(\{o\},\varnothing),
\]
and, given \(T_{k-1}=(V_{k-1},E_{k-1})\), chooses the edge of minimum weight among all edges with exactly one endpoint in \(T_{k-1}\), then adds that edge and the new vertex to obtain \(T_k\). For a finite graph on \(n\) vertices, \(P_n(G)\) is exactly the MST [1911.00223] [2507.04867].

Within this framework, “local” has several distinct technical meanings. In combinatorial enumeration, locality refers to a one-edge modification of a current spanning tree along a fundamental circuit. In clustering, it refers to the fact that Prim’s algorithm produces a vertex insertion order whose threshold structure identifies subtrees after a cut. In probability, it refers either to statistics of the early Prim ranks or to convergence of rooted neighborhoods in the local metric \(d\). In systems-oriented work, it refers to preserving the control structure of Prim’s method while replacing exact state with compact probabilistic state. A plausible implication is that the phrase “local evolution” is not a single established formalism, but a unifying description for several process-centric extensions of Prim’s algorithm.

| Context | Local object | Representative paper |
|---|---|---|
| Ordered spanning-tree generation | Branch–chord exchange from a current MST | [1209.4206] |
| Single linkage clustering | Prim’s order and recursive subtree recovery | [1911.00223] |
| Random graph asymptotics | Colour composition of early Prim ranks | [2601.15520] |
| Dynamic local limits | Rooted neighborhood process at time \(tn+o(n)\) | [2507.04867] |
| Memory-constrained computation | Bloom-filter visited state with Prim control flow | [2305.05121] |

## 2. Ordered tree evolution by local branch–chord exchange

A direct interpretation of local evolution appears in the ordered enumeration method "A combinatorial algorithm to generate all spanning trees of a weighted graph in order of increasing cost" [1209.4206]. The paper does not replace Prim’s or Kruskal’s algorithm as a method for finding a single MST. Instead, it explicitly begins from an MST obtained by Prim’s or Kruskal’s algorithm and then generates the “next best” spanning trees by repeated local exchanges.

The central device is the **Difference Weighted Circuit Matrix (DWCM)**, described as a modification of the **Fundamental Circuit Matrix (FCM)**. If a graph has \(n\) vertices and \(m\) edges, then a spanning tree has \(n-1\) branches and \(m-n+1\) chords. The DWCM is an \((m-n+1)\times(n-1)\) matrix with current-tree branches as columns and chords as rows. For a chord \(c_i\) and branch \(b_j\),
\[
C[i][j] = w(c_i)-w(b_j)
\]
when \(b_j\) lies on the fundamental circuit created by adding \(c_i\) to the current tree, and otherwise
\[
C[i][j] = 0.
\]
Each positive entry therefore represents the cost increase produced by replacing a branch with a chord along the corresponding fundamental circuit [1209.4206].

The **OMST (Ordered Minimal Spanning Trees)** algorithm first computes an MST, stores its tree edges, constructs the DWCM, and then selects the **minimum positive** entry. That entry identifies the smallest local exchange producing a heavier spanning tree. The new tree is formed by replacing the relevant branch with the corresponding chord, and its total cost is updated by adding the selected positive difference. The procedure then repeats, considering positive entries from the relevant rows and columns and always selecting the next tree of minimum cost among the available candidates. The paper claims two ordering guarantees: that spanning trees are generated sequentially in increasing order of cost, and that the algorithm “always generates minimal spanning trees in increasing order” [1209.4206].

This formulation is one of the clearest instances of a local evolution of Prim’s algorithm. Prim’s original local choice adds the cheapest edge that expands the tree to a new vertex; OMST instead starts from an already optimal tree and **evolves the existing tree by swapping one branch for one chord**. The locality is therefore not constructive growth from scratch, but **local perturbation of an existing optimal tree**. The paper explicitly emphasizes that only a small number of trees need to be stored at any time, and that previously generated trees with smaller cost are deleted once a better next stage is found. The complexity summary given in the paper is an initial MST construction cost of \(O(n^2)\) using Prim’s algorithm, DWCM construction cost \(O(n^k)\) with \(2 \le k \le 3\), minimum-positive-entry search cost \(O(n-1)\), and overall time roughly
\[
O(n^2 + N \cdot n^k + n - 1),
\]
where \(N\) is the total number of spanning trees; the paper notes that the method is exponential in the worst case because \(N\) can be exponential [1209.4206].

A recurring misconception is that such a method is simply another MST algorithm. The paper is explicit that it is not. Prim’s algorithm constructs **one** MST by continuously adding the cheapest connecting edge, whereas OMST uses an initial MST and then **systematically generates the next spanning trees** by local branch–chord exchanges guided by the DWCM [1209.4206].

## 3. Prim’s order as a local separator for recursive MST splitting

A second notion of local evolution appears in single linkage clustering. In "A Simple and Efficient Method to Compute a Single Linkage Dendrogram" [1911.00223], the MST is used as the substrate for recursively removing the longest edge and thereby building the binary hierarchy underlying the dendrogram. The paper’s key claim is that Prim’s algorithm produces not only the MST edges but also a vertex insertion order—called the **Prim’s order**—which can be reused to recover the vertex and edge sets of the subtrees created when the MST is split.

With a seed vertex \(v_{\text{seed}}\), the algorithm starts from
\[
V_{\text{mst}}=\{v_{\text{seed}}\}, \qquad E_{\text{mst}}=\emptyset,
\]
and repeatedly adds the minimum-weight edge \((u,v)\) satisfying \(u\in V_{\text{mst}}\) and \(v\notin V_{\text{mst}}\). The order in which vertices are added is denoted by \(P(v_k)\), with \(P(v_{\text{seed}})=1\), and it induces an order on MST edges by
\[
P(e)=\max(P(v_i),P(v_j))
\]
for \(e=(v_i,v_j)\). In the distinct-weight case, both the MST and the insertion order are unique for a fixed seed [1911.00223].

The local mechanism becomes explicit when the longest MST edge \(e_{\max}=(v_i,v_j)\) is removed. If that removal splits the tree into subtrees \(T_L\) and \(T_R\), then the paper states that the partition can be read directly from Prim’s order:
\[
V_L=\{v: P(v)<P(e_{\max})\}, \qquad V_R=\{v: P(v)\ge P(e_{\max})\},
\]
\[
E_L=\{e: P(e)<P(e_{\max})\}, \qquad E_R=\{e: P(e)>P(e_{\max})\}.
\]
Intuitively, the endpoint of \(e_{\max}\) with the larger Prim index is the first vertex that enters the right subtree, so all earlier vertices lie on one side of the cut and all later vertices lie on the other [1911.00223].

The paper’s proof strategy reduces the argument from the original graph to the MST itself. A lemma states that, when edge weights are distinct and the same seed is used, Prim’s order on the original graph is the same as Prim’s order on the MST. If the seed lies in \(T_L\), then every edge in \(T_L\) has weight less than \(e_{\max}\), and the only edge connecting \(T_L\) to \(T_R\) is \(e_{\max}\). Consequently, Prim’s algorithm completes the left subtree before ever crossing the split edge. This is a local temporal statement: the “time of arrival” generated by Prim’s exploration already encodes the subtree separation structure [1911.00223].

The same reasoning supports recursive splitting. The resulting trees \(T_L\) and \(T_R\) are themselves MSTs for their own vertex sets, and the paper formulates this through inherited orderings:
\[
P_L(v)=P(v)\quad \forall v\in T_L,
\]
and, for the right subtree,
\[
P_R(v)=P(v)-P(v_j)+1 \quad \forall v\in T_R.
\]
This allows a dendrogram node to be represented by a range of Prim orders rather than a full member list. The practical significance emphasized by the paper is that the dendrogram can be built recursively **without any additional computational cost**, and without storing the full interpoint distance matrix [1911.00223].

## 4. Local rank statistics and colour bias in random bipartite graphs

A probabilistic version of local evolution is studied in "Colour ratio in Prim’s ranking of bipartite graphs" [2601.15520]. The setting is the complete bipartite graph
\[
K_{n_b,n_w},
\]
with vertex set \(V_n=V_n^b\cup V_n^w\), where vertices are labelled black and white and the edge weights are i.i.d. uniform on \((0,1)\). Because the weights are almost surely distinct, Prim’s algorithm yields an almost surely unique MST and, crucially, an ordering of the vertices
\[
\sigma(1),\sigma(2),\dots,\sigma(n),
\]
called the **Prim sequence**. The paper studies the proportion of black vertices among the first \(k\) ranks,
\[
\rho_k^{(n)}=\frac{|\Sigma^b(k)|}{k}, \qquad \Sigma^b(k)=\Sigma(k)\cap V_n^b,\quad \Sigma(k)=\{\sigma(1),\dots,\sigma(k)\}.
\]

The central message is that the initial Prim order is biased and, in general, does not reflect the global proportion \(n_b/n\to\theta\). Under the balanced scaling assumption
\[
\frac{n_b}{n}\to \theta\in(0,1), \qquad n=n_b+n_w\to\infty,
\]
the paper identifies two asymptotic regimes. In the **sublinear regime**, for any \(\kappa_n\to\infty\) with \(\kappa_n=o(n)\),
\[
\rho_{\kappa_n}^{(n)}\xrightarrow[n\to\infty]{\mathbb P} \frac{1}{1+\gamma_\theta},
\qquad
\gamma_\theta=\sqrt{\frac{1-\theta}{\theta}}.
\]
It also proves the stronger uniform statement
\[
\sup_{0\le t\le 1}\left|\frac{1}{\kappa_n}\big|\Sigma^b(\lfloor \kappa_n t\rfloor)\big|-\frac{t}{1+\gamma_\theta}\right|\xrightarrow{\mathbb P}0.
\]
Thus, at mesoscopic scales, the black count grows linearly with slope \((1+\gamma_\theta)^{-1}\) [2601.15520].

In the **linear regime**, with \(k=\lfloor sn\rfloor\) for fixed \(s\in(0,1)\), the limit is parameterized through percolation. Writing
\[
\alpha_\theta=(\theta(1-\theta))^{-1/2},
\]
and defining \((\ell(\lambda),\rho(\lambda))\in(0,1)^2\) by the fixed-point system
\[
\left\{
\begin{array}{cl}
\rho\ell = \theta\big(1-e^{-\alpha_\theta\lambda(1-\rho)\ell}\big),\\[2mm]
(1-\rho)\ell = (1-\theta)\big(1-e^{-\alpha_\theta\lambda\rho\ell}\big),
\end{array}
\right.
\]
the theorem states
\[
\rho_{\lfloor sn\rfloor}^{(n)} \xrightarrow[n\to\infty]{\mathbb P} \rho\circ \ell^{-1}(s).
\]
As \(s\downarrow 0\), this limit approaches \((1+\gamma_\theta)^{-1}\), while as \(s\uparrow1\) it approaches \(\theta\). The interpretation given in the paper is that early Prim ranks are systematically biased, but the full sequence eventually averages out to the true global black proportion [2601.15520].

The mechanism is a coupling with **bond percolation** on the bipartite graph. For \(p\in(0,1)\), the graph \(G(n_b,n_w,p)\) is formed by retaining edges with \(U_e\le p\), and a key structural fact is that the connected components of this percolated graph are intervals in Prim order:
\[
\mathcal C_j(p)=\{\sigma(i): J_{j-1}+1\le i\le J_j\}.
\]
This makes Prim’s ranking a graph exploration order for the percolated graph. The paper’s explanation of the bias is that Prim’s algorithm does not sample vertices uniformly: it always selects the next vertex through the lightest edge crossing the current explored set, so in the sparse or critical regime the exploration resembles a two-type branching process. Several special cases are spelled out. If \(\theta=\tfrac12\), then \(\gamma_\theta=1\) and the sublinear limit is \(\tfrac12=\theta\). If \(\theta\neq \tfrac12\), the early ratio lies strictly between \(\theta\) and \(1/2\), so the early Prim ranking pulls the observed colour ratio toward balance [2601.15520].

## 5. Dynamic local limits on the \(tn+o(n)\) time scale

The most explicit large-scale process formulation is given in "Local limit of Prim’s algorithm" [2507.04867]. The paper studies a sequence of finite graphs \((G_n)_{n\ge1}\) with \(|V(G_n)|=n\), each equipped with a **standard extension** consisting of a uniformly chosen root \(o_n\) and i.i.d. \(Uniform[0,1]\) edge weights. The rooted weighted graph is
\[
G_n=(G_n,o_n,w_n),
\]
and the sequence is assumed to converge **locally in probability** to a rooted weighted infinite graph \(G\). Using the local metric \(d\), this convergence means
\[
E\!\left[h(G_n,o_n)\mid G_n\right]\xrightarrow{\mathbb P} E[h(G)]
\]
for every bounded continuous test function \(h\) on the rooted weighted graph space [2507.04867].

The dynamic theorem concerns the process at times
\[
k_n(t)=tn+o(n),\qquad t\in[0,1].
\]
Here \(t=0\) corresponds to sublinear time, \(0<t<1\) to an intermediate linear-time regime, and \(t=1\) to completion of the full MST. The local object is the rooted neighborhood around a typical vertex, viewed as a stochastic process in the local topology. The central limiting structure is the **expanded invasion percolation cluster**
\[
F_+^G(p),
\]
defined by
\[
E(F_+^G(p))=E(P_\infty(G))\cup E(F^G(p)),
\]
with the connected component containing the root retained. In this notation, \(P_\infty(G)\) is the invasion percolation cluster obtained by running Prim forever on the infinite graph, and \(F^G(p)\) is the subgraph of the minimum spanning forest \(F^G\) consisting of edges of weight at most \(p\) [2507.04867].

Under three assumptions—**local percolation of a giant**, **smooth percolation**, and **percolation giant is almost local**—the paper proves
\[
\Big(P_{k_n(t)}(G_n)\Big)_{t\in[0,1]} \Longrightarrow \Big(F_+^G(\theta^{-1}(t))\Big)_{t\in[0,1]}
\]
in the sense of **local process convergence**, where
\[
\theta(p)=P\Big(|C_o^G(p)|=\infty\Big),\qquad
\theta^{-1}(t)=\inf\{p:\theta(p)>t\},
\]
and
\[
p_c=\inf\{p:\theta(p)>0\}.
\]
This gives a precise interpolation statement. At \(t=0\),
\[
F_+^G(\theta^{-1}(0))=F_+^G(p_c)=P_\infty(G),
\]
so the local picture is invasion percolation. At \(t=1\),
\[
F_+^G(\theta^{-1}(1))=F_+^G(1)=F^G,
\]
so the process converges to the local limit of the minimum spanning forest. For \(0<t<1\), the local structure is the union of the early invasion cluster and the part of the MSF consisting of edges with weight up to \(\theta^{-1}(t)\) [2507.04867].

The proof is organized around three steps. First, the paper identifies the correct one-time limit by showing that after about
\[
K(p)+|C^{G_n}_{(1)}(p)|
\]
steps, Prim’s algorithm locally matches \(F_+^G(p)\), where
\[
K(p)=\min\Big\{k:\exists v\in V(P_k(G)),\ |C_v^G(p)|=\infty\Big\}-1.
\]
Second, it converts this into finite-dimensional convergence using the approximation
\[
|C_{(1)}^{G_n}(p)|\approx n\theta(p).
\]
Third, it verifies the dynamic local convergence criteria: finite-dimensional local convergence, continuity of the limit at \(t=1\), and a no-large-jump condition [2507.04867].

The paper also describes model classes where the theorem applies, including large grids, the complete graph or Erdős–Rényi setting, many configuration-model sequences, and preferential-attachment graphs. It further notes that when some assumptions fail, especially in “union graphs,” the dynamic local limit may still exist but can require a modified interpolation formula and may depend sensitively on the global construction rather than only the local limit [2507.04867].

## 6. Implementation-level evolution under memory constraints

A different but related use of local evolution appears in "Memory-Efficient Solutions to Large-Graph MST Problems" [2305.05121]. The paper does not change the greedy selection rule of Prim’s algorithm. Instead, it proposes an augmentation in which the standard visited set is replaced by a **Bloom filter** \(B\), and the chosen MST edges are recorded in a compact **bitarray edge map** \(E\). The author explicitly characterizes this as a “slight modification” or “augmented” Prim’s algorithm because the control structure remains the same: a starting vertex, a priority queue of candidate edges, repeated extraction of the smallest edge, and expansion to unseen vertices.

The workflow presented as **Algorithm 1: Bloom MST** initializes
\(G\), an empty Bloom filter \(B\), an empty bitarray edgemap \(E\), an arbitrary starting node \(s\), a cost accumulator, and an empty priority queue \(q\). All neighbors of \(s\) are pushed into the queue. The main loop repeatedly pops the minimum-cost candidate; if `not B.contains(s.SinkNode)`, the algorithm adds the sink node to the Bloom filter, increases the cost, sets the corresponding edge bit in \(E\), and pushes outgoing neighbors whose targets are not in the Bloom filter. The output is \((\text{cost},E)\) [2305.05121].

The paper’s correctness discussion is intentionally informal. Because Bloom filters have **false positives but no false negatives**, a vertex may be incorrectly treated as already visited, but a genuinely visited vertex will not be missed. The paper therefore states that the estimated graph “will never have duplicate nodes or add edges that would not otherwise be in the deterministic MST,” and also claims that the resulting tree cost will be “less than or equal to the true cost” provided all edge weights are non-negative. This is not exact deterministic MST computation in the strict sense; the paper explicitly frames it as **approximate correctness** under bounded false-positive risk [2305.05121].

The theoretical time bounds reported are classical Prim with a priority queue at
\[
O(|E|\log |V|)
\]
and the Bloom-filter version at
\[
O(k|E|\log |V|),
\]
where \(k\) is the number of hash functions. The Bloom filter parameters are given by
\[
m=\frac{-n\ln\epsilon}{\ln 2^2}, \qquad
k=\frac{m\ln 2}{n}.
\]
The main benefit is reduced auxiliary memory rather than improved asymptotic running time [2305.05121].

The empirical results reported in the paper use synthetic RMAT graphs generated by **PaRMAT** with parameters
\[
a=0.45,\quad b=0.22,\quad c=0.22,
\]
on graph sizes from **1,000,000 to 10,000,000 nodes**. The baseline is a standard Prim implementation using a hash set for visited nodes. The paper reports an **Average 95.19% decrease in auxiliary memory usage** for the visited-state computation and an **Average error rate 0.18%**. It also states that when total memory including the graph is counted, the modified algorithm uses about **57.8%** of the classical Prim total in the reported experiments [2305.05121].

This line of work clarifies an important boundary in the meaning of local evolution. Here the locality does not concern local weak limits, rank statistics, or branch–chord exchanges. It concerns the state transition of Prim’s greedy loop under compressed membership structure. A common misconception would be to read the method as an exact reformulation of Prim’s algorithm; the paper is explicit that Bloom-filter false positives can cause skipped nodes, can be more problematic on **sparse graphs**, and make the method most suitable when memory is the bottleneck and a small approximate error is acceptable [2305.05121].

## 7. Conceptual synthesis and scope

Taken together, these works show that the local evolution of Prim’s algorithm is best understood as a multi-layered research theme rather than a single theorem or algorithm. At the combinatorial level, local evolution means moving from one spanning tree to the next by a smallest-cost branch–chord exchange on a fundamental circuit. At the structural level, it means that Prim’s insertion order encodes threshold information sufficient to recover recursive subtree decompositions after longest-edge cuts. At the stochastic-process level, it means that the rooted neighborhood of a typical vertex evolves on the \(tn+o(n)\) time scale from the invasion percolation cluster to the minimum spanning forest local limit. At the probabilistic-statistical level, it means that early Prim ranks on random bipartite graphs exhibit a nontrivial colour bias before converging toward the global proportion. At the implementation level, it means that the greedy backbone can be preserved while the visited-state mechanism is altered for memory efficiency [1209.4206] [1911.00223] [2601.15520] [2507.04867] [2305.05121].

These viewpoints are complementary rather than interchangeable. The OMST literature is about ordered enumeration beyond the first MST; the dendrogram literature is about reusing Prim-generated order information; the random-graph literature is about distributional properties of the Prim sequence; the local-limit literature is about convergence of the rooted process in a local topology; and the memory-efficient literature is about engineering the state representation of the Prim loop. This suggests that “local evolution of Prim’s algorithm” functions as a cross-cutting conceptual label for studies that treat Prim not merely as a static MST output procedure, but as an evolving process whose intermediate local structure carries independent combinatorial, probabilistic, and algorithmic content.

Source: https://www.emergentmind.com/topics/local-evolution-of-prim-s-algorithm