A trees datastructure based on arrays
npm install trees-array-basedThe objective of this module is to provide a basic and generic Tree data structure and some of its derivatives.
This module is made using common js.
You can use this module in the following environments:
- browser
- node commonjs
- es6
What you get from this module
- This package has three main object classes for now.
- There are two different tree datastructures implemented.
#### TreeNode
The nodes of the tree.
You can use this class to create your own Tree structure based on arrays. Its also possible to use objects of this class in the Tree datastructure.
The complexity of dealing with this class is mostly abstracted.
#### Tree
A generic Tree structure.
This is the more typical type of trees.
#### NameHierarchicalTree
A Tree data structure that provides a hierarchy to the way that nodes are inserted based on the name of the nodes.
Example:
"father"
"father.child"
Here father.child is the child of the father and will be inserted as a child of the father node.
This Tree does'nt accepts repeated names.
js
const TreeNode = require("trees-array-based").TreeNode;
const Tree = require("trees-array-based").Tree;
const NameHierarchicalTree = require("trees-array-based").NameHierarchicalTree;
`
ES6 module syntax
`js
import {TreeNode, Tree, NameHierarchicalTree} from "trees-array-based"
`
Browser import the min.js file.
`js