logo

Havel-Hakimi Algorithm Proof 📂Graph Theory

Havel-Hakimi Algorithm Proof

Theorem

Let’s assume we are given a non-increasing sequence D=(d1,,dn)D = (d_{1} , \cdots , d_{n}). If DD is graphic, we can find a realization GG of DD using the following method:

  • Step 1.
    Create a null graph with nn vertices v1,,vnv_{1} , \cdots , v_{n}.
  • Step 2. k=1,,nk = 1, \cdots , n
    • Step 2-1.
      Connect vkv_{k} to vk+1,,vdk+1v_{k+1} , \cdots , v_{d_{k} + 1}.
    • Step 2-2.
      Decrease dk+1,,ddk+1d_{k+1} , \cdots , d_{d_{k}+1} by 11.
    • Step 2-3.
      Substitute as dk0d_{k} \gets 0. Repeat Step 2. until it becomes D=(0,,0)D = (0,\cdots , 0).

If DD is graphic, there exists a realization GG where a vertex v1v_{1} with degree d1d_{1} is adjacent to v2,,vd1+1v_{2} , \cdots , v_{d_{1} + 1}.

Description

The Havel-Hakimi algorithm is an algorithm that concretely finds a realization guaranteed by the existence of the Erdős-Gallai theorem. Its principle is simply to handle the vertex with the highest degree first to ensure no small remainders. By providing degrees first, it can directly be used to construct graphs with degree distributions in random graphs.

20200319\_004730.png For example, with a sequence such as (5,5,5,3,2,2,1,1)(5,5,5,3,2,2,1,1), the realization obtained through the Havel-Hakimi algorithm would look like the one above. If time allows, it is recommended to try creating graphic sequences using the Erdős-Gallai theorem and find realizations manually without the Havel-Hakimi algorithm to see its usefulness.

Proof

Every time DD is updated, the maximum degree gradually decreases. It suffices for the node vkv_{k} with the maximum degree to be adjacent to vk+1,,vdk+1v_{k+1} , \cdots , v_{d_{k} + 1} at each step, and showing that the first vertex v1v_{1} with degree d1d_{1} is adjacent to v2,,vd1+1v_{2} , \cdots , v_{d_{1} + 1} completes the proof by mathematical induction.

Assuming that the vertices of any realization RR of DD satisfy deg(vi)=di\deg (v_{i}) = d_{i}, let’s define the following two sets. TR:={v2,,vd1+1}NR(v1):={vV(R):vv1E(R)} T_{R} := \left\{ v_{2} , \cdots , v_{d_{1} + 1} \right\} \\ N_{R}(v_{1}) := \left\{ v \in V(R) : vv_{1} \in E(R) \right\} In the definition, TRT_{R} is the set collecting vertices after v1v_{1} and within the next d1d_{1}, and NR(v1)N_{R}(v_{1}) is the neighborhood of v1v_{1}, i.e., the set of vertices actually adjacent to v1v_{1} in RR. Let’s consider the following integer tRt_{R}. tR:=NR(v1)TR t_{R} := \left| N_{R} (v_{1}) \cap T_{R} \right| Now, it must be shown that GG is the realization of DD that maximizes tGt_{G}. In other words, it satisfies TG=NG(v1)T_{G} = N_{G}(v_{1}) and tG=d1t_{G} = d_{1}, meaning that the vertex v1v_{1} with degree d1d_{1} is adjacent to v2,,vd1+1v_{2} , \cdots , v_{d_{1} + 1}. If tG=d1t_{G} = d_{1}, TG=NG(v1)T_{G} = N_{G}(v_{1}) naturally follows, making GG the realization that maximizes tGt_{G} without further proof. Now, assuming the case of tG<d1t_{G} < d_{1}, if another realization GG' of DD exists that makes tG=tG+1t_{G'} = t_{G} + 120200321\_150533.png

In the case of tG<d1t_{G'}<d_{1}, v1v_{1} must be adjacent to some vyTGcv_{y} \in T_{G'}^{c} instead of any vxTGv_{x} \in T_{G'}. The red dotted line in the above figure represents the edge that exists in GG but is removed in GG', and the red solid line is the newly created edge because the degree of v1v_{1} must remain constant.

20200321\_150546.png

Just as with v1v_{1}, the degrees of vxv_{x} and vyv_{y} must be maintained, so one must choose one vzv_{z}, which originally was not adjacent to vxv_{x} but was to vyv_{y} in GG, add vxvzv_{x} v_{z}, and remove vyvzv_{y} v_{z}. This way, the original degree sequence DD does not change at all, and GG' can be considered a realization of DD. However, since GG' misses one vxv_{x} from TGT_{G'} and adds one vyv_{y} to NG(v1)N_{G'}(v_{1}), tGt_{G'} actually becomes smaller than tGt_{G}. This contradicts the existence of the realization GG' that satisfies tG=tG+1t_{G'} = t_{G} + 1, thereby necessitating tG=d1t_{G} = d_{1}. In other words, the vertex v1v_{1} in realization GG is adjacent to v2,,vd1+1v_{2} , \cdots , v_{d_{1} + 1}.