Expand description
GraphQLite - SQLite extension for graph queries using Cypher
This crate provides Rust bindings for GraphQLite, allowing you to use Cypher graph queries in SQLite databases.
§High-Level Graph API
The Graph struct provides an ergonomic interface for common graph operations:
use graphqlite::Graph;
let g = Graph::open(":memory:")?;
// Add nodes
g.upsert_node("alice", [("name", "Alice"), ("age", "30")], "Person")?;
g.upsert_node("bob", [("name", "Bob"), ("age", "25")], "Person")?;
// Add edge
g.upsert_edge("alice", "bob", [("since", "2020")], "KNOWS")?;
// Query
println!("{:?}", g.stats()?);
println!("{:?}", g.get_neighbors("alice")?);
// Graph algorithms
let ranks = g.pagerank(0.85, 20)?;
let communities = g.community_detection(10)?;§Low-Level Cypher API
The Connection struct provides direct Cypher query access:
use graphqlite::Connection;
let conn = Connection::open(":memory:")?;
// Create nodes
conn.cypher("CREATE (n:Person {name: 'Alice', age: 30})")?;
// Query the graph
let results = conn.cypher("MATCH (n:Person) RETURN n.name, n.age")?;
for row in &results {
println!("{}: {}", row.get::<String>("n.name")?, row.get::<i64>("n.age")?);
}Structs§
- AStar
Result - A* shortest path result.
- Apsp
Result - All pairs shortest path result for a single pair.
- Betweenness
Centrality Result - Betweenness centrality result for a single node.
- Bulk
Insert Result - Result of a bulk insert operation.
- Cache
Status - Cache operation status returned by load/unload/reload operations.
- Closeness
Centrality Result - Closeness centrality result for a single node.
- Community
Result - Community detection result for a single node.
- Component
Result - Connected component result for a single node.
- Connection
- A GraphQLite database connection.
- Cypher
Query - A builder for constructing and executing parameterized Cypher queries.
- Cypher
Result - Result of a Cypher query, containing zero or more rows.
- Degree
Centrality Result - Degree centrality result for a single node.
- Eigenvector
Centrality Result - Eigenvector centrality result for a single node.
- Graph
- High-level graph operations.
- Graph
Manager - Manager for multiple graph databases in a directory.
- Graph
Stats - Graph statistics containing node and edge counts.
- KnnResult
- K-nearest neighbor result.
- Node
Similarity Result - Node similarity result using Jaccard coefficient.
- Page
Rank Result - PageRank result for a single node.
- Row
- A single row from a Cypher query result.
- Shortest
Path Result - Shortest path result from Dijkstra’s algorithm.
- Traversal
Result - Traversal result for BFS/DFS.
- Triangle
Count Result - Triangle count result for a single node.
Enums§
- Error
- Error type for GraphQLite operations.
- Value
- A dynamically-typed value returned from a Cypher query.
Statics§
- CYPHER_
RESERVED - Cypher reserved keywords that can’t be used as relationship types.
Functions§
- escape_
string - Escape a string for use in Cypher queries.
- format_
value - Format a value for inclusion in a Cypher query.
- graph
- Create a new Graph instance (convenience function).
- graphs
- Create a new GraphManager instance (convenience function).
- sanitize_
rel_ type - Sanitize a relationship type for use in Cypher.
Type Aliases§
- Result
- Result type for GraphQLite operations.