Data / relationships and context
P2 · Advanced
Graph DB
Store entities and relationships, traverse connections, and find patterns across linked information.
A graph has a name. Nodes and edges inside it have types you choose, such as Tenant and RENTS.
Paths in the tables are relative to https://api.ultrahost.com/v1/projects/{projectId}. Pagination, idempotency, and errors are described in Conventions.
Create
Graphs
| SDK | REST | Description |
|---|---|---|
graph.create(name, config?) | POST /graphs | Create a graph |
graph.get(name) | GET /graphs/{name} | Retrieve graph configuration |
graph.list() | GET /graphs | List graphs |
graph.delete(name) | DELETE /graphs/{name} | Delete a graph |
Nodes and edges
| SDK | REST | Description |
|---|---|---|
graph.createNode(graph, node) | POST /graphs/{graph}/nodes | Create a node |
graph.createEdge(graph, edge) | POST /graphs/{graph}/edges | Create a relationship |
await ultrahost.graph.createNode("real-estate", {
id: "tenant-123",
type: "Tenant",
properties: { name: "John Smith" }
});
await ultrahost.graph.createEdge("real-estate", {
from: "tenant-123",
to: "property-456",
type: "RENTS"
});Create the graph before writing nodes. As with documents, the first write does not silently provision the graph.
Configure
Traversal needs explicit limits: maximum depth, maximum result size, and a bound on how long a query may run. Those limits belong on the request and have platform defaults, so an unbounded walk is not the default.
graph.create(name, config?) is where graph-level defaults live. There is no separate settings resource beyond that optional config object.
Use
| SDK | REST | Description |
|---|---|---|
graph.getNode(graph, id) | GET /graphs/{graph}/nodes/{id} | Retrieve a node |
graph.updateNode(graph, id, data) | PATCH /graphs/{graph}/nodes/{id} | Update a node |
graph.deleteNode(graph, id) | DELETE /graphs/{graph}/nodes/{id} | Delete a node |
graph.findNodes(graph, query) | POST /graphs/{graph}/nodes/query | Find matching nodes |
graph.getEdge(graph, id) | GET /graphs/{graph}/edges/{id} | Retrieve a relationship |
graph.deleteEdge(graph, id) | DELETE /graphs/{graph}/edges/{id} | Delete a relationship |
graph.neighbors(graph, nodeId, options?) | POST /graphs/{graph}/neighbors | Connected nodes |
graph.traverse(graph, options) | POST /graphs/{graph}/traverse | Traverse the graph |
graph.shortestPath(graph, from, to) | POST /graphs/{graph}/shortest-path | Shortest path |
graph.subgraph(graph, options) | POST /graphs/{graph}/subgraph | A connected subgraph |
const properties = await ultrahost.graph.neighbors(
"real-estate",
"tenant-123",
{ relationship: "RENTS", direction: "outbound" }
);neighbors is the everyday call. traverse, shortestPath, and subgraph are the ones that must enforce depth and size limits.