Iterates over strongly connected component in the subgraph reachable from node.
Return value is unspecified.
each_strongly_connected_component_from
doesn’t call tsort_each_node
.
class G include TSort def initialize(g) @g = g end def tsort_each_child(n, &b) @g[n].each(&b) end def tsort_each_node(&b) @g.each_key(&b) end end graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}) graph.each_strongly_connected_component_from(2) {|scc| p scc } #=> [4] # [2] graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}) graph.each_strongly_connected_component_from(2) {|scc| p scc } #=> [4] # [2, 3]
Iterates over strongly connected components in a graph. The graph is represented by node and each_child.
node is the first node. each_child should have call
method which takes a node argument and yields for each child node.
Return value is unspecified.
TSort.each_strongly_connected_component_from is a class method and it doesn’t need a class to represent a graph which includes 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]
Allocates a C struct with the types
provided.
When the instance is garbage collected, the C function func
is called.
Allocates a C union the types
provided.
When the instance is garbage collected, the C function func
is called.
Fiddle::Pointer.malloc(size, freefunc = nil) => fiddle pointer instance
Allocate size
bytes of memory and associate it with an optional freefunc
that will be called when the pointer is garbage collected.
freefunc
must be an address pointing to a function or an instance of Fiddle::Function
bn.zero? => true | false
Enter error recovering mode. This method does not call on_error
.
Leave error recovering mode.
Returns the broadcast address of ifaddr. nil is returned if the flags doesn’t have IFF_BROADCAST.
Logs a message
at the error (syslog warning) log level, or logs the message returned from the block.
Same as IO
.
Same as IO
.
Returns the number of native file system blocks allocated for this file, or nil
if the operating system doesn’t support this feature.
File.stat("testfile").blocks #=> 2
Returns true
if stat is a zero-length file; false
otherwise.
File.stat("testfile").zero? #=> false
Returns true
if stat is a socket, false
if it isn’t or if the operating system doesn’t support this feature.
File.stat("testfile").socket? #=> false
Returns true
if the file is a block device, false
if it isn’t or if the operating system doesn’t support this feature.
File.stat("testfile").blockdev? #=> false File.stat("/dev/hda1").blockdev? #=> true
Wakes up all threads waiting for this lock.
Sends a LOCK request to the path
and gets a response, as an HTTPResponse
object.
Sends a UNLOCK request to the path
and gets a response, as an HTTPResponse
object.
Sends the GETQUOTAROOT command along with the specified mailbox
. This command is generally available to both admin and user. If this mailbox exists, it returns an array containing objects of type Net::IMAP::MailboxQuotaRoot
and Net::IMAP::MailboxQuota
.