Havel–Hakimi algorithm
![]() | This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. (June 2020) |
The Havel–Hakimi algorithm is an algorithm in graph theory solving the graph realization problem. 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? A simple graph contains no double edges or loops.[1] The degree sequence is a list of numbers in nonincreasing order indicating the number of edges incident to each vertex in the graph.[2] If a simple graph exists for exactly the given degree sequence, the list of integers is called graphic. 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. This construction is based on a recursive algorithm. The algorithm was published by Havel (1955), and later by Hakimi (1962).
The algorithm
The Havel-Hakimi algorithm is based on the following theorem.
Let be a finite list of nonnegative integers that is nonincreasing. List is graphic if and only if the finite list has nonnegative integers and is graphic.
If the given list is graphic then the theorem will be applied at most times setting in each further step . Note that it can be necessary to sort this list again. This process ends when the whole list consists of zeros. In each step of the algorithm one constructs the edges of a graph with vertices , i.e. if it is possible to reduce the list to , then we add edges . When the list cannot be reduced to a list of nonnegative integers in any step of this approach, the theorem proves that the list from the beginning is not graphic.
The time complexity of the algorithm is .
See also
Notes
- ^ From Shahriari (2022, p. 48): "Definition 2.17 (Graphs & Subgraphs). A simple graph (or just a graph) G is a pair of sets (V, E) where V is a nonempty set called the set of vertices of G, and E is a (possibly empty) set of unordered pairs of distinct elements of V. The set E is called the set of edges of G. If the number of vertices of G is finite, then G is a finite graph (or a finite simple graph)."
- ^ From Shahriari (2022, p. 355): "Definition 10.6 (The degree sequence of a graph; Graphic sequences). The degree sequence of a graph is the list of the degrees of its vertices in non-increasing order. A non-increasing sequence of non-negative integers is called graphic, if there exists a simple graph whose degree sequence is precisely that sequence.”
References
- Havel, Václav (1955), "A remark on the existence of finite graphs", Časopis pro pěstování matematiky (in Czech), 80: 477–480
- Hakimi, S. L. (1962), "On realizability of a set of integers as degrees of the vertices of a linear graph. I", Journal of the Society for Industrial and Applied Mathematics, 10: 496–506, MR 0148049.
- Shahriari, Shahriar (2022), Invitation to Combinatorics, Cambridge U. Press.
- West, Douglas B. (2001). Introduction to graph theory. Second Edition. Prentice Hall, 2001. 45-46.