@@ -6000,7 +6000,7 @@ d3 = function() {
60006000 return force ;
60016001 } ;
60026002 force . start = function ( ) {
6003- var i , j , n = nodes . length , m = links . length , w = size [ 0 ] , h = size [ 1 ] , neighbors , o ;
6003+ var i , n = nodes . length , m = links . length , w = size [ 0 ] , h = size [ 1 ] , neighbors , o ;
60046004 for ( i = 0 ; i < n ; ++ i ) {
60056005 ( o = nodes [ i ] ) . index = i ;
60066006 o . weight = 0 ;
@@ -6026,13 +6026,8 @@ d3 = function() {
60266026 charges = [ ] ;
60276027 if ( typeof charge === "function" ) for ( i = 0 ; i < n ; ++ i ) charges [ i ] = + charge . call ( this , nodes [ i ] , i ) ; else for ( i = 0 ; i < n ; ++ i ) charges [ i ] = charge ;
60286028 function position ( dimension , size ) {
6029- var neighbors = neighbor ( i ) , j = - 1 , m = neighbors . length , x ;
6030- while ( ++ j < m ) if ( ! isNaN ( x = neighbors [ j ] [ dimension ] ) ) return x ;
6031- return Math . random ( ) * size ;
6032- }
6033- function neighbor ( ) {
60346029 if ( ! neighbors ) {
6035- neighbors = [ ] ;
6030+ neighbors = new Array ( n ) ;
60366031 for ( j = 0 ; j < n ; ++ j ) {
60376032 neighbors [ j ] = [ ] ;
60386033 }
@@ -6042,7 +6037,9 @@ d3 = function() {
60426037 neighbors [ o . target . index ] . push ( o . source ) ;
60436038 }
60446039 }
6045- return neighbors [ i ] ;
6040+ var candidates = neighbors [ i ] , j = - 1 , m = candidates . length , x ;
6041+ while ( ++ j < m ) if ( ! isNaN ( x = candidates [ j ] [ dimension ] ) ) return x ;
6042+ return Math . random ( ) * size ;
60466043 }
60476044 return force . resume ( ) ;
60486045 } ;
0 commit comments