(dimension, size)
| 5323 | charges = []; |
| 5324 | 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; |
| 5325 | function position(dimension, size) { |
| 5326 | var neighbors = neighbor(i), j = -1, m = neighbors.length, x; |
| 5327 | while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; |
| 5328 | return Math.random() * size; |
| 5329 | } |
| 5330 | function neighbor() { |
| 5331 | if (!neighbors) { |
| 5332 | neighbors = []; |