Sha256: f590c916046cc830a088246a61605d7dd188ddcacbf8623668451cb63158832f
Contents?: true
Size: 379 Bytes
Versions: 12
Compression:
Stored size: 379 Bytes
Contents
require "tsort" # @type var g: Hash[Integer, Array[Integer]] g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]} # @type var each_node: ^() { (Integer) -> void } -> void each_node = -> (&b) { g.each_key(&b) } # @type var each_child: ^(Integer) { (Integer) -> void } -> void each_child = -> (n, &b) { g[n].each(&b) } # @type var xs: Array[String] xs = TSort.tsort(each_node, each_child)
Version data entries
12 entries across 12 versions & 1 rubygems