eIndex = 0;
let levels = [];
let n = 0;
let nodeGroups = {};
let groupIndex = 1;

for (let j=0; j<NUM_LEVELS; j++) {
  levels[j] = [];

  if (j === 0) {
    let group = 0;
    model.nodes[n] = {
      group: group
    };
    nodeGroups[n] = group;
    levels[j].push(n);
    n++;
  }
  else {
    let lastLevel = levels[j-1];
    let lastLevelLen = lastLevel.length;
    let numNodes = lastLevelLen + lastLevelLen * Math.floor(Math.random() * MAX_LEVEL_MULTIPLIER);

    for (let k=0; k<numNodes; k++) {
      le