Full Graph Generation tree

Source: Internet
Author: User
Classic proof: Pr ü fer encoding and the Cayley formula (converted to matrix67)


The Cayley formula is that a complete graph K_n has n ^ (n-2) trees, in other words, N ^ (n-2) trees with labels of N nodes. Today, I learned a very simple proof of the Cayley formula, proving that it relies on the pr ü fer encoding, which is a method of coding with a labeled roottree.
Given a non-root tree with a label, find the leaf node with the smallest number, write down the number of the node adjacent to it, and then delete the leaf node. Perform this operation repeatedly until there are only two nodes left. Because the number of nodes N> 2 of the tree has a leaf node, the rootless tree of N nodes corresponds to a series of N-2 length, each number in a series is within the range of 1 to n. Below we only need to explain, any length of N-2, the value range between 1 to n series are unique corresponds to a n node of rootless tree, in this way, the no-root tree with a label forms a corresponding relationship with the pr ü fer encoding, And the Cayley formula is self-evident.

Note that if a node A is not a leaf node, it has at least two edges. However, after the above process, the entire graph has only one edge, therefore, at least one adjacent node of node A has been removed. The number of node A will appear in the pr ü fer code corresponding to this tree. In turn, the numbers that appear in the prüfer encoding are obviously not the leaves of this tree (at the beginning. So we can see that the numbers that have not appeared in the prüfer encoding are exactly the leaf nodes of this tree (at the beginning. Find the smallest one (for example, ④) in the number that has not been seen. It is the leaf adjacent to the node (for example, ③) identified by the first number in the pr ü fer code. Next, we recursively consider the next n-3 bit encoding (don't forget the total length of the encoding is N-2): Find out the minimum not in the rear n-3 bit encoding except ④
(7 in the example on the left), connect it to the node corresponding to the 2nd number of codes (3 in the example ). Next, find out the smallest number of non-contained n-4 bit encoding except 4 and 7, do the same processing ...... In turn, connect ③ ② ⑤ 6 to the node represented by 3rd, 4, 5, 6, and 7 characters in the code. Finally, we still have 1. We haven't processed the token. Just connect them directly. Since the total number of nodes that have not been processed is 2 longer than the remaining encoding length, we can always find a minimum number that does not appear in the remaining encoding,AlgorithmAlways proceed. In this way, any prüfer Code corresponds to a rootless tree, and the number of N-2 bit prüfer encoding has a number of rootless trees.

An interesting promotion is that the degree of N nodes is D1, D2,..., DN's rootless tree total (n-2 )! /[(D1-1 )! (D2-1 )!.. Dn-1 )! Because the number I in the prüfer encoding happens to appear Di-1 times.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.