score:1

Accepted answer

In

 nodes.forEach(function(o, i) {
    o.y += i & 1 ? k : -k;
    o.x += i & 2 ? k : -k;

  });

You are using the index i for clustering... this won't work, you want to use arrInt[i] instead:

 nodes.forEach(function(o, i) {
    o.y += arrInt[i] & 1 ? k : -k;
    o.x += arrInt[i] & 2 ? k : -k;
  });

Related Query

More Query from same tag