第四章 图结构及其应用算法

type
status
date
slug
summary
tags
category
icon
password

4.1图的基本概念

图G(V,E)、无向图、有向图、简单图、无向完全图、有向完全图
相邻(无向图:互为邻接点/有向图:点邻接到点、边/弧依附于点)、网(带权图)、无向图:度/有向图:入度、出度,度=入度+出度、路径、简单路径、简单回路
(无向图)连通、连通图、连通分量:非连通图的极大连通子图
(有向图)强连通图、强连通分量
生成树:包含全部顶点的一个极小连通子图
notion image
A
notion image
A
notion image
A
notion image
C 21 - 6
notion image
C A是路径不是弧
notion image
C
notion image
A
notion image
B 画画得了
notion image
B
notion image
A

4.2图的存储结构

1.邻接矩阵

2.邻接表

有向图:正/逆邻接表
notion image

3.有向图的十字链表

4.无向图的邻接多重表

notion image
C
notion image
D
notion image
B
notion image
A
notion image
B
notion image
C
notion image
notion image
D
notion image
A
notion image
B
notion image
notion image
notion image

4.3图的搜索(遍历)

深度优先搜索DFS:栈

notion image
notion image
notion image

广度优先搜索BFS:队列

notion image
notion image
notion image

无向图(的搜索)及其应用

notion image
A
notion image
C
notion image
CACA
notion image
AA
notion image
D 34
notion image
B
notion image
AB
notion image
D
notion image
D
notion image
A
notion image
D

4.4最小生成树算法

Prim算法(从点出发):LOWCOST[ ] CLOSSET[ ]

时间复杂度O(V²)

Kruskal算法(从边出发):edges[ ] parent[ ] 并查集

时间复杂度O(ElogE) 适用于边稀疏顶点较多的图
notion image
B
notion image
C
notion image
A
notion image
C
notion image
notion image
notion image
notion image

4.7最短路径算法

Dijkstra算法(贪心算法):从某个点出发的最短路径

D[ ] P[ ] S[ ] 时间复杂度O(n²) 边上权值非负情形的单源最短路径
notion image

Floyd-Warshall算法(动态规划算法):任意两个顶点之间

D[ ][ ] P[ ][ ] 时间复杂度O(n³) 边上权值为任意值的单源最短路径
【图-最短路径-Floyd(弗洛伊德)算法】 https://www.bilibili.com/video/BV19k4y1Q7Gj/
notion image
notion image
notion image
notion image
A
notion image
C
notion image
B
notion image
notion image
notion image
notion image

4.8拓扑排序算法

有向无环图DAG、AOV网、拓扑排序、拓扑排序算法(队列、栈)
notion image
D
notion image
D
notion image
notion image
D
notion image
D
notion image
C
notion image
C
notion image
C
notion image
D
notion image
A
notion image
notion image
A

4.9关键路径算法

AOE网:源点、汇点
路径长度、关键路径、关键活动
(顶点:事件vk)最早ve/最迟发生时间vl、(弧:活动ai)最早e/最迟开始时间l
时间余量d
notion image
notion image
notion image
notion image
notion image
notion image
notion image
notion image
C
notion image
C
notion image
C
notion image
notion image
notion image

期末真题

2021

notion image
A
notion image
C
notion image
notion image
notion image
notion image

2020

notion image
notion image

2019

notion image

2017

notion image
C
notion image
B
notion image
notion image
notion image
notion image

2016

notion image
C
notion image
O(m+e)
notion image
极大连通子图
notion image
从源点到汇点路径长度最长的路径
notion image

2015

notion image
A
notion image
Kruskal
notion image
10 38 完全图 生成树
notion image
notion image
notion image

2020

notion image
notion image
notion image
Loading...