Sha256: 7d51fd0e29b1906010dda9f0e179e15b497e587132d7a9e0b83640c6a8a4c767
Contents?: true
Size: 372 Bytes
Versions: 1
Compression:
Stored size: 372 Bytes
Contents
module RootedTree class Tree attr_reader :root def initialize(node) @root = node.root @root.freeze end # Degree # # Returns the maximum degree (number of children) in the tree. def degree max_degree_node = root.each.max_by do |node| node.degree end max_degree_node.degree end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rooted_tree-0.2.0 | lib/rooted_tree/tree.rb |