正在加载图片...
应用:连通分量 CONNECTED-COMPONENTS(G) 1 for each vertex v∈G.V 2 MAKE-SET(v) 3 for each edge (u,v)E G.E 4 if FIND-SET(u)FIND-SET(v) b ① 5 UNION(.V) SAME-COMPONENT(u.V) 1 if FIND-SET(u)==FIND-SET(v) 2 return TRUE 3 else return FALSE Edge processed Collection of disjoint sets initial sets La) {b) {c} Ad) {e} 价 {8} { 话 } (b,d0 La) {b,d) {c} {e} 仍 {g} (h) (0) 0 (eg) La) {b,d) {c} {e,8} 仍 th) {i) 仍 (a,c) {a,c} {b,d) {e,8} (h) (d} 仍 (h,i0 {a,c} (b,d) {e,8} 仍 {h,} } (a,b) a.b.c.dy {e,8} (h.i (e,f) a.b.c.dy e.fg) {h,i} 仍 (b,c) a.bc.dy {e,f8} (h,i }应用:连通分量
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有