function position(dimension, size) {
      if (!neighbors) {
        neighbors = new Array(n);
        for (j = 0; j < n; ++j) {
          neighbors[j] = [];
        }
        for (j = 0; j < m; ++j) {
          var o = links[j];
          neighbors[o.source.index].push(o.target);
          neighbors[o.target.index].push(o.source);
        }
      }
      var candidates = neighbors[i],
          j = -1,
          l = candidates.length,
          x;
      while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x;
      return Math.random() * size;
    }
// initialize neighbors lazily to avoid overhead when not needed
initialize neighbors lazily to avoid overhead when not needed
initialize neighbors lazily to avoid overhead when not needed
function position(dimension, size) {
      if (!neighbors) {
        neighbors = new Array(n);
        for (j = 0; j < n; ++j) {
          neighbors[j] = [];
        }
        for (j = 0; j < m; ++j) {
          var o = links[j];
          neighbors[o.source.index].push(o.target);
          neighbors[o.target.index].push(o.source);
        }
      }
      var candidates = neighbors[i],
          j = -1,
          l = candidates.length,
          x;
      while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x;
      return Math.random() * size;
    }
function position ( dimension , size ) { if ( ! neighbors ) { neighbors = new Array ( n ) ; for ( j = 0 ; j < n ; ++ j ) { neighbors [ j ] = [ ] ; } for ( j = 0 ; j < m ; ++ j ) { var o = links [ j ] ; neighbors [ o . source . index ] . push ( o . target ) ; neighbors [ o . target . index ] . push ( o . source ) ; } } var candidates = neighbors [ i ] , j = - 1 , l = candidates . length , x ; while ( ++ j < l ) if ( ! isNaN ( x = candidates [ j ] [ dimension ] ) ) return x ; return Math . random ( ) * size ; }
initialize neighbors lazily to avoid overhead when not needed
initialize neighbors lazily to avoid overhead when not needed