40件ヒット
[1-40件を表示]
(0.145秒)
検索結果
先頭4件
- TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator - TSort
. each _ strongly _ connected _ component(each _ node , each _ child) -> Enumerator - TSort
. each _ strongly _ connected _ component _ from(node , each _ child , id _ map={} , stack=[]) -> Enumerator - TSort
. tsort _ each(each _ node , each _ child) -> Enumerator
-
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator (301.0) -
node から到達可能な強連結成分についてのイテレータです。
..._connected_component_from は
tsort_each_node を呼びません。
@param node ノードを指定します。
//emlist[例 到達可能なノードを表示する][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(no......sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}
#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}
@see TSort.each_strongly_connected_component_from... -
TSort
. each _ strongly _ connected _ component(each _ node , each _ child) -> Enumerator (301.0) -
TSort.strongly_connected_components メソッドのイテレータ版です。
...
TSort.strongly_connected_components メソッドのイテレータ版です。
引数 each_node と each_child でグラフを表します。
@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。
@param......ach_child 引数で与えられた頂点の子をそれぞれ評価するcallメソッ
ドを持つオブジェクトを指定します。
//emlist[使用例][ruby]{
require 'tsort'
g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = l......a {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
# => [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) }
TSort.each_strongly_connected_c... -
TSort
. each _ strongly _ connected _ component _ from(node , each _ child , id _ map={} , stack=[]) -> Enumerator (301.0) -
node から到達可能な強連結成分についてのイテレータです。
...と each_child でグラフを表します。
返す値は規定されていません。
TSort.each_strongly_connected_component_fromはTSortをincludeして
グラフを表現する必要のないクラスメソッドです。
@param node ノードを指定します。
@param each_child 引数......定します。
//emlist[使用例][ruby]{
require 'tsort'
graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_child = lambda {|n, &b| graph[n].each(&b) }
TSort.each_strongly_connected_component_from(1, each_child) {|scc|
p scc
}
# => [4]
# [2, 3]
# [1]
//}
@see TSort#each_strongly_connected_... -
TSort
. tsort _ each(each _ node , each _ child) -> Enumerator (301.0) -
TSort.tsort メソッドのイテレータ版です。
...
TSort.tsort メソッドのイテレータ版です。
引数 each_node と each_child でグラフを表します。
@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。
@param each_child 引数で与......す。
@raise TSort::Cyclic 閉路が存在するとき、発生します.
//emlist[使用例][ruby]{
require '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.tsort_each(each_node, each_child) {|n| p n }......# => 4
# 2
# 3
# 1
//}
@see TSort#tsort_each...