API Reference
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
import { stratify } from "@graphrefly/ts/composition";
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
| 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
A Stratified<T, R> value.
Example
import { stratify } from "@graphrefly/ts/composition";
Source
packages/ts/src/graph/composition.ts