What is RubyTree?
RubyTree is a simple and general purpose implementation of the Tree data structure for the Ruby language. RubyTree aims to provide a simple to use node based model for the conceptual tree, and the ability to extend the model into specialized cases in user-generated code using generic APIs.
The current version provides implementations of:
- A general purpose node-based tree data structure, and
- A binary tree
Future versions may include other tree implementations such as the balanced binary, AVL and Red-Black trees.
RubyTree is available as a Rubygem and is released under the BSD License.
What's New?
- Minor maintenance version 0.8.2 released on 15th Dec 2011. This provides a fix for bug # 29435 (TreeNode#to_s breaks if @content or @parent.name is not a string).
- New version 0.8.1 released on 2nd Oct, 2010.
- Important! All method names now follow the snake_case naming convention. The old CamelCase method names will still work, but are deprecated and will display a warning.
- Child nodes can now be added at specific ordinal positions;
- A subtree can now be cloned in its entirety;
- Major Bug # 28613 has been fixed. This was impacting the behaviour of BinaryTreeNodes for the left_child= and right_child= assignments, where the parent of the added child was not being set.
- Minor code refactoring, and some documentation clean-up done.
- Internal documentation format has been converted to YARD.
- R0.8.1 is a major inflection point for the project. This is essentially a stabilization release, and future releases are expected to refocus on additional functionality, including the long overdue additional tree types such as BST, AVL and Red-Black.
Installing RubyTree
You can download and install the latest version by issuing the following command from your terminal/command line (you may need to do this as the super user): $ gem install rubytree
After install, you can check the documentation for RubyTree by looking up the RDoc using: $ yri Tree::TreeNode or by browsing the online documentation.