function _initializeDegreeLists(n, cptr, W, degree, elen, w, dense, nv, head, last, next) {
    // result
    var nel = 0; // loop columns

    for (var i = 0; i < n; i++) {
      // degree @ i
      var d = W[degree + i]; // check node i is empty

      if (d === 0) {
        // element i is dead
        W[elen + i] = -2;
        nel++; // i is a root of assembly tree

        cptr[i] = -1;
        W[w + i] = 0;
      } else if (d > dense) {
        // absorb i into element n
        W[nv + i] = 0; // node i is dead

        W[elen + i] = -1;
        nel++;
        cptr[i] = csFlip(n);
        W[nv + n]++;
      } else {
        var h = W[head + d];

        if (h !== -1) {
          last[h] = i;
        } // put node i in degree list d


        W[next + i] = W[head + d];
        W[head + d] = i;
      }
    }

    return nel;
  }
Initialize degree lists. Each node is placed in its degree lists. Nodes of zero degree are eliminated immediately. Nodes with
degree >= dense are alsol eliminated and merged into a placeholder node n, a dead element. Thes nodes will appera last in the
output permutation p.