当前位置:网站首页>Minimum spanning tree, shortest path, topology sorting, critical path
Minimum spanning tree, shortest path, topology sorting, critical path
2022-06-26 18:42:00 【Little fox dreams of going to fairy tale town】
One 、 Minimum spanning tree
PLIM algorithm and Kruskal algorithm are two applications MST Properties of the algorithm for constructing the minimum spanning tree .
1、 The prim algorithm (“ Add points ”)

2、 Kruskal algorithm

Two 、 Shortest path
1、 Dijkstra algorithm
( Distance from a source point to the remaining vertices )
The time complexity is O(n^2)

2、 Freudian algorithm
( The shortest path between each pair of vertices )
The time complexity is O(n^3)
3、 ... and 、 A topological sort
1、AOV- network
Use vertices to represent activities , A graph in which the priority relationship between activities is represented by an arc is called a network in which vertices represent activities , abbreviation AOV- network .
Be careful :
(1) stay AOV- In the net , There should be no directed ring ;
(2) The way to check whether there is a directed ring is to sort the vertices of a directed graph ;
2、 A topological sort
Concept :
The so-called topological sorting is to sort AOV- All vertices in the net are arranged in a linear sequence , The sequence satisfies : If in AOV- There are vertices in the net Vi To the top Vj There is only one way , Then the vertices in the linear sequence Vi Must be at the vertex Vj Before .
The process :
(1) Select a vertex without precursor in a directed graph and output it ;
(2) Delete the vertex and all arcs ending in it from the graph ;
(3) repeat (1) and (2), Until there is no Vertex without precursor ;
(4) If the number of output vertices is less than the number of vertices in the directed graph , There is a ring in the graph , Otherwise, the output vertex sequence is a topological sequence ;
Four 、 critical path
1、AOE- network
AOE- A net is a weighted directed acyclic graph , among , A vertex represents an event , Arcs represent activities , Right means the duration of the activity . Usually ,AOE- The net can be used to estimate the completion time of the project .
2、 Several definitions :
(1) Source point : There is only one point with zero penetration in the network ;
(2) Confluence : There is only one point in the net where the outgoing degree is zero ;
(3) Weighted path length : The sum of the weights on the arcs of a path ;
(4) critical path : Find a path with the longest weighted path length from the source point to the sink point ;
3、 The process of solving critical path
(1) Sort the vertices in the graph , In the sorting process, the earliest occurrence time of each event is calculated according to the topological sequence ve(i);
(2) Calculate the latest occurrence time of each event according to the inverse topological sequence vl(i);
(3) Find out each activity ai The earliest start time of e(i);
(4) Find out each activity ai Latest start time of l(i);
(5) find e(i)=l(i) The activities of ai, This is the key activity . Each path from the source point to the sink point formed by key activities is a key path ( There may be more than one critical path );
4、 How to find a few times 
边栏推荐
猜你喜欢

stm32和电机开发(直流有刷电机和步进电机)

Solidity - contract inheritance sub contract contains constructor errors and one contract calls the view function of another contract to charge gas fees

项目实战六:分布式事务-Seata

最小生成树、最短路径、拓扑排序、关键路径

CLion断点单步调试

CD-CompactDisk

Clion compiling catkin_ WS (short for ROS workspace package) loads cmakelists Txt problems

Feign远程调用

Wechat applet custom pop-up components

LeetCode 128最长连续序列
随机推荐
50 lines of code to crawl TOP500 books and import TXT documents
wm_ Concat() and group_ Concat() function
Feign远程调用
最小生成树、最短路径、拓扑排序、关键路径
Eigen库计算两个向量夹角
Chain game development finished product source code chain game system development details
IK word breaker
gdb安装
vuex中利用缓存解决刷新state数据丢失问题
ROS查询话题具体内容常用指令
Development principle analysis and source code of dapp-lp single and dual currency liquidity pledge mining system
LeetCode 面试题29 顺时针打印矩阵
数据库范式和主码的选择
Numpy之matplotlib
IK分词器
转:苹果CEO库克:伟大的想法来自不断拒绝接受现状
Pinda general permission system (day 3~day 4)
成功解决之微服务@Value获取配置文件乱码问题
[kubernetes] kubernetes principle analysis and practical application (under update)
SQL中的并、交、差运算