大家好,想跟大家讨论一下最后一题,
题目大致是说undirected graph要求"strongly" connected components,
要求写出及分析算法。
我对于题目有些疑问,因为strongly connected应该是用来描述directed graph吧?
undirected graph就直接说(connected) components不是吗(还是有人看过这个说法?)
为此我查了书上的定义,
1.Discrete and Combinatorial Mathematics: An Applied Introduction, 5e by
Ralph P. Grimaldi
p.351, Definition 7.15
A directed graph G on V is called strongly connected ...
2.Fundamentals of Data Structures in C, 2e by Horowitz
p.270,
A directed graph G is said to be strongly connected iff for every
pair....
所以我认为题目的叙述是有瑕疵的,若是要求undirected graph的components,可用
DFS/BFS来解;
但若是求directed graph的strongly connected components,就比较困难,没看过
这个算法应该很难自己想出来,
Kosaraju's Algorithm
http://www.csie.ntnu.edu.tw/~u91029/Component.html#5
各位的看法如何呢?谢谢。