An R client for AstraeaDB, a graph database with vector search written in Rust. AstraeaDB provides node and edge CRUD operations, label and edge-type lookups, graph traversals (BFS, DFS, shortest path), temporal queries, graph algorithms (PageRank, Louvain, connected components, centrality), vector similarity search, hybrid graph-vector search, GQL query execution, and GraphRAG (subgraph extraction with LLM integration).
install.packages("AstraeaDB")Or the development version, which may be ahead of the CRAN release:
# install.packages("remotes")
remotes::install_github("AstraeaDB/R-AstraeaDB")A running AstraeaDB server is required. See the AstraeaDB documentation for installation and startup instructions.
library(AstraeaDB)
# Connect to a local AstraeaDB server
client <- astraea_connect()
# Create nodes
alice <- client$create_node("Person", list(name = "Alice", age = 30))
bob <- client$create_node("Person", list(name = "Bob", age = 25))
# Create an edge
client$create_edge(alice, bob, "KNOWS", list(since = "2024-01-01"))
# Traverse the graph
client$neighbors(alice)
client$bfs(alice, max_depth = 3)
client$shortest_path(alice, bob)
# Run a GQL query
client$query("MATCH (p:Person) WHERE p.age > 20 RETURN p")
# Disconnect when done
client$disconnect()- Node and edge CRUD -- create, read, update, and delete nodes and edges
- Graph traversals -- BFS, DFS, shortest path (weighted and unweighted), neighbor queries with direction and edge-type filtering
- Lookups -- find nodes by label, find edges by type, bulk-delete by label
- Batch operations -- bulk create and delete for nodes and edges
- Data frame integration -- import nodes/edges from data frames and export query results back to data frames
- Vector similarity search -- k-nearest neighbor search over node embeddings
- Hybrid search -- blend graph proximity with vector similarity using a tunable alpha parameter
- Semantic search -- rank neighbors by concept similarity or perform greedy semantic walks
- GraphRAG -- extract subgraphs and feed them to an LLM for retrieval-augmented generation
- Time-travel -- query the graph as it existed at any point in time using
edge validity windows (
valid_from/valid_to)
- PageRank, Louvain, connected components, degree and betweenness centrality -- classic analytics computed server-side over the whole graph or a node subset
- Graph statistics and subgraph export -- node/edge counts, label distribution, and raw subgraph retrieval for visualization
| Transport | Class | Use case |
|---|---|---|
| JSON/TCP (default) | AstraeaClient |
General-purpose, always available |
| Apache Arrow Flight | ArrowClient |
High-throughput columnar data transfer |
| Auto-select | UnifiedClient |
Picks the best available transport |
Arrow Flight support is optional and activates automatically when the arrow package is installed.
# Standard JSON/TCP client
client <- astraea_connect(host = "127.0.0.1", port = 7687)
# Arrow Flight client (requires the arrow package)
arrow_client <- astraea_arrow_connect(uri = "grpc://localhost:7689")
# Unified client -- delegates CRUD to JSON/TCP, queries to Arrow when available
unified <- UnifiedClient$new(host = "127.0.0.1", port = 7687)
unified$connect()The package ships with four vignettes:
- Introduction -- overview of AstraeaDB and its data model
- Getting started -- detailed walkthrough of CRUD, traversals, and queries
- Advanced features -- vector search, temporal queries, and GraphRAG
- PCAP analysis -- worked example converting network packet captures into a graph
Build vignettes locally with:
devtools::build_vignettes()| Package | Role |
|---|---|
| jsonlite | JSON serialisation |
| R6 | Object-oriented client classes |
| arrow (optional) | Arrow Flight transport |
MIT