Concepts9

βš™οΈAlgorithmIntermediate

Functional Graph

A functional graph is a directed graph where every node has exactly one outgoing edge, so repeatedly following edges from any start eventually loops into a cycle.

#functional graph#successor graph#cycle detection+10
βš™οΈAlgorithmAdvanced

Block-Cut Tree

A Block-Cut Tree decomposes an undirected graph into biconnected components (blocks) and articulation points, forming a bipartite tree.

#block-cut tree#biconnected components#articulation points+11
βš™οΈAlgorithmAdvanced

Virtual Tree (Auxiliary Tree)

A Virtual Tree (Auxiliary Tree) compresses a large tree into a much smaller tree that contains only the k important nodes and the LCAs needed to keep them connected.

#virtual tree#auxiliary tree#lca+12
βš™οΈAlgorithmIntermediate

LCA - Binary Lifting

Binary lifting precomputes 2^k ancestors for every node so we can jump upward in powers of two.

#lca#binary lifting#tree+12
βš™οΈAlgorithmIntermediate

Bridge Tree

A bridge tree is built by contracting every 2-edge-connected component of an undirected graph into a single node, leaving only bridges as edges between nodes.

#bridge tree#2-edge-connected components#bridges+12
βš™οΈAlgorithmIntermediate

Tree Distances and Diameter

Tree diameter is the longest simple path in a tree and can be found with two BFS/DFS runs.

#tree diameter#tree center#eccentricity+12
βš™οΈAlgorithmIntermediate

Lowest Common Ancestor (LCA)

The Lowest Common Ancestor (LCA) of two nodes in a rooted tree is the deepest node that is an ancestor of both.

#lowest common ancestor#binary lifting#euler tour+12
βš™οΈAlgorithmIntermediate

Minimum Spanning Tree - Kruskal

Kruskal’s algorithm builds a minimum spanning tree (MST) by sorting all edges by weight and greedily picking the next lightest edge that does not form a cycle.

#kruskal#minimum spanning tree#mst+11
πŸ—‚οΈData StructureAdvanced

Centroid Decomposition

Centroid decomposition splits a tree around a special node (centroid) so that every remaining component has at most half the nodes.

#centroid decomposition#centroid tree#tree algorithms+11