ArticleslgStudy

computer science

Havel–Hakimi algorithm

Havel–Hakimi algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Havel–Hakimi algorithm rather than just read about it. In short: 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?

Key takeaways

  • Havel–Hakimi algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Havel–Hakimi algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Havel–Hakimi algorithm from memory before moving on to harder problems.

Reference excerpt

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. The degree sequence is a list of numbers in nonincreasing order indicating the number of edges incident to each vertex in the graph. 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).

Algorithm The Havel–Hakimi algorithm is based on the following result. Theorem. Let A = ( s , t 1 , . . . , t s , d 1 , . . . , d n ) {\displaystyle A=(s,t_{1},...,t_{s},d_{1},...,d_{n})} be a finite list of nonnegative integers that is nonincreasing. Let A ′ = ( t 1 − 1 , . . . , t s − 1 , d 1 , . . . , d n ) {\displaystyle 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. List A {\displaystyle A} is graphic if and only if list A ′ {\displaystyle A'} is graphic. If the given list A {\displaystyle A} is graphic, then the theorem will be applied at most n − 1 {\displaystyle n-1} times setting in each further step A := A ′ {\displaystyle A:=A'} . Note that it can be necessary to sort this list again. This process ends when the whole list A ′ {\displaystyle A'} consists of zeros. Let G {\displaystyle G} be a simple graph with the degree sequence A {\displaystyle A} : Let the vertex S {\displaystyle S} have degree s {\displaystyle s} ; let the vertices T 1 , . . . , T s {\displaystyle T_{1},...,T_{s}} have respective degrees t 1 , . . . , t s {\displaystyle t_{1},...,t_{s}} ; let the vertices D 1 , . . . , D n {\displaystyle D_{1},...,D_{n}} have respective degrees d 1 , . . . , d n {\displaystyle d_{1},...,d_{n}} . In each step of the algorithm, one constructs the edges of a graph with vertices T 1 , . . . , T s {\displaystyle T_{1},...,T_{s}} —i.e., if it is possible to reduce the list A {\displaystyle A} to A ′ {\displaystyle A'} , then we add edges { S , T 1 } , { S , T 2 } , ⋯ , { S , T s } {\displaystyle \{S,T_{1}\},\{S,T_{2}\},\cdots ,\{S,T_{s}\}} . When the list A {\displaystyle A} cannot be reduced to a list A ′ {\displaystyle A'} of nonnegative integers in any step of this approach, the theorem proves that the list A {\displaystyle A} from the beginning is not graphic.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Havel–Hakimi algorithm

Start with the simplest possible case. Write down what Havel–Hakimi algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Havel–Hakimi algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Havel–Hakimi algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Havel–Hakimi algorithm

In research
Havel–Hakimi algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Havel–Hakimi algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Havel–Hakimi algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Graph algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Havel–Hakimi algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Havel–Hakimi algorithm” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Havel–Hakimi algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Havel–Hakimi algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Havel–Hakimi algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Havel–Hakimi algorithm in simple terms?

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?

Why does Havel–Hakimi algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Havel–Hakimi algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Havel–Hakimi algorithm.

Tags

  • Graph algorithms

Keep exploring