setOptions(options, allOptions) {
    if (options !== undefined) {
      const hierarchical = this.options.hierarchical;
      const prevHierarchicalState = hierarchical.enabled;
      selectiveDeepExtend(
        ["randomSeed", "improvedLayout", "clusterThreshold"],
        this.options,
        options
      );
      mergeOptions(this.options, options, "hierarchical");

      if (options.randomSeed !== undefined) {
        this._resetRNG(options.randomSeed);
      }

      if (hierarchical.enabled === true) {
        if (prevHierarchicalState === true) {
          // refresh the overridden options for nodes and edges.
          this.body.emitter.emit("refresh", true);
        }

        // make sure the level separation is the right way up
        if (
          hierarchical.direction === "RL" ||
          hierarchical.direction === "DU"
        ) {
          if (hierarchical.levelSeparation > 0) {
            hierarchical.levelSeparation *= -1;
          }
        } else {
          if (hierarchical.levelSeparation < 0) {
            hierarchical.levelSeparation *= -1;
          }
        }

        this.setDirectionStrategy();

        this.body.emitter.emit("_resetHierarchicalLayout");
        // because the hierarchical system needs it's own physics and smooth curve settings,
        // we adapt the other options if needed.
        return this.adaptAllOptionsForHierarchicalLayout(allOptions);
      } else {
        if (prevHierarchicalState === true) {
          // refresh the overridden options for nodes and edges.
          this.body.emitter.emit("refresh");
          return deepExtend(allOptions, this.optionsBackup);
        }
      }
    }
    return allOptions;
  }
@param {object} options
@param {object} allOptions
@returns {object}