MCPcopy Create free account
hub / github.com/microsoft/SandDance / treeRoot

Function treeRoot

docs/app/js/sanddance-app.js:138265–138280  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

138263}
138264TreeNode.prototype = Object.create((0, _indexJs.Node).prototype);
138265function treeRoot(root) {
138266 var tree = new TreeNode(root, 0), node, nodes = [
138267 tree
138268 ], child, children, i, n;
138269 while(node = nodes.pop())if (children = node._.children) {
138270 node.children = new Array(n = children.length);
138271 for(i = n - 1; i >= 0; --i){
138272 nodes.push(child = node.children[i] = new TreeNode(children[i], i));
138273 child.parent = node;
138274 }
138275 }
138276 (tree.parent = new TreeNode(null, 0)).children = [
138277 tree
138278 ];
138279 return tree;
138280}
138281// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
138282exports.default = function() {
138283 var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null;

Callers 1

treeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected