Sha256: 873e480824fc6d887bf8aa493f985a3e30e5e14af73f3ab1694805fb406cba52
Contents?: true
Size: 380 Bytes
Versions: 42
Compression:
Stored size: 380 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[Integer] xs = TSort.tsort(each_node, each_child)
Version data entries
42 entries across 42 versions & 1 rubygems