65件ヒット
[1-65件を表示]
(0.321秒)
種類
- インスタンスメソッド (54)
- ライブラリ (11)
ライブラリ
- tsort (54)
モジュール
- TSort (54)
キーワード
-
each
_ strongly _ connected _ component (11) -
each
_ strongly _ connected _ component _ from (21) - tsort (11)
-
tsort
_ each (11)
検索結果
先頭5件
- TSort
# tsort _ each _ child(node) {|child| . . . } -> () - TSort
# tsort _ each {|node| . . . } -> nil - TSort
# each _ strongly _ connected _ component {|nodes| . . . } -> nil - TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator - TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) {|nodes| . . . } -> ()
-
TSort
# tsort _ each _ child(node) {|child| . . . } -> () (24307.0) -
TSort で拡張されるクラスで定義されていなければならないメソッドです。
...拡張されるクラスで定義されていなければならないメソッドです。
tsort_each_child is used to iterate for child nodes of node.
@param node ノードを指定します。
@raise NotImplementedError TSort で拡張されるクラスで定義されていない場合発生し... -
TSort
# tsort _ each {|node| . . . } -> nil (112.0) -
TSort#tsort メソッドのイテレータ版です。 obj.tsort_each は obj.tsort.each と似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...は nil を返します。
閉路が存在するとき、例外 TSort::Cyclic を起こします。
@raise TSort::Cyclic 閉路が存在するとき、発生します.
//emlist[使用例][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(nod......e, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2, 3], 2=>[3], 3=>[], 4=>[]}
non_sort.tsort_each {|node|
non_sort.tsort_each_child(node){|child|
printf("%d -> %d\n", node, child)
}
}
# 出力
#=> 2 -> 3
#=> 1 -> 2
#=> 1 -> 3
//}
@see TSort.tsort_each... -
TSort
# each _ strongly _ connected _ component {|nodes| . . . } -> nil (106.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...になる
ことがあります。
each_strongly_connected_component は nil を返します。
//emlist[使用例][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2... -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator (106.0) -
node から到達可能な強連結成分についてのイテレータです。
...を呼びません。
@param node ノードを指定します。
//emlist[例 到達可能なノードを表示する][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2......ngly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_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 ->... -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) {|nodes| . . . } -> () (106.0) -
node から到達可能な強連結成分についてのイテレータです。
...を呼びません。
@param node ノードを指定します。
//emlist[例 到達可能なノードを表示する][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2......ngly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_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 ->... -
tsort (24.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...ートと強連結成分に関するモジュールを提供します。
=== Example
//emlist[][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
#......きます。
//emlist[][ruby]{
require 'tsort'
class Make
def initialize
@dep = {}
@dep.default = []
end
def rule(outputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @dep[f] = [triple]}
@dep[triple] = inputs
end
def build(target)
each......ns|
if ns.length != 1
fs = ns.delete_if {|n| Array === n}
raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
end
n = ns.first
if Array === n
outputs, inputs, block = n
inputs_time = inputs.map {|f| File.mtime f}.max
begin...