graphmind_sdk/lib.rs
1//! Graphmind SDK — Client library for the Graphmind Graph Database
2//!
3//! Provides two client implementations:
4//!
5//! - **`EmbeddedClient`** — In-process, no network. Uses `GraphStore` and `QueryEngine`
6//! directly. Ideal for tests, examples, and embedded applications.
7//!
8//! - **`RemoteClient`** — Connects to a running Graphmind server via HTTP.
9//! For production client applications.
10//!
11//! Both implement the `GraphmindClient` trait for a unified API.
12//!
13//! Extension traits (EmbeddedClient only):
14//! - **`AlgorithmClient`** — PageRank, WCC, SCC, BFS, Dijkstra, and more
15//! - **`VectorClient`** — Vector index creation, insertion, and k-NN search
16//!
17//! # Quick Start
18//!
19//! ```rust
20//! use graphmind_sdk::{EmbeddedClient, GraphmindClient};
21//!
22//! #[tokio::main]
23//! async fn main() {
24//! let client = EmbeddedClient::new();
25//!
26//! // Create data
27//! client.query("default", r#"CREATE (n:Person {name: "Alice"})"#)
28//! .await.unwrap();
29//!
30//! // Query data
31//! let result = client.query_readonly("default", "MATCH (n:Person) RETURN n.name")
32//! .await.unwrap();
33//! println!("Found {} records", result.len());
34//! }
35//! ```
36
37pub mod algo;
38pub mod client;
39pub mod embedded;
40pub mod error;
41pub mod models;
42pub mod remote;
43pub mod vector_ext;
44
45// ============================================================
46// Core SDK types
47// ============================================================
48
49pub use client::GraphmindClient;
50pub use embedded::EmbeddedClient;
51pub use error::{GraphmindError, GraphmindResult};
52pub use models::{QueryResult, SdkEdge, SdkNode, ServerStatus, StorageStats};
53pub use remote::RemoteClient;
54
55// ============================================================
56// Extension traits (EmbeddedClient only)
57// ============================================================
58
59pub use algo::AlgorithmClient;
60pub use vector_ext::VectorClient;
61
62// ============================================================
63// Graph types (re-exported from graphmind core)
64// ============================================================
65
66pub use graphmind::graph::{
67 Edge, EdgeId, EdgeType, GraphError, GraphResult, GraphStore, Label, Node, NodeId, PropertyMap,
68 PropertyValue,
69};
70pub use graphmind::query::{CacheStats, QueryEngine, RecordBatch};
71
72// ============================================================
73// Algorithm types (re-exported from graphmind-graph-algorithms)
74// ============================================================
75
76pub use graphmind::algo::{
77 bfs, build_view, count_triangles, dijkstra, edmonds_karp, page_rank, pca, prim_mst,
78 strongly_connected_components, weakly_connected_components, FlowResult, MSTResult,
79 PageRankConfig, PathResult, PcaConfig, PcaResult, PcaSolver, SccResult, WccResult,
80};
81pub use graphmind_graph_algorithms::GraphView;
82
83// ============================================================
84// Vector types (re-exported from graphmind core)
85// ============================================================
86
87pub use graphmind::vector::{
88 DistanceMetric, IndexKey, VectorError, VectorIndex, VectorIndexManager, VectorResult,
89};
90
91// ============================================================
92// NLQ types (re-exported from graphmind core)
93// ============================================================
94
95pub use graphmind::{NLQError, NLQPipeline, NLQResult};
96
97// ============================================================
98// Agent types (re-exported from graphmind core)
99// ============================================================
100
101pub use graphmind::agent::AgentRuntime;
102
103// ============================================================
104// Persistence & Multi-Tenancy types (re-exported from graphmind core)
105// ============================================================
106
107pub use graphmind::persistence::tenant::{AgentConfig, ToolConfig};
108pub use graphmind::{
109 AutoEmbedConfig, LLMProvider, NLQConfig, PersistenceError, PersistenceManager,
110 PersistenceResult, PersistentStorage, StorageError, StorageResult, Wal, WalEntry, WalError,
111 WalResult,
112};
113
114// ============================================================
115// Optimization types (re-exported from graphmind-optimization)
116// ============================================================
117
118pub use graphmind_optimization::algorithms::{
119 ABCSolver, BatSolver, CuckooSolver, DESolver, FireflySolver, GASolver, GWOSolver, JayaSolver,
120 NSGA2Solver, PSOSolver, RaoSolver, SASolver, TLBOSolver,
121};
122pub use graphmind_optimization::{
123 Individual, MultiObjectiveIndividual, MultiObjectiveProblem, MultiObjectiveResult,
124 OptimizationResult, Problem, SimpleProblem, SolverConfig,
125};
126
127// ============================================================
128// ndarray (re-exported for optimization problem definitions)
129// ============================================================
130
131pub use ndarray::Array1;
132
133// ============================================================
134// Version
135// ============================================================
136
137pub use graphmind::VERSION;