lib/data/d3.js
function recurse(data, depth, nodes) {
    var childs = children.call(hierarchy, data, depth),
        node = d3_layout_hierarchyInline ? data : {data: data};
    node.depth = depth;
    nodes.push(node);
    if (childs && (n = childs.length)) {
      var i = -1,
          n,
          c = node.children = [],
          v = 0,
          j = depth + 1,
          d;
      while (++i < n) {
        d = recurse(childs[i], j, nodes);
        d.parent = node;
        c.push(d);
        v += d.value;
      }
      if (sort) c.sort(sort);
      if (value) node.value = v;
    } else if (value) {
      node.value = +value.call(hierarchy, data, depth) || 0;
    }
    return node;
  }
function recurse(data, depth, nodes) {
    var childs = children.call(hierarchy, data, depth),
        node = d3_layout_hierarchyInline ? data : {data: data};
    node.depth = depth;
    nodes.push(node);
    if (childs && (n = childs.length)) {
      var i = -1,
          n,
          c = node.children = [],
          v = 0,
          j = depth + 1,
          d;
      while (++i < n) {
        d = recurse(childs[i], j, nodes);
        d.parent = node;
        c.push(d);
        v += d.value;
      }
      if (sort) c.sort(sort);
      if (value) node.value = v;
    } else if (value) {
      node.value = +value.call(hierarchy, data, depth) || 0;
    }
    return node;
  }
function recurse ( data , depth , nodes ) { var childs = children . call ( hierarchy , data , depth ) , node = d3_layout_hierarchyInline ? data : { data : data } ; node . depth = depth ; nodes . push ( node ) ; if ( childs && ( n = childs . length ) ) { var i = - 1 , n , c = node . children = [ ] , v = 0 , j = depth + 1 , d ; while ( ++ i < n ) { d = recurse ( childs [ i ] , j , nodes ) ; d . parent = node ; c . push ( d ) ; v += d . value ; } if ( sort ) c . sort ( sort ) ; if ( value ) node . value = v ; } else if ( value ) { node . value = + value . call ( hierarchy , data , depth ) || 0 ; } return node ; }
Recursively compute the node depth and value. Also converts the data representation into a standard hierarchy structure.
Recursively compute the node depth and value . Also converts the data representation into a standard hierarchy structure .