Expand description
Graph database abstraction layer for Cognee.
This crate provides a trait-based interface for graph database operations, enabling pluggable graph database backends for knowledge graph storage.
§Architecture
GraphDBTrait- Async trait defining graph database operationsLadybugAdapter- Implementation using Ladybug (lbug) embedded graph databaseGraphNode/GraphEdge- Type aliases for node and edge data
§Example
ⓘ
use cognee_graph::{GraphDBTrait, LadybugAdapter};
use cognee_models::Entity;
let db = LadybugAdapter::new("./graph_data").await?;
db.initialize().await?;
let entity = Entity::new("Alice", EntityType::new("Person", None), Some("user-1"));
db.add_node(&entity).await?;Structs§
- Graph
Edge - Structured graph edge for easier construction
Enums§
- GraphDB
Error - Errors that can occur during graph database operations.
Traits§
- GraphDB
Trait - Graph database interface trait.
- GraphDB
Trait Ext - Extension trait providing generic convenience methods on top of
GraphDBTrait. Auto-implemented for all types that implementGraphDBTrait.
Functions§
- get_
formatted_ graph_ data - Fetch the formatted graph snapshot for a dataset.
Type Aliases§
- Edge
Data - Edge data: (source_id, target_id, relationship_name, properties)
- EdgeKey
- Composite key uniquely identifying an edge in the graph:
(source_id, target_id, relationship_name). - GraphDB
Result - Result type for graph database operations.
- Graph
Node - Graph node: (node_id, properties)
- Node
Data - Node data: arbitrary key-value properties Uses Cow<’static, str> for keys to avoid allocating static strings