src/tree.js
function firstWalk(v) {
    var children = v.children,
        siblings = v.parent.children,
        w = v.i ? siblings[v.i - 1] : null;
    if (children) {
      executeShifts(v);
      var midpoint = (children[0].z + children[children.length - 1].z) / 2;
      if (w) {
        v.z = w.z + separation(v._, w._);
        v.m = v.z - midpoint;
      } else {
        v.z = midpoint;
      }
    } else if (w) {
      v.z = w.z + separation(v._, w._);
    }
    v.parent.A = apportion(v, w, v.parent.A || siblings[0]);
  }
function firstWalk(v) {
    var children = v.children,
        siblings = v.parent.children,
        w = v.i ? siblings[v.i - 1] : null;
    if (children) {
      executeShifts(v);
      var midpoint = (children[0].z + children[children.length - 1].z) / 2;
      if (w) {
        v.z = w.z + separation(v._, w._);
        v.m = v.z - midpoint;
      } else {
        v.z = midpoint;
      }
    } else if (w) {
      v.z = w.z + separation(v._, w._);
    }
    v.parent.A = apportion(v, w, v.parent.A || siblings[0]);
  }
function firstWalk ( v ) { var children = v . children , siblings = v . parent . children , w = v . i ? siblings [ v . i - 1 ] : null ; if ( children ) { executeShifts ( v ) ; var midpoint = ( children [ 0 ] . z + children [ children . length - 1 ] . z ) / 2 ; if ( w ) { v . z = w . z + separation ( v . _ , w . _ ) ; v . m = v . z - midpoint ; } else { v . z = midpoint ; } } else if ( w ) { v . z = w . z + separation ( v . _ , w . _ ) ; } v . parent . A = apportion ( v , w , v . parent . A || siblings [ 0 ] ) ; }
Computes a preliminary x-coordinate for v. Before that, FIRST WALK is applied recursively to the children of v, as well as the function APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the node v is placed to the midpoint of its outermost children.
Computes a preliminary x - coordinate for v . Before that FIRST WALK is applied recursively to the children of v as well as the function APPORTION . After spacing out the children by calling EXECUTE SHIFTS the node v is placed to the midpoint of its outermost children .