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 the development version from GitHub:
# 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()valid_from /
valid_to)| 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