stratify()
Build static stratification branches in g (D56 first cut). Rules are a state node so future
classifier data changes affect future source items, but branch count is fixed at construction.
Import
Section titled “Import”import { stratify } from "@graphrefly/ts/composition";Signature
Section titled “Signature”function stratify( g: Graph, source: Node<T>, rules: readonly StratifyRule<R>[], classifier: (rule: R, value: T) => boolean, opts: StratifyOptions<R> = {},): Stratified<T, R>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
g | Graph | Graph that owns the created nodes or projector. |
source | Node<T> | Source node that provides graph-visible input. |
rules | readonly StratifyRule<R>[] | rules value used by the helper. |
classifier | (rule: R, value: T) => boolean | classifier value used by the helper. |
opts | StratifyOptions<R> | Options that configure the helper. |
Returns
Section titled “Returns”A Stratified<T, R> value.
Example
Section titled “Example”import { stratify } from "@graphrefly/ts/composition";Source
Section titled “Source”packages/ts/src/graph/composition.ts