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).

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