GraphReFlyTS

API Reference

reachable()

Traverse reachable nodes in a describe snapshot.

Import

import { reachable } from "@graphrefly/ts/graph";

Signature

function reachable(
	snapshot: DescribeSnapshot,
	from: string,
	direction: ReachableDirection,
	options: ReachableOptions = {},
): readonly string[] | ReachableResult

Parameters

ParameterTypeDescription
snapshotDescribeSnapshotDescribe snapshot to traverse.
fromstringStarting node id.
directionReachableDirectionDirection to follow when both is not set.
optionsReachableOptionsOptional depth and detail controls.

Returns

Reachable node ids, or a detailed result when withDetail is true.

Example

reachable(snapshot, "root", "downstream");

Source

packages/ts/src/graph/diagnostics.ts