_determineLevelsDirected() {
    const nodes = this.body.nodeIndices.reduce((acc, id) => {
      acc.set(id, this.body.nodes[id]);
      return acc;
    }, new Map());

    if (this.options.hierarchical.shakeTowards === "roots") {
      this.hierarchical.levels = fillLevelsByDirectionRoots(nodes);
    } else {
      this.hierarchical.levels = fillLevelsByDirectionLeaves(nodes);
    }

    this.hierarchical.setMinLevelToZero();
  }
Allocate nodes in levels based on the direction of the edges.
@private