Skip to main content

Module graph

Module graph 

Source
Expand description

graph section codecs (chunk-to-chunk csr adjacency and, later, the entity/property-graph sections). all are OPTIONAL and EXCLUDED from content_hash, additive within frozen format v1, and never touch the embedding hot path. G1 ships only adjacency (SECTION_GRAPH_ADJACENCY, 0x0C); the entity sections (0x11..=0x13) land in G2.

Structs§

CsrParts
the validated csr columns the runtime CsrIndex indexes in O(1): offsets (len n_nodes+1) bounds each node’s run in neighbors (absolute decoded dst ids) and edge_types (1:1 with neighbors).
Edge
one directed edge: src -> dst of a given edge_type.

Constants§

EDGE_TYPE_CITATION
EDGE_TYPE_NEXT_CHUNK
edge type ids. a u8 column (iso single scalar when uniform).
EDGE_TYPE_SEMANTIC
GRAPH_ADJACENCY_PAYLOAD_VERSION
internal payload version for the csr layout. bumped on an internal layout change, NEVER URNA_FORMAT_VERSION (the same lane-c discipline as HNSW_PAYLOAD_VERSION).
GRAPH_MAX_DEGREE
hostile-input cap on a single node’s out-degree. a real chunk graph (NEXT_CHUNK + top-m semantic + citations) never approaches this, so it never rejects a valid file; it bounds an untrusted decoded degree before any allocation from a claim alone.

Functions§

decode_graph_adjacency
decode the csr payload back to its canonical edge list (the exact order encode_graph_adjacency emitted: ascending src, edge_type, dst). typed errors on any truncation or hostile claim; never panics.
encode_graph_adjacency
encode edges over n_nodes chunk ordinals into the csr payload, byte- identical for the same edge set (canonical sort). every src/dst < n.
parse_csr_parts
parse the csr payload into validated owned columns (the single parser): bounds-checks the header, monotone offsets, degree cap, column lengths, and dst range, then de-gaps the neighbor ids into absolute ids so neighbors[start..end] is a contiguous slice per node. never panics.