hierarchical-node-structure
v1.0.4
Published
The HierarchyNode class represents a node in a hierarchical data structure. Each node can have child nodes and a reference to its parent node. The class provides methods to manipulate and traverse the hierarchy, such as adding nodes, finding nodes by thei
Downloads
4
Readme
HierarchyNode
The HierarchyNode
class represents a node in a hierarchical structure.
Installation
npm i hierarchical-node-structure
Usage
const { HierarchyNode } = require('hierarchy-node');
// Create a root node
const rootNode = new HierarchyNode('Root');
// Add child nodes
const child1 = new HierarchyNode('Child 1');
const child2 = new HierarchyNode('Child 2');
rootNode.addNode(child1);
rootNode.addNode(child2);
Please refer to the GitHub README for full documentation.