Skip to main content

Crate cognee_graph

Crate cognee_graph 

Source
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 operations
  • LadybugAdapter - Implementation using Ladybug (lbug) embedded graph database
  • GraphNode / 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§

GraphEdge
Structured graph edge for easier construction

Enums§

GraphDBError
Errors that can occur during graph database operations.

Traits§

GraphDBTrait
Graph database interface trait.
GraphDBTraitExt
Extension trait providing generic convenience methods on top of GraphDBTrait. Auto-implemented for all types that implement GraphDBTrait.

Functions§

get_formatted_graph_data
Fetch the formatted graph snapshot for a dataset.

Type Aliases§

EdgeData
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).
GraphDBResult
Result type for graph database operations.
GraphNode
Graph node: (node_id, properties)
NodeData
Node data: arbitrary key-value properties Uses Cow<’static, str> for keys to avoid allocating static strings