sankeyJustify function

int sankeyJustify(
  1. SankeyNode node,
  2. int n
)

Aligns the node using a justifying algorithm

It returns the node's depth if it has outgoing links (i.e. it is a source), otherwise it assigns the node to the rightmost column. This mirrors d3‑sankey's "justify" alignment

Implementation

int sankeyJustify(SankeyNode node, int n) =>
    node.sourceLinks.isNotEmpty ? node.depth : n - 1;