(root)
| 138282 | exports.default = function() { |
| 138283 | var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null; |
| 138284 | function tree(root) { |
| 138285 | var t = treeRoot(root); |
| 138286 | // Compute the layout using Buchheim et al.’s algorithm. |
| 138287 | t.eachAfter(firstWalk), t.parent.m = -t.z; |
| 138288 | t.eachBefore(secondWalk); |
| 138289 | // If a fixed node size is specified, scale x and y. |
| 138290 | if (nodeSize) root.eachBefore(sizeNode); |
| 138291 | else { |
| 138292 | var left = root, right = root, bottom = root; |
| 138293 | root.eachBefore(function(node) { |
| 138294 | if (node.x < left.x) left = node; |
| 138295 | if (node.x > right.x) right = node; |
| 138296 | if (node.depth > bottom.depth) bottom = node; |
| 138297 | }); |
| 138298 | var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1); |
| 138299 | root.eachBefore(function(node) { |
| 138300 | node.x = (node.x + tx) * kx; |
| 138301 | node.y = node.depth * ky; |
| 138302 | }); |
| 138303 | } |
| 138304 | return root; |
| 138305 | } |
| 138306 | // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is |
| 138307 | // applied recursively to the children of v, as well as the function |
| 138308 | // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the |
nothing calls this directly
no test coverage detected