encyclopegia.org

Prüfer sequence

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.[src] The sequence for a tree on vertices has length , and can be generated by a simple iterative algorithm.[src] Prüfer sequences were first used by Heinz Prüfer to prove Cayley's formula in 1918.[src]

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.[src] The sequence for a tree on vertices has length , and can be generated by a simple iterative algorithm.[src] Prüfer sequences were first used by Heinz Prüfer to prove Cayley's formula in 1918.[src] ==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.[src] Specifically, consider a labeled tree with vertices .[src] At step , remove the leaf with the smallest label and set the -th element of the Prüfer sequence to be the label of this leaf's neighbour.[src] The Prüfer sequence of a labeled tree is unique and has length .[src] Both coding and decoding can be reduced to integer radix sorting and parallelized.[src] ===Example=== [[File:Tree graph.svg|right|frame|A labeled tree with Prüfer sequence [4,4,4,5].]] Consider the above algorithm run on the tree shown to the right.[src] Initially, vertex 1 is the leaf with the smallest label, so it is removed first and 4 is put in the Prüfer sequence.[src] Vertices 2 and 3 are removed next, so 4 is added twice more.[src] Vertex 4 is now a leaf and has the smallest label, so it is removed and we append 5 to the sequence.[src] We are left with only two vertices, so we stop.[src] The tree's sequence is [4,4,4,5].[src] ==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 .[src] For each node set its degree to the number of times it appears in the sequence plus 1.[src] For instance, in pseudo-code: Convert-Prüfer-to-Tree( ) 1 ← length[ ] 2 ← a graph with + 2 isolated nodes, numbered 1 to + 2 3 degree ← an array of integers 4 for each node in do 5 degree[ ] ← 1 6 for each value in do 7 degree[ ] ← degree[ ] + 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] .[src] In pseudo-code: 8 for each value in do 9 for each node in do 10 if degree[ ] = 1 then 11 Insert edge[ , ] into 12 degree[ ] ← degree[ ] - 1 13 degree[ ] ← degree[ ] - 1 14 break At the end of this loop two nodes with degree 1 will remain (call them u , v ).[src] Lastly, add the edge (u,v) to the tree.[src] 15 ← ← 0 16 for each node in 17 if degree[ ] = 1 then 18 if = 0 then 19 ← 20 else 21 ← 22 break 23 Insert edge[ , ] into 24 degree[ ] ← degree[ ] - 1 25 degree[ ] ← degree[ ] - 1 26 return ==Cayley's formula== The Prüfer sequence of a labeled tree on vertices is a unique sequence of length on the labels 1 to  .[src] For a given sequence of length on the labels 1 to  , there is a unique labeled tree whose Prüfer sequence is  .[src] The immediate consequence is that Prüfer sequences provide a bijection between the set of labeled trees on vertices and the set of sequences of length on the labels 1 to .[src] The latter set has size , so the existence of this bijection proves Cayley's formula, i.e.[src] that there are labeled trees on vertices.[src] ==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 with a degree d_i specified for each vertex i is equal to the multinomial coefficient \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)!}.[src] The proof follows by observing that in the Prüfer sequence number i appears exactly d_i-1 times.[src] Cayley's formula can be generalized: a labeled tree is in fact a spanning tree of the labeled complete graph.[src] By placing restrictions on the enumerated Prüfer sequences, similar methods can give the number of spanning trees of a complete bipartite graph.[src] If is the complete bipartite graph with vertices 1 to in one partition and vertices to in the other partition, the number of labeled spanning trees of is n_1^{n_2-1} n_2^{n_1-1} , where .[src] Generating uniformly distributed random Prüfer sequences and converting them into the corresponding trees is a straightforward method of generating uniformly distributed random labelled trees.[src] ==References== ==External links== Prüfer code – from MathWorld[src]

34 sentences · 34 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Prüfer sequence." encyclopegia.org, 2026, https://encyclopegia.org/wiki/pr-fer-sequence. Accessed 25 November 2026.

Chicago

"Prüfer sequence." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/pr-fer-sequence.

APA

encyclopegia.org. (2026). Prüfer sequence. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/pr-fer-sequence

Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

sequence

stub · references available

Just in sequence

stub · references available

sonnet sequence

stub · references available

Sequence

stub · references available

adenoma-carcinoma sequence

stub · references available

PR Newswire

stub · references available

Golomb sequence

stub · references available

Chemin de fer de l'État de Genève

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1348527574 · 0.5 · snapshot enwiki-001348527574

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.