You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
605 B
605 B
有向图求拓扑序
- 求拓扑序有
dfs
和bfs
两种方法。 - 在求拓扑序过程中,可以增加判断是否有环的代码。
- 有些题目中,单独采用
bfs
或dfs
只为了判断是否有环,而不是要输出拓扑序,这时代码可以适当简化。
有向图判环
1、bfs
判环
2、dfs
判环
3、强连通分量判环
https://www.cnblogs.com/ljy-endl/p/11562352.html