UNPKG

d3-dag

Version:

Layout algorithms for visualizing directed acylic graphs.

8 lines (7 loc) 239 B
// Set each node's value to zero for leaf nodes and the greatest distance to // any leaf for other nodes export default function() { return this.eachAfter( (n) => (n.value = Math.max(0, ...n.children.map((c) => 1 + c.value))) ); }