Graph algorithm--a direction-free graph (DAG)

Source: Internet
Author: User

In the compiler, after lexical analysis and grammar analysis, the syntax tree is generated, and in the further processing of the syntax tree, a data structure called a "direction-free graph" is used.

What is a forward-free loop diagram

1, first it is a graph, and then it is a direction graph, followed by any vertex of this direction graph does not go back to the path of this vertex, is to have to the ring-free

2,dag may not necessarily translate into trees, but a tree must be a dag,

3,dag can perform topological sorting, related to topological ordering, and refer to another article blog:http://blog.csdn.net/yejing_utopia/article/details/40681191


How to judge a graph as having a direction without ring:

Because Dag can perform topological sorting, it is possible to use topological sort-related algorithms to push a graph to see if it is dag.

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.