pub trait GraphStore {
type Node;
type Edge;
type Error: Error + Send + Sync + 'static;
// Required methods
fn add_node(&mut self, node: Self::Node) -> Result<String>;
fn add_edge(
&mut self,
from_id: &str,
to_id: &str,
edge: Self::Edge,
) -> Result<String>;
fn find_nodes(&self, criteria: &str) -> Result<Vec<Self::Node>>;
fn get_neighbors(&self, node_id: &str) -> Result<Vec<Self::Node>>;
fn traverse(
&self,
start_id: &str,
max_depth: usize,
) -> Result<Vec<Self::Node>>;
fn stats(&self) -> GraphStats;
}Expand description
Graph operations abstraction for knowledge graph management
§Synchronous Version
This trait provides synchronous operations for graph management.
Required Associated Types§
Required Methods§
Sourcefn add_edge(
&mut self,
from_id: &str,
to_id: &str,
edge: Self::Edge,
) -> Result<String>
fn add_edge( &mut self, from_id: &str, to_id: &str, edge: Self::Edge, ) -> Result<String>
Add an edge between two nodes
Sourcefn traverse(&self, start_id: &str, max_depth: usize) -> Result<Vec<Self::Node>>
fn traverse(&self, start_id: &str, max_depth: usize) -> Result<Vec<Self::Node>>
Perform graph traversal
Sourcefn stats(&self) -> GraphStats
fn stats(&self) -> GraphStats
Get graph statistics