Tree
The Tree class represents a hierarchical dataset. Tree objects are created by importing JSON files in a specific format using the treejson function:
let tree = await msc.treejson("data.json");
A tree is represented using two data tables, one for the nodes and one for the parent-child relationships (Figure 1). A unique id is assigned to each node in the node table. Mascot automatically infers the data type for each node attribute, and parses the values accordingly.

Figure 1: a tree dataset is parsed as two data tables
Properties
| property | explanation | type | default value |
|---|---|---|---|
nodeTable ![]() | the nodes in the tree | DataTable | |
linkTable ![]() | the links in the tree | DataTable |
Methods
| method | explanation | return type |
|---|---|---|
| getRoot() | returns the root of the tree | Object |
| getChildren(node) | returns the children of a node object | Array |
| getParent(node) | returns the parent of a node object | Object |
| getMaxDepth() | returns the maximum depth in the tree | Number |
