You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ScalarValue::Bytes converts to PropertyValue::Null since PropertyValue
does not support binary data.
Error Types
Error
Cause
NodeNotFound(u64)
Node with given ID does not exist
EdgeNotFound(u64)
Edge with given ID does not exist
PathNotFound
No path exists between the specified nodes
StorageError(String)
Underlying Tensor Store error
Direction Enum
Direction
Behavior
Outgoing
Follow edges away from the node
Incoming
Follow edges toward the node
Both
Follow edges in either direction
Storage Key Patterns
Nodes and edges are stored in Tensor Store using the following key patterns:
Key Pattern
Content
TensorData Fields
node:{id}
Node data
_id, _type="node", _label, user properties
node:{id}:out
List of outgoing edge IDs
e{edge_id} fields
node:{id}:in
List of incoming edge IDs
e{edge_id} fields
edge:{id}
Edge data
_id, _type="edge", _from, _to, _edge_type, _directed, user properties
Edge List Storage Format
Edge lists are stored as TensorData with dynamically named fields:
// Each edge ID stored as: "e{edge_id}" -> edge_id
tensor.set("e1",TensorValue::Scalar(ScalarValue::Int(1)));
tensor.set("e5",TensorValue::Scalar(ScalarValue::Int(5)));
This format allows O(1) edge addition but O(n) edge listing.
Entity Edge Key Format
Entity edges use a different key format from node-based edges:
edge:{edge_type}:{edge_id}
For example: edge:follows:42
Reserved Entity Fields
Field
Type
Purpose
_out
Vec<String>
Outgoing edge keys
_in
Vec<String>
Incoming edge keys
_embedding
Vec<f32>
Vector embedding
_type
String
Entity type
_id
i64
Entity numeric ID
_label
String
Entity label
Engine Construction
// Create new engine with internal storelet engine = GraphEngine::new();// Create engine with shared store (for cross-engine queries)let store = TensorStore::new();let engine = GraphEngine::with_store(store.clone());// Access underlying storelet store = engine.store();
The Query Router provides unified queries combining graph traversal with
vector similarity:
// Find entities similar to query that are connected to a specific entitylet items = router.find_similar_connected("query:entity","connected_to:entity", top_k)?;// Find graph neighbors sorted by embedding similaritylet items = router.find_neighbors_by_similarity("entity:key",&query_vector, top_k)?;
Tensor Vault Integration
Tensor Vault uses GraphEngine for access control relationships. Access
control edges connect principals to secrets with permission metadata.
Tensor Chain Integration
Tensor Chain uses GraphEngine for block linking. Blocks are stored with
chain:block:{height} keys and linked via graph edges with type chain_next.
Performance Characteristics
Operation
Complexity
Notes
create_node
O(1)
Store put
create_edge
O(1)
Store put + edge list updates
get_node
O(1)
Store get
get_edge
O(1)
Store get
neighbors
O(e)
e = edges from node
traverse
O(n + e)
BFS over reachable nodes
find_path
O(n + e)
BFS shortest path
delete_node
O(e)
Parallel for e >= 100
node_count
O(k)
k = total keys (scan-based)
get_edge_list
O(k)
k = keys in edge list
Memory Characteristics
Data
Storage
Node
~50-200 bytes + properties
Edge
~50-150 bytes + properties
Edge list entry
~10 bytes per edge
Configuration
The Graph Engine has minimal configuration as it inherits behavior from
TensorStore: