Method: Bio::Tree#ancestors
- Defined in:
- lib/bio/tree.rb
#ancestors(node, root = nil) ⇒ Object
Gets all ancestral nodes of the node. If root isn’t specified or root is nil, @root is used. Returns an array of Nodes. The result is unspecified for cyclic trees.
757 758 759 760 |
# File 'lib/bio/tree.rb', line 757 def ancestors(node, root = nil) root ||= @root (self.path(root, node) - [ node ]).reverse end |