当前位置:网站首页>最小生成树、最短路径、拓扑排序、关键路径
最小生成树、最短路径、拓扑排序、关键路径
2022-06-26 18:08:00 【小狐狸梦想去童话镇】
一、最小生成树
普利姆算法和克鲁斯卡尔算法是两个利用MST性质构造最小生成树的算法。
1、普利姆算法(“加点法”)

2、克鲁斯卡尔算法

二、最短路径
1、迪杰斯特拉算法
(从某个源点到其余各顶点的距离)
时间复杂度为O(n^2)

2、弗洛伊德算法
(每一对顶点之间的最短路径)
时间复杂度为O(n^3)
三、拓扑排序
1、AOV-网
用顶点表示活动,用弧表示活动间的优先关系的图称为顶点表示活动的网,简称AOV-网。
注意:
(1)在AOV-网中,不应该出现有向环;
(2)检测是否存在有向环的办法是对有向图的顶点进行拓扑排序;
2、拓扑排序
概念:
所谓的拓扑排序就是将AOV-网中所有顶点排成一个线性序列,该序列满足:若在AOV-网中由顶点Vi到顶点Vj只有一条路径,则在该线性序列中顶点Vi必定在顶点Vj之前。
过程:
(1)在有向图中选一个无前驱的顶点且输出它;
(2)从图中删除该顶点和所有以他为尾的弧;
(3)重复(1)和(2),直至不存在无前驱的顶点;
(4)若此时输出的顶点个数小于有向图中的顶点个数,则说明有向图中存在环,否则输出的顶点序列即为一个拓扑序列;
四、关键路径
1、AOE-网
AOE-网是一个带权的有向无环图,其中,顶点表示事件,弧表示活动,权表示活动持续的时间。通常,AOE-网可用来估算工程完成的时间。
2、几个定义:
(1)源点:网中只有一个入度为零的点;
(2)汇点:网中只有一个出度为零的点;
(3)带权路径长度:一条路径各弧上的权值之和;
(4)关键路径:找一条从源点到汇点的带权路径长度最长的路径;
3、关键路径求解的过程
(1)对图中顶点进行排序,在排序过程中按拓扑序列求出每个事件的最早发生时间ve(i);
(2)按逆拓扑序列求出每个事件的最迟发生时间vl(i);
(3)求出每个活动ai的最早开始时间e(i);
(4)求出每个活动ai的最晚开始时间l(i);
(5)找出e(i)=l(i)的活动ai,即为关键活动。由关键活动形成的由源点到汇点的每一条路径就是关键路径(关键路径有可能不止一条);
4、几个时间的求法
边栏推荐
- GDB installation
- CLion断点单步调试
- pycharm的plt.show()如何保持不关闭
- Solve the problem that each letter occupies a space in pycharm
- 请指教同花顺开户选选择哪家券商比较好?现在在线开户安全么?
- 贝叶斯网络详解
- Chen Qiang: Alibaba's 100 billion level large-scale digital business knowledge map helps business growth
- [npoi] C copy sheet template across workbooks to export Excel
- 行锁与隔离级别案例分析
- 让torch.cuda.is_available()从false变成true的一点经验
猜你喜欢

爬取豆瓣读书Top250,导入sqlist数据库(或excel表格)中

RuntimeError: CUDA error: out of memory自己的解决方法(情况比较特殊估计对大部分人不适用)

A little experience of next (ITER (dataloader))

深入理解MySQL锁与事务隔离级别

transforms. The input of randomcrop() can only be PIL image, not tensor

(multi threading knowledge points that must be mastered) understand threads, create threads, common methods and properties of using threads, and the meaning of thread state and state transition

wechat_微信小程序中解决navigator进行页面跳转并传递参数问题

Properties file garbled

Binary search-2

Leetcode interview question 29 clockwise print matrix
随机推荐
Detailed explanation of dos and attack methods
Crawl Douban to read top250 and import it into SqList database (or excel table)
Hello, is it safe to open an online stock account and buy stocks now?
RSA encryption and decryption details
交叉编译环境出现.so链接文件找不到问题
Detailed explanation of MySQL mvcc mechanism
刻录光盘的程序步骤
idea中文插件chinese(simplified) language pack
Leetcode 238 product of arrays other than itself
Discussion and generation of digital signature and analysis of its advantages
基于tensorflow的手写数字识别
Do you know how to compare two objects
properties文件乱码
Leetcode interview question 29 clockwise print matrix
wechat_微信小程序中解决navigator进行页面跳转并传递参数问题
VCD-影音光碟
(必须掌握的多线程知识点)认识线程,创建线程,使用Thread的常见方法及属性,以及线程的状态和状态转移的意义
图像二值化处理
Case study of row lock and isolation level
Determine whether a sequence is a stack pop-up sequence