Graph Theory (I) degree sequence and Havel-Hakimi Theorem

Source: Internet
Author: User

 

I have always wanted to write some ideas about graph theory learning. It has never been started for one reason or another. In any case, start now! So what is a graph? The figure we are talking about here is certainly not just like a picture. The most authoritative definition: Graph = vertex set + edge set. In other words, everything that can be abstracted into a set of points and an edge set is a graph. For example, map of China. The city on the map is a point, and there is a road between any two adjacent cities. A map is a very intuitive graph. To facilitate expression, we have introduced English words. Vertext (vertex), Edge (Edge), Graph ). You can use G <V, E> to represent any graph. A map is a map, and the seven water networks in China are also a map. Many lakes can be seen as vertices, while the Yangtze River and the Yellow River can be seen as edges. Because the flow of water is basically one-way (of course there is also a back-flow situation, we will ignore it here), so, like this: A directed graph is called a directed graph. The Yangtze River water flows only from the Himalayas to the East China Sea, but it never returns. If the edge has no direction, it is of course called an undirected graph. Let's go back to the map. All said things about great roads to Beijing. You said Rome is true.) How many roads are there in Beijing? In graph theory, the number of edges connected to a point, such as the number of edges connected to Beijing, is called degree! For all vertices in a graph, we can calculate the degree of each vertex. A string of numbers like this is called a degree sequence. In turn, can we determine if a sequence is sequential? Here is a theorem: Havel-Hakimi can be used to determine whether a sequence is complete. Poj1659 is solved by Havel-Hakimi.

The content of Havel-Hakimi theorem can be Baidu. Havel-Hakimi theorem is easy to understand: three steps: for example, sequence: 4 7 7 3 3 3 2 1

Subscript 1 2 3 4 5 6 7 8
Value 4 7 7 3 3 3 2 1

Step 1: sort the sequence in descending order.

Subscript 1 2 3 4 5 6 7 8
Value 7 7 4 3 3 3 2 1

Step 2: Delete the first number 7. Sequence Conversion

Subscript 1 2 3 4 5 6 7
Value 7 4 3 3 3 2 1

Step 3: start from scratch, number 7, I .e. Subscript: [1, 7], reduce the values in the [1, 7] range by 1 because the first number has been deleted, then the sequence becomes like this:

Subscript 1 2 3 4 5 6 7
Value 6 3 2 2 2 1 0

Then, repeat the first step: sort. Repeat Step 2: delete number 1 6 repeat Step 3: Number 6 from scratch: that is, subscript 1, 6], delete the number in range 1, 6. Sequence:

Subscript 1 2 3 4 5 6
Value 2 1 1 1 0 -1

Because-1 already exists, and the number of edges of a vertex) cannot be negative. Therefore, we can determine that a sequence cannot constitute a graph, so this sequence cannot be a graph. Here is another example: sorted:

5 4 3 3 2 2 2 1 1 1.

Delete the first number 5:

4 3 3 2 2 2 1 1 1.

Subtract 1 from the first five:

3 2 2 1 1 2 1 1 1.

Sort:

3 2 2 2 1 1 1 1 1.

Delete the first number 3:

2 2 2 1 1 1 1 1.

Subtract 1 from the first three:

1 1 1 1 1 1 1 1.

Sort:

1 1 1 1 1 1 1 1.

Delete the first number 1:

1 1 1 1 1 1 1.

Reduce the number of the first 1 to 1:

0 1 1 1 1 1 1.

Sort:

1 1 1 1 1 1 0

Delete the first number 1:

1 1 1 1 1 0

Reduce the number of the first 1 to 1:

0 1 1 1 1 0

Sort:

1 1 1 1 0 0

So far, there are only:

0 0 0 0

It is determined that the sequence is sequential.

This article from the "every day progress a little" blog, please be sure to keep this source http://sbp810050504.blog.51cto.com/2799422/883904

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.