Will SCC pattern change if we reverse a graph(using Kosaraju's Algorithm)?

孤人 提交于 2019-12-13 02:56:53

问题


Assume we have a digraph, it is not a complete graph and has more than one SCC. I wonder if the patterns of Strongly Connected Component changes if we transpose the graph and use Kosaraju's Algorithm? By saying "transpose the graph" I mean flip the direction of edges. If we try to find SCC in the transposed/reversed graph instead of the original, will the SCC we find be different?

I came up with this question as I misunderstood the algorithm of SCC and runs it on my transposed/reversed graph. What I got is identical SCC to the correct answer/which runs Kosaraju's algorithm. Is it universally true to all graphs?


回答1:


No the SCC of the graph will remain the same even when the graph is reversed and that is very important point in kosaraju's algorithm for SCC's. Only the links between SCC's are reversed. Kosaraju's algorithm leverages this fact to evaluate DFS on reversed graph which now gives higher finish time values for SCC's which are closer to the sink SCC. As Sink SCC has no outgoing edge to another SCC hence evaluating DFS on it gives out the SCC as whole connected component and also allows decomposition of graph into a subgraph with similar properties on which we again apply DFS to get another SCC.




回答2:


If you look at http://en.wikipedia.org/wiki/Kosaraju%27s_algorithm you will see that:

"the transpose graph (the same graph with the direction of every edge reversed) has exactly the same strongly connected components as the original graph."

(A strongly connected component is one where you can get from every vertex to every other vertex in the component, and this will still hold if you reverse all the links). Of course, the links connecting different components will be reversed, so I expect that you will get the components coming out in a different order.



来源:https://stackoverflow.com/questions/20087283/will-scc-pattern-change-if-we-reverse-a-graphusing-kosarajus-algorithm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!