Connectivity for changing networks
Knotrel keeps an undirected graph in memory and answers exact connectivity queries as nodes and edges change. Use it as a Rust library or an HTTP service alongside your existing source of data.
How it works
Three operations, one exact answer
- 1
Load a graph
Build it from your edges, or let a feeder import a baseline from your authoritative source.
try_from_edges · POST /v1/feeder/import - 2
Apply changes
Link and cut edges as the network changes. Optional lifecycle flags take nodes and edges offline without deleting them.
link · cut · set_node_active - 3
Ask “connected?”
Every answer is exact and reflects all operations applied before it. No sampling, no stale cache.
connected(source, target)
Try it
A failure and a recovery in one request
Start the server and send a batch: link a path, check it, cut an edge, check again. A batch runs under one lock, so no other request interleaves with it.
# standalone mode, default address
curl -sS http://127.0.0.1:8080/v1/batch \
-H 'Content-Type: application/json' \
-d '{"operations":[
{"op":"link","source":"1","target":"2"},
{"op":"link","source":"2","target":"3"},
{"op":"connected","source":"1","target":"3"},
{"op":"cut","source":"2","target":"3"},
{"op":"connected","source":"1","target":"3"}
]}'
# results, one per operation
… {"result":"connected","connected":true} …
… {"result":"connected","connected":false}
use knotrel_core::{ConnectivityGraph, EngineConfig};
let mut graph = ConnectivityGraph::new(EngineConfig::CompactBfs);
graph.link(1, 2)?;
graph.link(2, 3)?;
assert!(graph.connected(1, 3)?);
// Cut an edge and observe the split.
graph.cut(2, 3)?;
assert!(!graph.connected(1, 3)?);
Knotrel Console
See the graph you are serving
Browse nodes and edges, take them offline, and check connectivity between any two nodes from the browser. The console is distributed separately from the server and uses the optional, read-only inspection routes.
Explore the documentation
Pick your path
Understand
The guarantees and what they rely on.
Build
Integrate over HTTP, in Rust or from PostgreSQL.
Evaluate
Measured evidence, with its limits.
Architecture
Where Knotrel fits
The authoritative source and feeder are external. In source-managed mode, the feeder imports a graph and delivers ordered updates; Knotrel answers queries against its in-memory state. A reference PostgreSQL feeder (logical replication, since v0.9.0) shows a complete integration. In standalone mode, clients operate the graph directly. Architecture details.
Good to know
- Volatile by design. The graph lives in memory. After a restart, rebuild or resynchronize from the authoritative source.
- No built-in authentication by default. Place Knotrel behind a trusted boundary or gateway; see the deployment guide and the threat model. Since v1.3.0 (experimental): optional gateway-verified identity.
Future work is tracked in versioned GitHub issues.