Linux server1.dn-server.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
LiteSpeed
Server IP : 195.201.204.189 & Your IP : 216.73.216.37
Domains :
Cant Read [ /etc/named.conf ]
User : beriska1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
opt /
alt /
ruby19 /
share /
ri /
1.9.1 /
system /
TSort /
Delete
Unzip
Name
Size
Permission
Date
Action
Cyclic
[ DIR ]
drwxr-xr-x
2026-05-01 04:24
cdesc-TSort.ri
4.6
KB
-rw-r--r--
2023-07-26 17:26
each_strongly_connected_component-i.ri
627
B
-rw-r--r--
2023-07-26 17:26
each_strongly_connected_component_from-i.ri
524
B
-rw-r--r--
2023-07-26 17:26
strongly_connected_components-i.ri
423
B
-rw-r--r--
2023-07-26 17:26
tsort-i.ri
438
B
-rw-r--r--
2023-07-26 17:26
tsort_each-i.ri
532
B
-rw-r--r--
2023-07-26 17:26
tsort_each_child-i.ri
362
B
-rw-r--r--
2023-07-26 17:26
tsort_each_node-i.ri
355
B
-rw-r--r--
2023-07-26 17:26
Save
Rename
U:RDoc::NormalModule[iI" TSort:EF@0o:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"FTSort implements topological sorting using Tarjan's algorithm for;TI"#strongly connected components.;To:RDoc::Markup::BlankLine o; ;[I"ITSort is designed to be able to be used with any object which can be;TI"%interpreted as a directed graph.;T@o; ;[I"BTSort requires two methods to interpret an object as a graph,;TI"*tsort_each_node and tsort_each_child.;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"Ctsort_each_node is used to iterate for all nodes over a graph.;To;;0;[o; ;[I"Itsort_each_child is used to iterate for child nodes of a given node.;T@o; ;[I"=The equality of nodes are defined by eql? and hash since;TI" TSort uses Hash internally.;T@S:RDoc::Markup::Heading: leveli: textI"A Simple Example;T@o; ;[ I"KThe following example demonstrates how to mix the TSort module into an;TI"Jexisting class (in this case, Hash). Here, we're treating each key in;TI"Ithe hash as a node in the graph, and so we simply alias the required;TI"L#tsort_each_node method to Hash's #each_key method. For each key in the;TI"Khash, the associated value is an array of the node's child nodes. This;TI"Qchoice in turn leads to our implementation of the required #tsort_each_child;TI"Omethod, which fetches the array of child nodes and then iterates over that;TI")array using the user-supplied block.;T@o:RDoc::Markup::Verbatim;[I"require 'tsort' ;FI" ;FI"class Hash ;FI" include TSort ;FI"& alias tsort_each_node each_key ;FI"* def tsort_each_child(node, &block) ;FI"" fetch(node).each(&block) ;FI" end ;FI" end ;FI" ;FI"-{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort ;FI"#=> [3, 2, 1, 4] ;FI" ;FI"F{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_components ;FI"#=> [[4], [2, 3], [1]] ;FS;;i;I"A More Realistic Example;T@o; ;[I"BA very simple `make' like tool can be implemented as follows:;T@o;;[=I"require 'tsort' ;FI" ;FI"class Make ;FI" def initialize ;FI" @dep = {} ;FI" @dep.default = [] ;FI" end ;FI" ;FI", def rule(outputs, inputs=[], &block) ;FI"+ triple = [outputs, inputs, block] ;FI"/ outputs.each {|f| @dep[f] = [triple]} ;FI" @dep[triple] = inputs ;FI" end ;FI" ;FI" def build(target) ;FI"> each_strongly_connected_component_from(target) {|ns| ;FI" if ns.length != 1 ;FI"1 fs = ns.delete_if {|n| Array === n} ;FI"M raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}") ;FI" end ;FI" n = ns.first ;FI" if Array === n ;FI"( outputs, inputs, block = n ;FI"= inputs_time = inputs.map {|f| File.mtime f}.max ;FI" begin ;FI"A outputs_time = outputs.map {|f| File.mtime f}.min ;FI"" rescue Errno::ENOENT ;FI"" outputs_time = nil ;FI" end ;FI"' if outputs_time == nil || ;FI"B inputs_time != nil && outputs_time <= inputs_time ;FI"R sleep 1 if inputs_time != nil && inputs_time.to_i == Time.now.to_i ;FI" block.call ;FI" end ;FI" end ;FI" } ;FI" end ;FI" ;FI"* def tsort_each_child(node, &block) ;FI"! @dep[node].each(&block) ;FI" end ;FI" include TSort ;FI" end ;FI" ;FI"def command(arg) ;FI" print arg, "\n" ;FI" system arg ;FI" end ;FI" ;FI"m = Make.new ;FI",m.rule(%w[t1]) { command 'date > t1' } ;FI",m.rule(%w[t2]) { command 'date > t2' } ;FI",m.rule(%w[t3]) { command 'date > t3' } ;FI"<m.rule(%w[t4], %w[t1 t3]) { command 'cat t1 t3 > t4' } ;FI"<m.rule(%w[t5], %w[t4 t2]) { command 'cat t4 t2 > t5' } ;FI"m.build('t5') ;FS;;i;I" Bugs;T@o;;; ;[o;;0;[o; ;[I"7'tsort.rb' is wrong name because this library uses;TI":Tarjan's algorithm for strongly connected components.;TI"IAlthough 'strongly_connected_components.rb' is correct but too long.;T@S;;i;I"References;T@o;;:UALPHA;[o;;0;[o;;;;[o;;0;[o; ;[I">Tarjan, "Depth First Search and Linear Graph Algorithms",;To; ;[I"O<em>SIAM Journal on Computing</em>, Vol. 1, No. 2, pp. 146-160, June 1972.;T: @fileI"lib/tsort.rb;T;0[ [ [ [[I" class;F[[:public[ [:protected[ [:private[ [I" instance;F[[;[[I"&each_strongly_connected_component;F@�[I"+each_strongly_connected_component_from;F@�[I""strongly_connected_components;F@�[I" tsort;F@�[I"tsort_each;F@�[I"tsort_each_child;F@�[I"tsort_each_node;F@�[;[ [;[