るりまサーチ

最速Rubyリファレンスマニュアル検索!
32件ヒット [1-32件を表示] (0.483秒)
トップページ > クエリ:-[x] > クエリ:r[x] > 種類:特異メソッド[x] > クエリ:key[x] > クエリ:strongly_connected_components[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

モジュール

検索結果

TSort.strongly_connected_components(each_node, each_child) -> Array (24332.0)

強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。

...す。

引数 each_node と each_child でグラフを表します。

@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。

@param each_child 引数で与えられた頂点の子をそれぞれ評価す...
...ジェクトを指定します。

//emlist[使用例][ruby]{
r
equire 'tsort'

g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
p TSort.strongly_connected_components(each_node, each_child)
# => [[4], [2], [3], [1]]

g =...
...{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
p TSort.strongly_connected_components(each_node, each_child)
# => [[4], [2, 3], [1]]
//}

@see TSort#strongly_connected_components...

TSort.each_strongly_connected_component(each_node, each_child) -> Enumerator (6229.0)

TSort.strongly_connected_components メソッドのイテレータ版です。

...TSort.strongly_connected_components メソッドのイテレータ版です。

引数 each_node と each_child でグラフを表します。

@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。

@param...
...持つオブジェクトを指定します。

//emlist[使用例][ruby]{
r
equire 'tsort'

g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

#...
...[3]
# [1]

g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

# => [4]
# [2, 3]
# [1]
//}

@see TSort#each_strongly_connected_component...

TSort.each_strongly_connected_component(each_node, each_child) {|nodes| ...} -> nil (6229.0)

TSort.strongly_connected_components メソッドのイテレータ版です。

...TSort.strongly_connected_components メソッドのイテレータ版です。

引数 each_node と each_child でグラフを表します。

@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。

@param...
...持つオブジェクトを指定します。

//emlist[使用例][ruby]{
r
equire 'tsort'

g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

#...
...[3]
# [1]

g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

# => [4]
# [2, 3]
# [1]
//}

@see TSort#each_strongly_connected_component...