A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Link-Cut Trees

Research Depth 91 in the knowledge graph ☐ I know this ☆ Set as goal
520prerequisites beneath it
See this on the map →
Amortized AnalysisBinary Search Trees+2 more→
link-cut-trees splay-trees dynamic-trees sleator-tarjan path-decomposition dynamic-connectivity

Core Idea

Link-cut trees, introduced by Sleator and Tarjan (1983), maintain a forest of rooted trees under link (add an edge), cut (remove an edge), and path queries (find minimum/aggregate on root-to-node path), all in O(log n) amortized time. The data structure represents each tree as a collection of preferred paths (heavy paths chosen dynamically based on access patterns), each stored as a splay tree keyed by depth. The access operation splays a node to the root of its auxiliary tree and restructures preferred paths, making it the foundation for all other operations. Link-cut trees achieve O(m log n) total time for max-flow algorithms (by maintaining the residual tree structure) and are essential for dynamic graph algorithms, making them one of the most powerful data structures in advanced algorithm design.

Explainer

Link-cut trees solve the dynamic trees problem: maintain a forest of rooted trees under edge insertions (link), edge deletions (cut), and path queries (find the minimum or sum along the path from a node to its tree's root), all in O(log n) amortized time per operation. Sleator and Tarjan introduced them in 1983, building on their earlier invention of splay trees. The data structure is subtle but powerful, and its applications to network flow, dynamic connectivity, and dynamic graph algorithms make it one of the most important advanced data structures.

The key idea is path decomposition. Each tree in the represented forest is decomposed into preferred paths — vertex-disjoint paths covering all vertices, where each node has at most one preferred child. The preferred child of a node v is the child most recently accessed (in the subtree rooted at v). This means that after accessing a node, the entire root-to-node path becomes preferred, concentrating the data structure's representation on the most relevant path. Each preferred path is stored in an auxiliary splay tree, keyed by depth: an in-order traversal of the splay tree visits the nodes from shallowest (closest to root) to deepest. Non-preferred edges between paths are represented by path-parent pointers connecting the top of one auxiliary tree to its parent in the represented tree.

The access(v) operation is the core of the data structure. It makes v the root of its auxiliary splay tree and restructures preferred paths so that the entire root-to-v path becomes a single preferred path. This involves: (1) splaying v within its current auxiliary tree, (2) cutting the preferred path below v (detaching the right subtree in the auxiliary tree), (3) following the path-parent pointer to the parent auxiliary tree, splaying the relevant node there, and joining v's tree as the right child. This repeats until v's path reaches the root of the represented tree. Each step changes an O(1) number of preferred-child designations and performs a splay. The amortized cost of access is O(log n), proved using the same potential function as splay tree analysis: Phi = sum of log(subtree sizes) across all auxiliary trees.

All other operations reduce to access. Link(u, v) accesses u (making it the root of its auxiliary tree), then sets u's path-parent to v. Cut(v) accesses v, then detaches the left subtree in v's auxiliary tree (which contains the path from v's parent to the root). Find-root(v) accesses v, then walks to the leftmost node in the auxiliary tree (the shallowest, which is the root). Path queries (minimum, sum, update) are handled by augmenting the splay trees with subtree aggregates, identical to augmented BSTs.

The application to maximum flow is where link-cut trees have their greatest algorithmic impact. In Dinic's algorithm, each blocking flow phase pushes flow along paths from source to sink in a layered graph. Maintaining the current augmenting tree as a link-cut tree reduces per-path cost from O(n) to O(log n): find the bottleneck via path-minimum, update capacities via path-update, remove saturated edges via cut, and add new tree edges via link. This improvement, from O(mn) to O(m log n) per blocking flow phase, is significant for dense graphs and has theoretical implications for the best known max-flow running times. Beyond flow, link-cut trees are essential for dynamic connectivity, dynamic minimum spanning trees, and any problem where a forest evolves over time and path queries must be answered efficiently.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Conditional Statements → Defining and Calling Functions → Functions: Decomposing Problems → Function Parameters and Argument Passing → Return Values → Variable Scope → Introduction to Classes → Objects and Instances → Methods and Attributes → Algorithm Design Basics → Tree Structure and Node Properties → Binary Trees → Tree Traversals → Breadth-First Search (BFS) → Breadth-First Search: Implementation and Applications → Queue Applications: Level-Order Traversal and Breadth-First Search → Bipartite Graphs: Detection and Two-Coloring → Cycle Detection in Directed and Undirected Graphs → Maximum Flow: Network Flow Problems and Algorithms → Link-Cut Trees

Longest path: 92 steps · 520 total prerequisite topics

Prerequisites (4)

Leads To (0)

No topics depend on this one yet.