Skip to main content
The graph engine is the core of Kremis. It stores nodes (entities), edges (relationships), and properties (attributes) in a fully deterministic structure.

Data Structures

All collections use BTreeMap for deterministic iteration order — no HashMap is used anywhere in the core.

Storage Backends

In-Memory

Graph struct in RAM. Fast, volatile. Used for testing and temporary sessions.

Persistent (redb)

ACID transactions, crash-safe. Copy-on-write B-trees with MVCC concurrent readers.

RedbGraph Tables

Query Algorithms

All traversals return an Artifact containing the path and optional subgraph edges.

Export Formats

Canonical (bit-exact)

  • Magic: b"KREX", version 2
  • Checksum: XOR-based deterministic hash
  • Import limits: 1M nodes, 10M edges (DoS protection)
  • V1 backward compatibility (imports without properties)

JSON

SerializableGraph with serde — nodes, edges, next_node_id, properties.
Last modified on March 21, 2026