Big talk data structure 20: Diagram of the memory structure of the cross linked list

Source: Internet
Author: User
Tags header

1. Introduction:

For a forward graph, the adjacency table is flawed:

adjacency table: Care about the problem, want to understand the degree must traverse the entire map to know.

Inverse adjacency table: Solve the degree of penetration, but do not understand the degree of the situation.

Can we combine the adjacency table and the inverse adjacency table? The answer is: Use a cross linked list.

2. Cross-linked list storage structure:

Vertex table node Structure:

Firstin: Represents a header pointer to the edge, pointing to the first node in the table in the edge of the vertex.

Firstout: Represents the Edge header pointer, pointing to the first node in the edge table of the vertex.

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

BENZI node Structure:

Tailvex: Refers to the beginning of the arc in the vertex table subscript.

Headvex: Refers to the end of the arc in the vertex table subscript.

Headlink: Refers to the side table pointer field.

Taillink: Refers to the side table pointer field.

If it is a network, you can also add a weight field to store the weight value.

The Blue line shows the degree, the red lines represent the degree

3. The advantages of cross-linked list:

1.) Cross-linked list is the adjacency table and the inverse of the adjacency table together, so that it is easy to find the tail of the arc, but also easy to find a VI as the head of the arc,

Thus the degree and degree of vertex that are easily obtained.

2.) The time complexity of the cross list creation graph algorithm and the adjacency table are the same.

Author: csdn Blog zdp072

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.