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
| Parameter | Type | Description |
|---|---|---|
snapshot | DescribeSnapshot | Describe snapshot to traverse. |
from | string | Starting node id. |
direction | ReachableDirection | Direction to follow when both is not set. |
options | ReachableOptions | Optional 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