GraphReFlyTS

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

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.

Returns

A Stratified<T, R> value.

Example

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

Source

packages/ts/src/graph/composition.ts