Algorithm Library
The seventh and outermost of ArcFlow's seven layers. Owns the built-in procedure surface — graph algorithms, vector search, RAG primitives, GPU-accelerated kernels — every one invoked by name through the standard CALL syntax.
If the Query Engine is the parser-planner-executor for general-purpose Cypher, the Algorithm Library is the catalogue of named operations the engine ships out of the box. PageRank, BFS, shortest path, Leiden community detection, HNSW vector probes, cosine similarity, embedding-aware procedures — all reachable through one consistent invocation shape:
CALL algo.pageRank() YIELD node, score
RETURN node.name, score ORDER BY score DESC LIMIT 10What the library provides#
| Family | Examples | Procedure namespace |
|---|---|---|
| Graph algorithms | PageRank, BFS, DFS, shortest path, connected components, Leiden, Louvain | CALL algo.* |
| Vector primitives | Cosine, dot product, embed | arcflow.cosine(), arcflow.embed() |
| Vector search | HNSW similarity probe | CALL arcflow.similar() |
| Graph-aware retrieval | Multi-hop RAG with citation provenance | CALL arcflow.graphrag() |
| Spatial | R*-tree probes, nearest-neighbour, range query | CALL algo.nearestNodes() |
| Workflow | Durable workflows over a graph | extension family |
| Introspection | Engine capabilities, GPU status, query plans | CALL db.* |
The complete surface is enumerated in the Procedures reference; this page documents the layer — why it exists, where it sits, and what guarantees it offers.
Why algorithms are a separate layer#
A graph algorithm could be an external library that walks the graph through the client SDK. That works for one-off scripts, but at the engine layer four properties stop being optional:
- No projection. The algorithm runs against the live in-memory adjacency. There is no "project the graph into a separate analytical store first" step.
- Backend dispatch. PageRank on CPU, PageRank on Metal, PageRank on CUDA — same procedure name. The engine picks the backend per host capability and reports the choice through
db.capabilities(). No silent downgrade. - Typed results. A procedure returns typed columns: numbers stay numbers, node references stay node references. Agents do not parse strings.
- Composability.
CALL algo.*results pipe into the rest of the Cypher pipeline —WHERE,RETURN, furtherMATCH,WITHaggregation. An algorithm is a node in the query plan, not a black-box external call.
Why this matters for agents#
For an agent, the Algorithm Library is a vocabulary of named graph operations it can reach for without implementing the algorithm itself. PageRank a knowledge graph, find the shortest causal chain, probe a vector index for similar entities, run multi-hop RAG with provenance — every one is a CALL in a Cypher query, with the same parameter shape and the same typed result.
The library also defines the additive-surface boundary for ArcFlow's release contract. New algorithms are additive — they extend the catalogue without changing existing surface. An agent that wrote code against algo.pageRank last quarter will find it works identically next quarter; new procedures only add capability.
What the library does NOT do#
- It does not own scheduling. That is the Behavior Engine.
- It does not own change notification. That is the Live Surface.
- It does not own storage. Storage lives in Perception Lake + World Graph.
An algorithm is a function over the graph at a point in time. Combining algorithms with the layers below them — running PageRank inside a behavior that fires on a live-view delta — is how an agent assembles real applications.
See also#
- Graph Algorithms — the canonical surface reference + worked examples.
- Vector Search — HNSW + cosine +
arcflow.similar(). - Trusted RAG — citation-aware multi-hop retrieval.
- GPU Acceleration — when algorithms dispatch to Metal / CUDA backends.
- Procedures — the full procedure catalogue.