Topological sorting problems

Source: Internet
Author: User

Topological sorting problems

1. The minimum spanning tree and the terminal path belong to the graph application with loops. Topological sequencing and critical paths are non-ring graph applications. No loop, that is, there is no loop in the figure.

2. Topology sort description: In a forward diagram that represents project. Using vertices to represent activities and arcs to represent the priority relationship between activities , this kind of graph is called the AOV network, which we call the activity on Vertex networks.

The arc in the AOV network indicates that there is some kind of restrictive relationship between the activities. For example, with actors and venues, talent enough to enter the shooting.

In addition, the AOV network can not exist in the loop , so that the beginning of an activity with its own completion as a prerequisite. Obviously, it's not possible.

3. Set g= (v,e) is a direction graph with n vertices, the vertex sequence in V is V1,v2,..... vn, satisfies a path from Vertex VI to VJ. is in the vertex sequence. VI must be out now before VJ. We call this a sequence of vertices as a sequence of topologies (one AOV network may have more than one topological sequence).

The so-called topological sort. In fact, it is the process of constructing a topological sequence of a graph.

Construction will have two results. Assuming that all the vertices of this network are output, it is a AOV network that does not exist in the loop (loop). Assuming that the output of the vertex is less, even one less, it also indicates that the network exists ring (loop). Not a AOV net. A AOV network that does not have a loop can be used in a variety of project or project flowcharts to meet the needs of a variety of application scenarios.

4. The basic idea of the topological sorting algorithm: from the AOV network, select a vertex output with a degree of 0, and then delete the vertex. and delete the arc at the end of the vertex, continue this step until all vertices are output or no vertices in the AOV network exist with a 0 (presence ring). The shortest path and minimum spanning tree use the adjacency matrix to store the graph, but because the topological sort needs to delete vertices, it is obviously more convenient to use adjacency tables. The time complexity of the algorithm is O (n+e).

n is the number of vertices. E is the number of edges.

Topological sorting problems

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.