Interface Rank<NodeDatum, LinkDatum>

a way to enforce specific rankings of nodes

A rank accessor assigns a numeric rank to some nodes. In general, nodes with a lower rank come before nodes with a higher rank. Layering operators that take a rank accessor additionally guarantee that nodes with the same rank will share the same layer (if possible).

Example

This example demonstrates passing through a rank value that might exist on a node.

function memberRank({ data }: GraphNode<{ rank?: number }>): number | undefined {
return data.rank;
}

Type Parameters

  • in NodeDatum = never

  • in LinkDatum = never

Hierarchy

  • Rank
  • compute the rank of a node

    Parameters

    • node: GraphNode<NodeDatum, LinkDatum>

      the node to compute the rank of

    Returns undefined | number

    rank - the rank of the node; if defined lower ranks indicate nodes that come earlier (lower y's)

Generated using TypeDoc