Minimum spanning tree, shortest path, topological sorting, critical path

1. Minimum spanning tree

Prim's algorithm and Kruskal's algorithm are two algorithms that use the properties of MST to construct a minimum spanning tree.

1. Primm's algorithm ("addition method")

Insert picture description here

2. Kruskal's algorithm

Insert picture description here

2. The shortest path

1. Dijkstra's algorithm

(The distance from a certain source point to the other vertices) The
time complexity is O(n^2)
Insert picture description here
Insert picture description here

2. Freud's algorithm

(The shortest path between each pair of vertices) The
time complexity is O(n^3)

Three, topological sort

1. AOV-net A
graph that uses vertices to represent activities and arcs to indicate the priority relationship between activities is called a vertex-representing activity network, abbreviated as AOV-net .
Note:
(1) In AOV-net, there should be no directed ring;
(2) The method to detect whether there is a directed ring is to perform topological sorting on the vertices of the directed graph;
2. Topological sorting
concept: the
so-called topological sorting That is to arrange all vertices in the AOV-net into a linear sequence, which satisfies: if there is only one path from vertex Vi to vertex Vj in the AOV-net, then vertex Vi must be before vertex Vj in the linear sequence.
Process:
(1) Select a vertex without a precursor in the directed graph and output it;
(2) Delete the vertex and all arcs ending with it from the graph;
(3) Repeat (1) and (2) until There are no vertices without predecessors;
(4) If the number of vertices output at this time is less than the number of vertices in the directed graph, it means that there are loops in the directed graph, otherwise the output vertex sequence is a topological sequence;

Fourth, the critical path

1. AOE-Net
AOE-Net is a weighted directed acyclic graph, where vertices represent events, arcs represent activities, and weights represent the duration of activities. Usually, AOE-Net can be used to estimate the time to complete the project.
2. Several definitions:
(1) Source point: there is only one point with zero in-degree in the network;
(2) Sink point: only one point in the network with zero out-degree;
(3) Weighted path length: one path The sum of the weights on each arc;
(4) Critical path: find a path with the longest length of weighted path from the source point to the sink point;
3. The process of solving the critical path
(1) Sort the vertices in the graph, In the sorting process, find the earliest occurrence time ve(i) of each event according to the topological sequence;
(2) Find the latest occurrence time vl(i) of each event according to the inverse topological sequence;
(3) Find each The earliest start time e(i) of
activity ai ; (4) Find the latest start time l(i) of each activity ai;
(5) Find the activity ai with e(i)=l(i), which is Key activity. Each path from the source point to the sink point formed by key activities is a critical path (there may be more than one critical path);
4. How to find several times
Insert picture description here

Guess you like

Origin blog.csdn.net/gets_s/article/details/106753264