七个小矮人分别叫什么| 佩戴貔貅有什么讲究与禁忌| 董监高是什么意思| 女性尿里带血是什么原因| gap是什么档次的牌子| 松鼠是什么生肖| 冷战的男人是什么心理| 美国为什么叫鹰酱| 金牛男和什么星座女最配| 木字旁羽字是什么字| 嘴唇出血是什么原因| 睡不着吃什么| 2023年五行属什么| 红枣泡水喝有什么功效| 陈皮泡水喝有什么功效和作用| 景色奇异的异是什么意思| 洋姜学名叫什么| gs是什么意思| 男戴观音女戴佛有什么讲究| 长期低血糖对人体有什么危害| 八字桃花是什么意思| 境遇是什么意思| 孕妇抽筋是什么原因引起的| 禄蠹是什么意思| 散粉是干什么用的| 颈椎病睡什么枕头最好| 抗组胺药是什么意思| 梦见刺猬是什么意思| 员外是什么生肖| 白羊歌词是什么意思| 一夜白头是什么原因| 孕妇梦见龙是什么征兆| 吃什么药| 为什么会长脂肪粒| 为什么一站起来就头晕眼前发黑| 青什么黄什么| 手发胀是什么原因造成的| 胎儿右侧脉络丛囊肿是什么意思| 眩晕停又叫什么| 口干口苦吃什么药最好| 子宫内膜不典型增生是什么意思| 0点是什么时辰| nsaids是什么药| 夜晚的星星像什么| 排卵期过后是什么期| 2026年属什么生肖| 肾病有什么症状男性| 嘴酸是什么原因引起| 冒菜和麻辣烫有什么区别| omega什么牌子手表| 锦是什么面料| 梦见大便是什么意思| 坐以待毙是什么意思| 静脉曲张吃什么药好| 红艳桃花是什么意思| 什么是奶昔| 靓仔是什么意思| 什么水什么龙| 醉酒当歌什么意思| 沙僧的武器叫什么| 举人相当于现在的什么官| 沐沐是什么意思| 今天晚上吃什么| 什么是基因突变| 虾仁不能和什么食物一起吃| 火加木是什么字| 四点水的字与什么有关| 徐长卿是什么药| 面部发红是什么原因| 霍金什么时候去世| 肠息肉有什么症状| 吃什么食物可以降低胆固醇| 荷尔蒙是什么| Op是什么| 什么玉便宜又养人| 一纸空文是什么意思| 俱往矣是什么意思| 人为什么会打喷嚏| b2b是什么| 存款准备金率是什么意思| 紫涵女装属于什么档次| 女人手心发热是什么原因| 胎儿肾积水是什么原因引起的| 缺血灶是什么意思| 广义是什么意思| 被子什么材质的好| 幽门杆菌吃什么药最好| 水肿吃什么药消肿最快最有效| 失眠吃什么食物| 阴道是什么意思| 獐子是什么动物| 欣赏一个人是什么意思| 卧室养什么花好| 阴虱是什么| 头孢长什么样图片| 苏轼是什么朝代的| 男人山根有痣代表什么| 什么是感情| 九个口是什么字| 荷尔蒙分泌是什么意思| 秘书是干什么的| 银屑病是什么症状| 打美国电话前面加什么| 寂寞的近义词是什么| 藏语扎西德勒是什么意思| 阁楼是什么意思| 荷叶像什么比喻句| 精神病挂什么科| 非均匀性脂肪肝是什么意思| 肝功七项查的是什么| 白带黄吃什么药| 丙二醇是什么| 什么叫抗体阳性| 月经为什么会提前| 胃火喝什么茶降火| 贞操是什么| 丝瓜什么时候种植最好| 肛裂擦什么药膏| 甲磺酸倍他司汀片治什么病| 中性粒细胞偏低是什么原因| 看到刺猬有什么预兆| 什么是梦魇| 白介素6升高说明什么| 北字五行属什么| 秋葵炒什么好吃| 女性尿道炎挂什么科| 直肠炎是什么原因引起| 2.6号是什么星座| 什么是周边| 内热外寒感冒用什么药| 伊朗是什么民族| 外阴病变有什么症状| 尼麦角林片治什么病| 小孩吃什么水果好| 富强粉是什么面粉| 澳门为什么叫澳门| 野鸭吃什么| 市委书记是什么级别| 六月二十六是什么星座| 舌头上有黑点是什么原因| 屁多是什么毛病| 湖南湖北以什么湖为界| 快递客服主要做什么| 睡觉时间长是什么原因| 天意不可违是什么意思| 低钠盐适合什么人吃| 开什么店好赚钱| 艾灸肚脐有什么好处| 龟头感染用什么药| 国字五行属什么| 吃什么药可以延长性功能| 天高地厚是什么生肖| 头晕用什么药| 下肢水肿是什么原因| 微波炉可以做什么美食| jbp什么意思| 饱和度是什么意思| 天德是什么意思| 壅是什么意思| 双下肢水肿是什么原因| 风热感冒吃什么药效果好| 运单号是什么| 酸菜鱼是用什么鱼| 咽喉炎用什么药| 执念是什么意思| 沅字五行属什么| 鼻尖长痣代表什么| 什么使我快乐| 失眠有什么办法解决| 梦见戴孝是什么意思| 龟头炎是什么症状| 五险都有什么险| 毒龙是什么意思| 灵柩是什么意思| 超拔是什么意思| 乳腺癌吃什么好| 丙肝是什么病| 安宫牛黄丸什么时候吃最好| 为什么会突然耳鸣| 费率是什么| 芳菲是什么意思| 血压高降不下来是什么原因| 为什么筋膜炎一躺下才会疼| 白色舌苔厚是什么原因| 血小板低吃什么补得快| 各位同仁用在什么场合| 子宫肌瘤伴钙化是什么意思| 张国立的老婆叫什么名字| 前列腺炎吃什么药效果好见效快| 孩子睡觉流口水是什么原因| 油菜是什么菜| 内含是什么意思| 什么是无为| 大夫古代指什么| 什么是月经| 为什么发烧会觉得冷| 为什么说啄木鸟是树的医生| 大便次数多是什么原因| 青岛有什么好吃的| 粘土是什么土| 肾结石喝酒有什么影响| 血热吃什么药可以凉血| 绿豆汤是什么颜色| 生肖马和什么生肖相冲| 什么情况下需做肠镜| 肚子胀痛什么原因| 成人高考是什么| 接触隔离什么意思| 诗情画意的意思是什么| 强直性脊柱炎吃什么药| 为什么早上起来恶心想吐| 肺看什么科室| 梦见洗澡是什么意思| b型钠尿肽高说明什么| 背德感是什么意思| 什么酷暑| 真菌镜检阳性是什么意思| 支配是什么意思| hpv男性有什么症状| 美国为什么打朝鲜| 顽疾是什么意思| 曲克芦丁片治什么病| miu是什么单位| 明哲保身是什么生肖| 哈字五行属什么| maga是什么意思| 三聚磷酸钠是什么| 麻腮风疫苗什么时候打| 梦见买衣服是什么预兆| 两小儿辩日告诉我们什么道理| 轮廓是什么意思| 肾不好吃什么| 梦见偷玉米是什么意思| 皮疹是什么| 烧心是什么原因| 支气管炎吃什么药好得快| 为什么一直打哈欠| 肌酐高是什么原因| 吃力不讨好是什么意思| 五月十五是什么星座| 头发容易断是什么原因| 今天吃什么随机| eos是什么意思| 肚脐周围是什么肠| 请产假需要什么材料| 18岁是什么生肖| 头疼 吃什么药| 胃疼吃什么药好的快| 屁眼火辣辣的疼是什么原因| 尿检白细胞阳性是什么意思| 15天来一次月经是什么原因| 癌胚抗原高是什么意思| 月经来一点又不来了是什么原因| 寄生虫长什么样| 六月十一号是什么星座| 什么是皈依| 孩子注意力不集中缺什么微量元素| 38线是什么意思| 梦见很多人是什么意思| 降息是什么意思| 尿液黄是什么原因| 毅五行属什么| 铅超标吃什么排铅| 什么大腰粗| 百度Jump to content

朝鲜民众不知导弹爆炸 反问:半岛这么紧张?

From Wikipedia, the free encyclopedia
百度 建议省有关部门加快推进建设杭州湾南高速公路(杭甬高速公路复线),连接杭州大江东新城、绍兴袍江经济技术开发区和宁波杭州湾新区。

In computer science, Kosaraju-Sharir's algorithm (also known as Kosaraju's algorithm) is a linear time algorithm to find the strongly connected components of a directed graph. Aho, Hopcroft and Ullman credit it to S. Rao Kosaraju and Micha Sharir. Kosaraju suggested it in 1978 but did not publish it, while Sharir independently discovered it and published it in 1981. It makes use of the fact 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.

The algorithm

[edit]

The primitive graph operations that the algorithm uses are to enumerate the vertices of the graph, to store data per vertex (if not in the graph data structure itself, then in some table that can use vertices as indices), to enumerate the out-neighbours of a vertex (traverse edges in the forward direction), and to enumerate the in-neighbours of a vertex (traverse edges in the backward direction); however the last can be done without, at the price of constructing a representation of the transpose graph during the forward traversal phase. The only additional data structure needed by the algorithm is an ordered list L of graph vertices, that will grow to contain each vertex once.

If strong components are to be represented by appointing a separate root vertex for each component, and assigning to each vertex the root vertex of its component, then Kosaraju's algorithm can be stated as follows.

  1. For each vertex u of the graph, mark u as unvisited. Let L be empty.
  2. For each vertex u of the graph do Visit(u), where Visit(u) is the recursive subroutine:
    If u is unvisited then:
    1. Mark u as visited.
    2. For each out-neighbour v of u, do Visit(v).
    3. Prepend u to L.
    Otherwise do nothing.
  3. For each element u of L in order, do Assign(u,u) where Assign(u,root) is the recursive subroutine:
    If u has not been assigned to a component then:
    1. Assign u as belonging to the component whose root is root.
    2. For each in-neighbour v of u, do Assign(v,root).
    Otherwise do nothing.

Trivial variations are to instead assign a component number to each vertex, or to construct per-component lists of the vertices that belong to it. The unvisited/visited indication may share storage location with the final assignment of root for a vertex.

The key point of the algorithm is that during the first (forward) traversal of the graph edges, vertices are prepended to the list L in post-order relative to the search tree being explored. This means it does not matter whether a vertex v was first visited because it appeared in the enumeration of all vertices or because it was the out-neighbour of another vertex u that got visited; either way v will be prepended to L before u is, so if there is a forward path from u to v then u will appear before v on the final list L (unless u and v both belong to the same strong component, in which case their relative order in L is arbitrary).

This means, that each element n of the list can be made to correspond to a block L[in-1: in], where the block consists of all the vertices reachable from vertex n using just outward edges at each node in the path. It is important to note that no vertex in the block beginning at n has an inward link from any of the blocks beginning at some vertex to its right, i.e., the blocks corresponding to vertices in, in+1, … N in the list. This is so, because otherwise the vertex having the inward link (say from the block beginning at n' in+1) would have been already visited and pre-pended to L in the block of n', which is a contradiction. On the other hand, vertices in the block starting at n can have edges pointing to the blocks starting at some vertex in {in, in+1, … N}.

Step 3 of the algorithm, starts from L[0], assigns all vertices which point to it, the same component as L[0]. Note that these vertices can only lie in the block beginning at L[0] as higher blocks can't have links pointing to vertices in the block of L[0]. Let the set of all vertices that point to L[0] be In(L[0]). Subsequently, all the vertices pointing to these vertices, In(In(L[0])) are added too, and so on till no more vertices can be added.

There is a path to L[0], from all the vertices added to the component containing L[0]. And there is a path to all the vertices added from L[0], as all those lie in the block beginning at L[0] (which contains all the vertices reachable from L[0] following outward edges at each step of path). Hence all these form a single strongly connected component. Moreover, no vertex remains, because, to be in this strongly connected component a vertex must be reachable from L[0] and must be able to reach L[0]. All vertices that are able to reach L[0], if any, lie in the first block only, and all the vertices in first block are reachable from L[0]. So the algorithm chooses all the vertices in the connected component of L[0].

When we reach vertex v = L[i], in the loop of step 3, and v hasn't been assigned to any component, we can be sure that all the vertices to the left have made their connected components; that v doesn't belong to any of those components; that v doesn't point to any of the vertices to the left of it. Also, since, no edge from higher blocks to v's block exists, the proof remains same.

As given above, the algorithm for simplicity employs depth-first search, but it could just as well use breadth-first search as long as the post-order property is preserved.

The algorithm can be understood as identifying the strong component of a vertex u as the set of vertices which are reachable from u both by backwards and forwards traversal. Writing F(u) for the set of vertices reachable from u by forward traversal, B(u) for the set of vertices reachable from u by backwards traversal, and P(u) for the set of vertices which appear strictly before u on the list L after phase 2 of the algorithm, the strong component containing a vertex u appointed as root is

Set intersection is computationally costly, but it is logically equivalent to a double set difference, and since ?? it becomes sufficient to test whether a newly encountered element of B(u) has already been assigned to a component or not.

Complexity

[edit]

Provided the graph is described using an adjacency list, Kosaraju's algorithm performs two complete traversals of the graph and so runs in Θ(V+E) (linear) time, which is asymptotically optimal because there is a matching lower bound (any algorithm must examine all vertices and edges). It is the conceptually simplest efficient algorithm, but is not as efficient in practice as Tarjan's strongly connected components algorithm and the path-based strong component algorithm, which perform only one traversal of the graph.

If the graph is represented as an adjacency matrix, the algorithm requires Ο(V2) time.

References

[edit]
  • Alfred V. Aho, John E. Hopcroft, Jeffrey D. Ullman. Data Structures and Algorithms. Addison-Wesley, 1983.
  • Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein. Introduction to Algorithms, 3rd edition. The MIT Press, 2009. ISBN 0-262-03384-4.
  • Micha Sharir. A strong-connectivity algorithm and its applications to data flow analysis. Computers and Mathematics with Applications 7(1):67–72, 1981.
[edit]
女人三十如狼四十如虎什么意思 大红色配什么颜色好看 题词是什么意思 甲骨文是写在什么上面的 癫痫挂什么科
辛未日五行属什么 钙不能和什么一起吃 afp是什么 pnh是什么病 手链突然断了预示什么
什么人不能吃阿胶 打喷嚏代表什么 发际线长痘痘是什么原因 五行缺水是什么意思 迎合是什么意思
小样什么意思 大盘是什么意思 莲子适合什么人吃 晚上做噩梦是什么原因 琛字五行属什么
拉屎是绿色的是什么原因gangsutong.com 刑克是什么意思hcv7jop9ns7r.cn 左侧上颌窦炎是什么病hcv7jop7ns4r.cn 燥湿是什么意思hcv9jop3ns0r.cn 咳白痰吃什么药效果好hanqikai.com
n是什么牌子xscnpatent.com 尖货是什么意思helloaicloud.com 四战之地的生肖是什么hcv9jop0ns2r.cn 中气是什么意思hcv9jop6ns3r.cn 胆囊炎可以吃什么adwl56.com
阴枣是什么hcv9jop6ns7r.cn 每延米是什么意思liaochangning.com 吐痰带血是什么原因hcv9jop1ns5r.cn 涤棉是什么材质hcv9jop6ns1r.cn 主理人什么意思hcv8jop9ns6r.cn
料酒是什么酒hcv9jop1ns7r.cn 小孩补钙吃什么最好hcv8jop2ns8r.cn 肟是什么意思hcv8jop1ns1r.cn 息肉和囊肿有什么区别hcv7jop6ns6r.cn 另煎兑服是什么意思hcv8jop5ns5r.cn
百度