graph()
Construct a graph with graph-local topology, lifecycle, and inspection ownership.
Import
Section titled “Import”import { graph } from "@graphrefly/ts/graph";Signature
Section titled “Signature”function graph(opts: GraphOptions = {}): GraphParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
opts | GraphOptions | Optional graph name, dispatcher, versioning policy, environment drivers, and profiling switch. |
Returns
Section titled “Returns”A Graph instance whose sugar methods create graph-registered nodes.
Example
Section titled “Example”import { graph } from "@graphrefly/ts/graph";
const g = graph({ name: "counter" });const count = g.state(0, { name: "count" });const doubled = g.derived([count], ([value]) => value * 2);Source
Section titled “Source”packages/ts/src/graph/graph.ts