_centerParent(node) {
    if (this.hierarchical.parentReference[node.id]) {
      const parents = this.hierarchical.parentReference[node.id];
      for (let i = 0; i < parents.length; i++) {
        const parentId = parents[i];
        const parentNode = this.body.nodes[parentId];
        const children = this.hierarchical.childrenReference[parentId];

        if (children !== undefined) {
          // get the range of the children
          const newPosition = this._getCenterPosition(children);

          const position = this.direction.getPosition(parentNode);
          const [minSpace, maxSpace] = this._getSpaceAroundNode(parentNode);
          const diff = position - newPosition;
          if (
            (diff < 0 &&
              Math.abs(diff) <
                maxSpace - this.options.hierarchical.nodeSpacing) ||
            (diff > 0 &&
              Math.abs(diff) < minSpace - this.options.hierarchical.nodeSpacing)
          ) {
            this.direction.setPosition(parentNode, newPosition);
          }
        }
      }
    }
  }
We use this method to center a parent node and check if it does not cross other nodes when it does.
@param {Node} node
@private