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