《Algorithms》第3章:Decompositions of graphs 学习笔记
来源:互联网 发布:黑苹果软件下载 编辑:程序博客网 时间:2024/06/04 19:41
Chapter 3:Decompositions of graphs
1、图有什么应用?
- 解决四色问题时,忽略地图中的次要因素,把四色问题抽象成图论问题
- 解决安排考试问题(需要安排最短的时间考完所有的试,假设有一个学生需要参加两场考试,则这两场考试需分不同的时间段),把每门考试抽象为顶点,把需要参加两门考试的学生抽象成边并连接这两个顶点,则这个问题又变成了四色问题。
2、图的表示方法:
- 邻接矩阵,适合稠密图,查找边的时间为常量。占空间大。
- 邻接表,适合稀疏图,查找边时间不是常量,易于访问一个顶点的邻居。
3、深度优先搜索(DFS)
- 如果用邻接表,则时间复杂度为O(|V| + |E|) ,|V|代表对所有的顶点设为未访问,|E|代表对于每条边都需要检查一次。
- 是最优算法,因为算法的复杂度和输入规模的复杂度渐近相等(算法的复杂度不可能比输入的复杂度更小)。
- 无向图中,DFS生成的搜索森林个数等于连通分量个数。
4、有向图中的边分为四种:
- Tree edges
- Forward edges
- Back edges
- Cross edges
5、A directed graph has a cycle if and only if its depth-first search reveals a back edge.
6、关于有向图的连通:Two nodes u and v of a directed graph are connected if there is a path from u to v and a path from v to u.
例:一个有向图和它的强连通分量:
7、Every directed graph is directed acyclic graph of its strongly connected components. 上图也可以印证这一点。
8、如何找出有向图的强连通分量:
- 任意进行一次DFS,记录下每个节点的离开时间
- 选择具有最晚离开时间的顶点,对原图的逆向图做DFS,删除能够遍历到的顶点,这些点构成一个强连通分量
- 如果还有顶点没有被删除,回到第二步,否则结束
- 《Algorithms》第3章:Decompositions of graphs 学习笔记
- 《Algorithms》第4章:Paths in graphs 学习笔记
- 《Algorithms》第2章:Divide-and-conquer algorithms 学习笔记
- 《Algorithms》第5章:Greedy Algorithms 学习笔记
- Algorithms 学习笔记02 Analysis Of Algorithms
- 《Algorithms》第0章:Prologue 学习笔记
- 《Algorithms》第1章:Algorithm with numbers 学习笔记
- 《Algorithms》第6章:Dynamic Programming 学习笔记
- 《Algorithms》第7章:Linear programming and reductions 学习笔记
- 《Algorithms》第8章:NP完全问题 学习笔记
- Introduction to Algorithms 算法导论 第3章 函数的增长 学习笔记及习题解答
- Introduction to Algorithms 算法导论 第1章 基础知识 学习笔记及习题解答
- Introduction to Algorithms 算法导论 第2章 算法入门 学习笔记及习题解答
- Introduction to Algorithms 算法导论 第4章 递归式 学习笔记及习题解答
- 图的拉普拉斯矩阵学习-Laplacian Matrices of Graphs
- Algorithms 学习笔记04 Sort
- 学习笔记—Optimization algorithms
- Algorithms 第4版 by Sedgewick 笔记
- maya2011安装方法图文详细教程及Unity下载
- zencart删除或清空网站的所有订单,顾客,和商品
- android模拟器安装软件
- MFC listBox 实现右键单击事件
- Slackware Linux:xrandr 使用两个屏幕
- 《Algorithms》第3章:Decompositions of graphs 学习笔记
- 猕猴桃输入法公告
- Android系统权限和root权限
- 我依然爱你 就是唯一的退路
- 获取手机通讯录的实战应用(含SIM卡中的联系人)
- 简单的python程序--图形输出数字参数序列
- android抓包
- android中开启线程
- Handler sendMessage 与 obtainMessage (sendToTarget)斗劲