DeveloperLiberationFront / Excel-Function-Visualizer

Justin tends to his trees
2 stars 1 forks source link

Total Number of Nodes in Tree #19

Open jalanmiddleton opened 8 years ago

jalanmiddleton commented 8 years ago

It's informative to see how many node constitute the entire tree, this this captures variability within the tree (rather than simply frequency). Put that somewhere?

Gmaster89 commented 8 years ago

Something like this could be added to treeMaker.js: // This will traverse the whole tree, leave the leaf node and will give the child with max count of nodes.

getWholeCount = function (obj) { var count = 0; if (obj.children) { obj.children.forEach(function (d) { var tmpCount = getWholeCount(d) if (tmpCount > count) { count = tmpCount } }) } return 1 + count }

// Result could be shown on corner of the window for the opened tree.