65件ヒット
[1-65件を表示]
(0.499秒)
種類
- 特異メソッド (32)
- インスタンスメソッド (11)
- ライブラリ (11)
- 文書 (11)
ライブラリ
- tsort (43)
モジュール
- TSort (43)
キーワード
-
NEWS for Ruby 2
. 1 . 0 (11) -
each
_ strongly _ connected _ component (32) - tsort (11)
検索結果
先頭5件
- TSort
. strongly _ connected _ components(each _ node , each _ child) -> Array - TSort
. each _ strongly _ connected _ component(each _ node , each _ child) {|nodes| . . . } -> nil - TSort
# each _ strongly _ connected _ component {|nodes| . . . } -> nil - TSort
. each _ strongly _ connected _ component(each _ node , each _ child) -> Enumerator - NEWS for Ruby 2
. 1 . 0
-
TSort
. strongly _ connected _ components(each _ node , each _ child) -> Array (18319.0) -
強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。
...す配列です。
引数 each_node と each_child でグラフを表します。
@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。
@param each_child 引数で与えられた頂点の子をそれぞ......ェクトを指定します。
//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) }
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) {|nodes| . . . } -> nil (316.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......_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_component(each_node, each_child) {|scc| p scc }
# => [4]... -
TSort
# each _ strongly _ connected _ component {|nodes| . . . } -> nil (232.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...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=>[3, 4], 3=>[2], 4=>[]}
non_sort... -
TSort
. each _ strongly _ connected _ component(each _ node , each _ child) -> Enumerator (216.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......_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_component(each_node, each_child) {|scc| p scc }
# => [4]... -
NEWS for Ruby 2
. 1 . 0 (108.0) -
NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.0.0 以降の変更
=== 言語仕様の変更
* キーワード引数のデフォルト値が省......尾に'r','i','ri'という接尾辞を付けられるようになりました
//emlist{
# r を付けると有理数になる
42r # => Rational(42, 1)
3.14 # => 3.14.rationalize
6.022e+23r # 指数形式と一緒には使えない
# i を付けると虚数単位 i を掛けた......* timeout
* 明示的に例外クラスを指定しない限り、ブロックを抜けるための例外はブロック内部で rescue されなくなりました。
* tsort
* 追加: TSort#tsort
* 追加: TSort#tsort_each
* 追加: TSort#strongly_connected_components
*... -
tsort (30.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...//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
#=> [3, 2, 1, 4]
{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_components
#=>......きます。
//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......分に関するアルゴリズムを使っているからです。
とはいえ strongly_connected_components という正確な名前は長過ぎます。
=== References
R. E. Tarjan,
Depth First Search and Linear Graph Algorithms,
SIAM Journal on Computing, Vol. 1, No. 2, pp. 146-160, June 1972....