d3-dag
    Preparing search index...

    Function grid

    • create a new Grid with default settings.

      The grid layout algorithm constructs a horizontally compact topological representation of the dag. The nodes are topologically ordered and then put into lanes such that an edge can travel horizontally to the lane of a child node, and then down without intersecting to that child.

      This layout produces good representations when you want a compressed layout where each node is on an independent horizontal line.

      grid example

      Parameters

      • ...args: never[]

      Returns DefaultGrid

      The current implementation doesn't render multi-dags any differently, so multiple edges going to the same node will be rendered as a single edge. Self loops are the exception: each leaves below its node's center, runs up one side, and comes back in above, nested one inside the next. Loops go on whichever side fewer other links leave the node from, or on the right when tied.

      using the default layout

      const grf = ...
      const layout = grid();
      const { width, height } = layout(grf);
      for (const node of grf.nodes()) {
      console.log(node.x, node.y);
      }

      In addition to the standard modifications of Grid#rank, Grid#nodeSize, Grid#gap, and Grid#tweaks, Grid also supports altering the lane assignment Grid#lane:

      const grf = ...
      const layout = grid().lane(laneOpt());
      const { width, height } = layout(grf);
      for (const node of grf.nodes()) {
      console.log(node.x, node.y);
      }