k-core of a graph 2026-10-18
For a nonnegative integer , the k-core of a graph is the unique maximum by set inclusion induced subgraph in which every degree of a vertex is at least , allowing the empty graph. Repeatedly delete vertices whose current degree of a vertex is less than . These induced subgraphs are nested: ; the case is the 2-core. In their 2003 preprint, Vladimir Batagelj and Matjaž Zaveršnik give an algorithm for the entire core decomposition, using degree buckets and constant-time position updates. Their general bound is ; the title's form applies to connected graphs with at least two vertices, where . [ref]
Leaf pruning for the 2-core 2026-10-18
Use adjacency lists and a FIFO queue to implement the deletion rule in time complexity . Compute each initial degree of a vertex once, mark every vertex alive, and put all vertices of degree of a vertex zero or one in the FIFO queue. Each vertex is inserted at most once. Repeatedly remove the front vertex , mark it dead, and traverse its original adjacency list. For each still-alive graph neighbour , decrease the stored degree of a vertex of by one; if it has just become one, append . A vertex already queued can drop from one to zero before its turn, but it stays queued and requires no second insertion. Stop when the FIFO queue is empty; the alive vertices induce .
For the displayed example, initially enqueue in that order. The successive FIFO queues, after each deletion and all its updates, areThis explains the delayed deletion of : its initial degree of a vertex was three, but the relevant degree of a vertex is always its current one in the surviving induced subgraph. Removing only the original vertices of degree of a vertex one would give the wrong answer.
Initialization inspects every vertex and every adjacency list entry once. During deletion each original adjacency list is traversed at most once, so at most entries are inspected in an undirected graph. All insertions, removals and stored-degree updates cost constant time each. Thus total time complexity is and additional storage, beyond the adjacency lists, is . The cost includes isolated vertices; repeatedly rescanning the whole surviving graph after each deletion would lose this bound. The single-threshold FIFO queue method is enough for the 2-core; the full k-core of a graph decomposition computes all thresholds.