Skip to content

serializeGraph(graph, options?): Uint8Array

Defined in: packages/graph/src/serialization.ts:121

Serialize a graph into canonical binary bytes that restore the same layout.

The payload is the graph’s edges() columns: sources delta-coded, targets at the smallest width that holds a vertex, and weights as little-endian float64, inside a knotkit/wire envelope whose header carries the kind, the four flags, and the producer version. Two graphs serialize to equal bytes when they have the same kind, vertex count, flags, and edges(), and are written by the same package version with the same integrity setting.

Graph

SerializeGraphOptions

Uint8Array

With code FOREIGN_GRAPH when graph was not produced by this package, or SERIALIZATION_LIMIT_EXCEEDED when it has more than GRAPH_MAX_DECODE_VERTICES vertices.