Find the Weak Connected Component in the Directed Graph

在Directed Graph里找weak connected component,我们不能通过一个点,找到所有的点,因为有些路径是单向的。 做法一:自己构建一个新的图,根据给出的directed graph,自己建一张结构相同的但是是undirected graph。然后用BFS或者DFS都可以解。 做法二:Union Find

results matching ""

    No results matching ""