shiftElementsCloser = (callback, levels, centerParents) => {
      const hier = this.hierarchical;

      for (let i = 0; i < levels.length; i++) {
        const level = levels[i];
        const levelNodes = hier.distributionOrdering[level];
        if (levelNodes.length > 1) {
          for (let j = 0; j < levelNodes.length - 1; j++) {
            const node1 = levelNodes[j];
            const node2 = levelNodes[j + 1];

            // NOTE: logic maintained as it was; if nodes have same ancestor,
            //       then of course they are in the same sub-network.
            if (
              hier.hasSameParent(node1, node2) &&
              hier.inSameSubNetwork(node1, node2)
            ) {
              callback(node1, node2, centerParents);
            }
          }
        }
      }
    }
Condense elements. These can be nodes or branches depending on the callback.
@param {Function} callback
@param {Array.<number>} levels
@param {*} centerParents