Havel–Hakimi algorithm
The Havel–Hakimi algorithm is an algorithm in graph theory solving the graph realization problem.[src] That is, it answers the following question: Given a finite list of nonnegative integers in non-increasing order, is there a simple graph such that its degree sequence is exactly this list?[src] A simple graph contains no double edges or loops.[src] The degree sequence is a list of numbers in nonincreasing order indicating the number of edges incident to each vertex in the graph.[src] If a simple graph exists for exactly the given degree sequence, the list of integers is called graphic.[src] The Havel–Hakimi algorithm constructs a special solution if a simple graph for the given degree sequence exists, or proves that one cannot find a positive answer.[src] This construction is based on a recursive algorithm.[src] The algorithm was published by , and later by .[src]
The Havel–Hakimi algorithm is an algorithm in graph theory solving the graph realization problem.[src] That is, it answers the following question: Given a finite list of nonnegative integers in non-increasing order, is there a simple graph such that its degree sequence is exactly this list?[src] A simple graph contains no double edges or loops.[src] The degree sequence is a list of numbers in nonincreasing order indicating the number of edges incident to each vertex in the graph.[src] If a simple graph exists for exactly the given degree sequence, the list of integers is called graphic.[src] The Havel–Hakimi algorithm constructs a special solution if a simple graph for the given degree sequence exists, or proves that one cannot find a positive answer.[src] This construction is based on a recursive algorithm.[src] The algorithm was published by , and later by .[src] ==Algorithm== The Havel–Hakimi algorithm is based on the following result.[src] Theorem.[src] Let A = (s, t_{1},..., t_{s}, d_{1},..., d_{n}) be a finite list of nonnegative integers that is nonincreasing.[src] Let A' = (t_{1}-1,..., t_{s}-1, d_{1},..., d_{n}) be a second finite list of nonnegative integers that is rearranged to be nonincreasing.[src] List A is graphic if and only if list A' is graphic.[src] If the given list A is graphic, then the theorem will be applied at most n-1 times setting in each further step A:=A' .[src] Note that it can be necessary to sort this list again.[src] This process ends when the whole list A' consists of zeros.[src] Let G be a simple graph with the degree sequence A : Let the vertex S have degree s ; let the vertices T_{1},..., T_{s} have respective degrees t_{1},..., t_{s} ; let the vertices D_{1},..., D_{n} have respective degrees d_{1},..., d_{n} .[src] In each step of the algorithm, one constructs the edges of a graph with vertices T_{1},..., T_{s} —i.e., if it is possible to reduce the list A to A' , then we add edges \{S,T_1\},\{S,T_2\},\cdots,\{S,T_{s}\} .[src] When the list A cannot be reduced to a list A' of nonnegative integers in any step of this approach, the theorem proves that the list A from the beginning is not graphic.[src] To prove the Havel–Hakimi algorithm always works, assume that A' is graphic, and there exists a simple graph G' with the degree sequence A' = (t_{1}-1,..., t_{s}-1, d_{1},..., d_{n}) .[src] Then we add a new vertex v adjacent to the s vertices with degrees t_{1}-1,..., t_{s}-1 to obtain the degree sequence A .[src] To prove the other direction, assume that A is graphic, and there exists a simple graph G with the degree sequence A = (s, t_{1},..., t_{s}, d_{1},..., d_{n}) and vertices S, T_{1},..., T_{s}, D_{1},..., D_{n} .[src] We do not know which s vertices are adjacent to S , so we have two possible cases.[src] In the first case, S is adjacent to the vertices T_{1},..., T_{s} in G .[src] In this case, we remove S with all its incident edges to obtain the degree sequence A' .[src] In the second case, S is not adjacent to some vertex T_{i} for some 1 \leq i \leq s in G .[src] Then we can change the graph G so that S is adjacent to T_{i} while maintaining the same degree sequence A .[src] Since S has degree s , the vertex S must be adjacent to some vertex D_{j} in G for 1 \leq j \leq n : Let the degree of D_{j} be d_{j} .[src] We know t_i \geq d_j , as the degree sequence A is in non-increasing order.[src] Since t_i \geq d_j , we have two possibilities: Either t_i = d_j , or t_i > d_j .[src] If t_i = d_j , then by switching the places of the vertices T_{i} and D_{j} , we can adjust G so that S is adjacent to T_{i} instead of D_{j}.[src] If t_i > d_j , then since T_{i} is adjacent to more vertices than D_{j} , let another vertex W be adjacent to T_{i} and not D_{j} .[src] Then we can adjust G by removing the edges \left \{ S, D_j \right \} and \left \{ T_i, W \right \} , and adding the edges \left \{ S, T_i \right \} and \left \{ W, D_j\right \} .[src] This modification preserves the degree sequence of G , but the vertex S is now adjacent to T_{i} instead of D_{j} .[src] In this way, any vertex not connected to S can be adjusted accordingly so that S is adjacent to T_{i} while maintaining the original degree sequence A of G .[src] Thus any vertex not connected to S can be connected to S using the above method, and then we have the first case once more, through which we can obtain the degree sequence A' .[src] Hence, A is graphic if and only if A' is also graphic.[src] ==See also== Erdős–Gallai theorem ==References== .[src] West, Douglas B.[src] (2001).[src] Introduction to graph theory.[src] Second Edition.[src] Prentice Hall, 2001.[src] 45–46.[src]
52 sentences · 52 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Havel–Hakimi algorithm." encyclopegia.org, 2026, https://encyclopegia.org/wiki/havel-hakimi-algorithm. Accessed 28 November 2026.
Chicago
"Havel–Hakimi algorithm." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/havel-hakimi-algorithm.
APA
encyclopegia.org. (2026). Havel–Hakimi algorithm. Retrieved November 28, 2026, from https://encyclopegia.org/wiki/havel-hakimi-algorithm
Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON