| 6409 | charges = []; |
| 6410 | 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; |
| 6411 | function position(dimension, size) { |
| 6412 | if (!neighbors) { |
| 6413 | neighbors = new Array(n); |
| 6414 | for (j = 0; j < n; ++j) { |
| 6415 | neighbors[j] = []; |
| 6416 | } |
| 6417 | for (j = 0; j < m; ++j) { |
| 6418 | var o = links[j]; |
| 6419 | neighbors[o.source.index].push(o.target); |
| 6420 | neighbors[o.target.index].push(o.source); |
| 6421 | } |
| 6422 | } |
| 6423 | var candidates = neighbors[i], j = -1, l = candidates.length, x; |
| 6424 | while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x; |
| 6425 | return Math.random() * size; |
| 6426 | } |
| 6427 | return force.resume(); |
| 6428 | }; |
| 6429 | force.resume = function() { |