ArticleslgStudy

science

Prüfer sequence

Prüfer sequence is a 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 Prüfer sequence rather than just read about it. In short: In combinatorial mathematics, the Prüfer sequence (also Prüfer code or Prüfer numbers) of a labeled tree is a unique sequence associated with the tree. The sequence for a tree on n vertices has length n − 2, and can be generated by a simple iterative algorithm.

Prüfer sequence — main illustration
Prüfer sequence — illustration

Key takeaways

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

Reference excerpt

In combinatorial mathematics, the Prüfer sequence (also Prüfer code or Prüfer numbers) of a labeled tree is a unique sequence associated with the tree. The sequence for a tree on n vertices has length n − 2, and can be generated by a simple iterative algorithm. Prüfer sequences were first used by Heinz Prüfer to prove Cayley's formula in 1918.

Algorithm to convert a tree into a Prüfer sequence One can generate a labeled tree's Prüfer sequence by iteratively removing vertices from the tree until only two vertices remain. Specifically, consider a labeled tree T with vertices {1, 2, ..., n}. At step i, remove the leaf with the smallest label and set the i-th element of the Prüfer sequence to be the label of this leaf's neighbour. The Prüfer sequence of a labeled tree is unique and has length n − 2. Both coding and decoding can be reduced to integer radix sorting and parallelized.

Example

Consider the above algorithm run on the tree shown to the right. Initially, vertex 1 is the leaf with the smallest label, so it is removed first and 4 is put in the Prüfer sequence. Vertices 2 and 3 are removed next, so 4 is added twice more. Vertex 4 is now a leaf and has the smallest label, so it is removed and we append 5 to the sequence. We are left with only two vertices, so we stop. The tree's sequence is [4,4,4,5].

Algorithm to convert a Prüfer sequence into a tree Let [a[1], a[2], ..., a[n]] be a Prüfer sequence: The tree will have n+2 nodes, numbered from 1 to n+2. For each node set its degree to the number of times it appears in the sequence plus 1. For instance, in pseudo-code:

Convert-Prüfer-to-Tree(a) 1 n ← length[a] 2 T ← a graph with n + 2 isolated nodes, numbered 1 to n + 2 3 degree ← an array of integers 4 for each node i in T do 5 degree[i] ← 1 6 for each value i in a do 7 degree[i] ← degree[i] + 1

Next, for each number in the sequence a[i], find the first (lowest-numbered) node, j, with degree equal to 1, add the edge (j, a[i]) to the tree, and decrement the degrees of j and a[i]. In pseudo-code:

8 for each value i in a do 9 for each node j in T do 10 if degree[j] = 1 then 11 Insert edge[i, j] into T 12 degree[i] ← degree[i] - 1 13 degree[j] ← degree[j] - 1 14 break

At the end of this loop two nodes with degree 1 will remain (call them u, v). Lastly, add the edge (u,v) to the tree.

15 u ← v ← 0 16 for each node i in T 17 if degree[i] = 1 then 18 if u = 0 then 19 u ← i 20 else 21 v ← i 22 break 23 Insert edge[u, v] into T 24 degree[u] ← degree[u] - 1 25 degree[v] ← degree[v] - 1 26 return T

Cayley's formula The Prüfer sequence of a labeled tree on n vertices is a unique sequence of length n − 2 on the labels 1 to n. For a given sequence S of length n − 2 on the labels 1 to n, there is a unique labeled tree whose Prüfer sequence is S. The immediate consequence is that Prüfer sequences provide a bijection between the set of labeled trees on n vertices and the set of sequences of length n − 2 on the labels 1 to n. The latter set has size nn−2, so the existence of this bijection proves Cayley's formula, i.e. that there are nn−2 labeled trees on n vertices.

Other applications Source:

Cayley's formula can be strengthened to prove the following claim: The number of spanning trees in a complete graph K n {\displaystyle K_{n}} with a degree d i {\displaystyle d_{i}} specified for each vertex i {\displaystyle i} is equal to the multinomial coefficient

( n − 2 d 1 − 1 , d 2 − 1 , … , d n − 1 ) = ( n − 2 ) ! ( d 1 − 1 ) ! ( d 2 − 1 ) ! ⋯ ( d n − 1 ) ! . {\displaystyle {\binom {n-2}{d_{1}-1,\,d_{2}-1,\,\dots ,\,d_{n}-1}}={\frac {(n-2)!}{(d_{1}-1)!(d_{2}-1)!\cdots (d_{n}-1)!}}.}

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Prüfer sequence

Start with the simplest possible case. Write down what Prüfer sequence claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 Prüfer sequence 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 Prüfer sequence 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 Prüfer sequence

In research
Prüfer sequence appears in 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 Prüfer sequence 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
Prüfer sequence is common in secondary-school and first-year university syllabi. It links to neighbouring topics Enumerative combinatorics, Trees (graph theory), so understanding it makes those chapters shorter.
In everyday life
Look for Prüfer sequence 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 “Prüfer sequence” →

Affiliate

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

How to study Prüfer sequence in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Prüfer sequence 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 Prüfer sequence out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Prüfer sequence in simple terms?

In combinatorial mathematics, the Prüfer sequence (also Prüfer code or Prüfer numbers) of a labeled tree is a unique sequence associated with the tree. The sequence for a tree on n vertices has length n − 2, and can be generated by a simple iterative algorithm.

Why does Prüfer sequence matter?

Because it connects several 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 Prüfer sequence?

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 Prüfer sequence.

Tags

  • Enumerative combinatorics
  • Trees (graph theory)

Keep exploring