Lecture5-Strongly Connected Components.ppt
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《Lecture5-Strongly Connected Components.ppt》由会员分享,可在线阅读,更多相关《Lecture5-Strongly Connected Components.ppt(32页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、 2004 SDU 1 Lecture5-Strongly Connected Components 2004 SDU 2 Strongly Connected ComponentsA strongly connected component of a directed graph G=(V,E)is a maximal set V V of vertices such that for each pair of vertices u and v in V,they are reachable from each other.(1):Every pair of vertices in V ar
2、e reachable from each other;(2):Any other vertex set that contains V as a true subset does NOT satisfy(1).54132Is 1,2,3 a strongly connected component?Is 1,2,3,4 a strongly connected component?And 5?2004 SDU 3 The Strongly Connected Components Decomposition ProblemThe problem:Input:A directed graph
3、G=(V,E).Output:All the strongly connected components of G.In practice,many algorithms that work with directed graphs begin with a strongly connected components decomposition.2004 SDU 4 ObservationFor each tree in a depth-first forest of a graph G:It contains all the vertices in the same SCC as the r
4、ootBut,it may also contain some that are not!1/8abfecgd2/73/45/69/1410/1112/13 2004 SDU 5 If we regard each SCC as one vertex,and sort them in topological sort1/8abe2/73/4f5/6c10/11g12/13d9/14How if we could know the topological sort of the SCCSand one representation of each SCCS?2004 SDU 6 If we li
5、st the SCCS in order of decreasing finishing times,is this a topological sort?YESHow to choose representations of SCCS?How to decide their order?Latest finished vertex in the SCC?1/8ab2/7e3/4f5/6g12/13d9/14c10/11If search in increasing f order,then e is searched first,but its SCC is not first finish
6、edIf we search in decreasing f order,just the same as first DFS 2004 SDU 7 How if reorder the edges and search in decreasing f order?1/8ab2/7e3/4f5/6g12/13d9/14c10/11 2004 SDU 8 ObservationsGiven a directed graph G=(V,E)G and GT have exactly the same strongly connected components,that is,u and v are
7、 reachable from each other in G if and only if they are reachable from each other in GT.Note:GT is the transpose of G,i.e.,GT=(V,ET),where ET=(v,u)|(u,v)E.Given an adjacency-list representation of G,the time to create GT is(V+E).2004 SDU 9 The Component Graph of GThe component graph GSCC=(VSCC,ESCC)
8、of a directed graph G=(V,E)is defined as follows:Suppose that G has strongly connected components C1,C2,Ck:The vertex set VSCC=vi|vi corresponds to component Ci of GThe edge set ESCC=(vi,vj)|G contains a directed edge(x,y)for some x Ci and some y CjIf we know all the SCCs of G,how can we construct t
9、he component graph GSCC?2004 SDU 10 A Key Property of GSCCThe component graph GSCC=(VSCC,ESCC)is a directed acyclic graph.(Lemma 22.13)Proof.Suppose for the contrary that GSCC is cyclic,that is,there exist two vertices u,v VSCC such that u and v are reachable from each other.Suppose u and v represen
10、t the two strongly connected components Cu and Cv of G,then vertices in Cu and Cv are reachable from each other,which contradicts with the definition of strongly connected component.2004 SDU 11 An Example(a):The graph G with its SCCs shaded(c):The component graph GSCC=(VSCC,ESCC)of G(b):The transpos
11、e GT of G with SCCs shaded 2004 SDU 12 The AlgorithmTime Complexity:line 1,line 2,line 3:(V+E)line 4:O(V)How?2004 SDU 13 NotationsIf U V,define dU=minuUdu,the discovery time of vertex set U,that is,the earliest discovery time of any vertex in U;fU=maxuUfu,the finishing time of vertex set U,that is,t
12、he latest finishing time of any vertex in U.2004 SDU 14 A Key Property Related to SCCs and finishing timesLemma 22.14Let C and C be distinct strongly connected components in directed graph G=(V,E).Suppose that there is an edge(u,v)E,where u C and v C.Then f(C)f(C).Proof:CCuvCase 1:dC dCxy 2004 SDU 1
13、5 Can we order the fu for all vertices and search from the smallest fu?C1C2C3C4C5f(C1)f(C2)f(C3)2004 SDU 16 A CorollaryCorollary 22.15Let C and C be distinct strongly connected components in directed graph G=(V,E).Suppose that there is an edge(u,v)ET,where u C and v C.Then f(C)f(C).Here,the finishin
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Lecture5-Strongly Connected Components Lecture5 Strongly
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内