arXiv:2611.05713cs.DSNov 2026

Manuscript Offprint

arXiv:2611.05713

Incremental Minimum Spanning Trees on a Napkin

Lucian Bicsi, Adrian Budău

Abstract

In the incremental minimum spanning forest problem, weighted edges arrive one at a time. After each insertion we must report the edge that leaves the minimum spanning forest, and queries ask for the bottleneck distance of two vertices: the smallest possible maximum edge cost on a path between them. Link-cut trees solve both in O(log⁡n)O(\log n) amortized time. In 2021 we wrote the folklore BottleneckTree, a short competitive-programming structure that stores one parent pointer and one cost per vertex, and conjectured that it also runs in O(log⁡n)O(\log n) amortized time. We show that this conjecture is false: on a family of inputs, its amortized cost per operation is Ω(n)\Omega(\sqrt{n}). We then present a structure with the same state, two arrays and a single loop, and prove that it runs in O(log⁡n)O(\log n) amortized time per insertion and per query. Unlike the AM-tree of Ding, Gu and Sun, which attains the same bound, it stores no subtree sizes and maintains no balance invariant. For a connected graph with distinct costs, the structure can be viewed as an implicit link-cut tree on the Kruskal reconstruction tree: each rotation corresponds to exactly one preferred-child change, and each skip acts on a stale path-parent pointer. In experiments it is 1.3–2.1 times faster than the folklore BottleneckTree on insertions, up to 480 times faster on its adversarial input, and 6.3–16 times faster than an explicit link-cut tree.

1 Introduction

Maintaining a minimum spanning forest (MSF) while edges arrive one at a time is a basic dynamic graph problem, known as incremental minimum spanning tree. The graph has the vertices V={0,…,n−1}V = \{0, \ldots, n-1\} and real edge costs, starts without edges, and supports two operations.

AddEdge(x,y,c)(x, y, c): insert the edge {x,y}\{x, y\} with cost cc and return the cost of the edge that leaves the MSF: the cost of the removed edge if the new edge enters the forest, cc if the new edge does not enter, and ∞\infty if xx and yy were in different components (then no edge leaves).

Query(x,y)(x, y): return the bottleneck distance of xx and yy, the minimum over all x−yx-y paths of the maximum edge cost on the path (∞\infty if no path exists).

The problem is used for connectivity queries on temporal graphs [1, 2]: if each edge costs minus its arrival time, the edges that arrived after time tt connect xx and yy exactly when Query(x,y)<−t(x, y) < -t, which answers sliding-window connectivity [3] without deletions. The structure also maintains the MSF of an edge stream in O(n)O(n) space, and Query(x,y)(x, y) is the level at which single-linkage clustering merges xx and yy.

How simple can a logarithmic solution be? The classical solution stores the forest in a link-cut tree [4, 5] and takes O(log⁡n)O(\log n) amortized time per operation, at the price of splay trees, path-parent pointers and reversal bits. Recent work uses a much simpler object: a rooted tree on

structurestateamortized time per operation
link-cut tree [5]child and parent pointers, reversal bit and path maximum, for every vertex and every forest edgeO(log⁡n)O(\log n)
AM-tree [2]parent, cost and subtree size per vertexO(log⁡n)O(\log n)
folklore BottleneckTree [6]parent and cost per vertexΩ(n)\Omega(\sqrt{n}) (Theorem 13)
this paper (Fig. 2)parent and cost per vertexO(log⁡n)O(\log n) (Theorem 7)

Table 1: Structures for incremental MST and bottleneck queries. For the AM-tree we list its lazy variant; the strict variant also stores child pointers and bounds the worst-case query time. The lower bound for the folklore BottleneckTree holds on an explicit family of inputs.

the vertices, with one parent pointer and one cost per vertex, whose path maxima equal those of the MSF. The OEC-forest [1] uses such a tree, but no bound better than O(n)O(n) per operation is known for it. The AM-tree [2] attains O(log⁡n)O(\log n) amortized time by also storing subtree sizes and enforcing an anti-monopoly rule: no child may hold more than two thirds of its parent's subtree.

In 2021 we wrote the folklore BottleneckTree [6] for competitive programming. It uses the same kind of tree, stores nothing else, and fits in a few lines of code. Its header states the bound “probably O(log⁡n)O(\log n) amortized”, which we conjectured when writing it. No proof has been given.

Our results. We show that this conjecture is false: on an explicit family of inputs, the folklore BottleneckTree takes Ω(n)\Omega(\sqrt{n}) amortized time per operation, and we explain informally why our analysis does not apply to it (Section 6). We then give a structure with exactly the same state that provably runs in O(log⁡n)O(\log n) amortized time. Table 1 summarizes the comparison.

Like the AM-tree and the folklore BottleneckTree, our structure changes the tree only by two local moves: a rotation, which swaps a vertex with its parent, and a skip, which makes a vertex a child of its grandparent (Section 2). Our structure differs from both mainly in the order in which it applies these moves when it brings a vertex to the root, and unlike the AM-tree it stores no sizes. Bringing a vertex to the root naively, by repeatedly rotating or skipping it, behaves like move-to-root in binary search trees [7] and takes linear time on simple inputs. We add two small repairs, in which the parent first moves one step up itself; they make the cost logarithmic without storing subtree sizes, and in our experiments, dropping either of them makes it linear again (Theorem 9). The analysis uses the potential ∑vlog⁡s(v)\sum_v \log s(v) of the AM-tree.

We also show that, for a connected graph with distinct costs, the structure acts as an implicit link-cut tree on the Kruskal reconstruction tree, the tree of merges performed by Kruskal's algorithm (Section 5). Every rotation is exactly one preferred-child change, which a link-cut tree performs by splaying an auxiliary tree.

In experiments (Section 7), our structure is 1.3–2.1 times faster on insertions than the folklore BottleneckTree, up to 480 times faster on its adversarial input, and 6.3–16 times faster than a link-cut tree. The lazy AM-tree variants are mostly faster than ours, by up to 2 times, when edges arrive in random order; when consecutive edges are close in the graph, ours is competitive, and on a band-shaped graph inserted in this order it is 1.1–1.6 times faster than both.

Outline. Sections 2 to 4 give the moves, the algorithm and its analysis, Section 5 the link-cut-tree view, Section 6 the lower bound, and Section 7 the experiments.