摘要: (两年前学过,没什么印象了,重新复习一下orz。) 拓扑排序,即在一个有向图$G$中对节点进行线性排序,使图中任意一条有向边$<u,v>$,在该序列中都满足$u$在$v$前面。 举例: 该图的拓扑序是 6,1,2,3,4,5 。 又比如: 该图的拓扑序是 1,2,3,4,7,5,6,当然也可以是 1 阅读全文
posted @ 2021-06-20 22:46 wegret 阅读(57) 评论(0) 推荐(0)
摘要: 拓扑排序。能得到拓扑序就是true,不能得到就是false。 vector<int> to[100005]; int in[100005]; int temp; class Solution { public: bool canFinish(int numCourses, vector<vector 阅读全文
posted @ 2021-06-20 22:21 wegret 阅读(58) 评论(0) 推荐(0)