Skip to content
PACKAGES

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 { stratify } from "@graphrefly/ts/composition";
function stratify(
g: Graph,
source: Node<T>,
rules: readonly StratifyRule<R>[],
classifier: (rule: R, value: T) => boolean,
opts: StratifyOptions<R> = {},
): Stratified<T, R>
ParameterTypeDescription
gGraphGraph that owns the created nodes or projector.
sourceNode<T>Source node that provides graph-visible input.
rulesreadonly StratifyRule<R>[]rules value used by the helper.
classifier(rule: R, value: T) => booleanclassifier value used by the helper.
optsStratifyOptions<R>Options that configure the helper.

A Stratified<T, R> value.

import { stratify } from "@graphrefly/ts/composition";

packages/ts/src/graph/composition.ts