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.

tree import

Figure 1: a tree dataset is parsed as two data tables

Properties

propertyexplanationtypedefault value
nodeTable the nodes in the treeDataTable
linkTable the links in the treeDataTable

Methods

methodexplanationreturn type
getRoot()returns the root of the treeObject
getChildren(node)returns the children of a node objectArray
getParent(node)returns the parent of a node objectObject
getMaxDepth()returns the maximum depth in the treeNumber