by ruvnet
Rust + WASM sublinear-time solver for asymmetric diagonally dominant systems. Exposes Neumann series, push, and hybrid random-walk algorithms with npm/npx CLI and Flow-Nexus HTTP streaming for swarm cost propagation and verification.
# Add to your Claude Code skills
git clone https://github.com/ruvnet/sublinear-time-solverGuides for using ai agents skills like sublinear-time-solver.
sublinear-time-solver is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by ruvnet. Rust + WASM sublinear-time solver for asymmetric diagonally dominant systems. Exposes Neumann series, push, and hybrid random-walk algorithms with npm/npx CLI and Flow-Nexus HTTP streaming for swarm cost propagation and verification. It has 102 GitHub stars.
sublinear-time-solver's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/ruvnet/sublinear-time-solver" and add it to your Claude Code skills directory (see the Installation section above).
sublinear-time-solver is primarily written in Rust. It is open-source under ruvnet on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh sublinear-time-solver against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
Solve systems of equations, estimate individual values, and rank nodes in a graph. Use the command line, the JavaScript API, the Rust crate, or an MCP client.
The idea is simple. If a problem has many variables but each one depends on only a few others, the solver can sometimes answer a question by visiting a small neighborhood. Think of a sensor network where one reading changes and you want to check nearby readings first.
Quick start · How it works · MCP · Library · Benchmarks · Upgrading from 1.7
| Package | Use it for | Runtime deps | Clean install |
|---|---|---|---|
@ruvnet/sublinear-core |
Embedding solvers and PageRank in a library or app | 0 | 1 package, 220 kB |
sublinear-time-solver |
MCP server, CLI, and the 1.x SublinearSolver class |
4 | 99 packages, 31 MB (1.7.2: 220 packages, 123 MB) |
sublinear |
Rust solvers with a complexity-typed API | — | cargo add sublinear |
With Node.js and npm, paste this into a terminal in a scratch directory. The matrix uses coordinate format (COO), which lists the value, row, and column of each nonzero entry.
cat > matrix.json <<'JSON'
{
"rows": 2, "cols": 2, "format": "coo",
"values": [4, -1, -1, 4],
"rowIndices": [0, 0, 1, 1],
"colIndices": [0, 1, 0, 1]
}
JSON
printf '%s\n' '[3,3]' > vector.json
npx -y sublinear-time-solver solve --matrix matrix.json --vector vector.json \
--method forward-push --output solution.json
cat solution.json
The two values in solution should be close to [1, 1], and metadata.converged should be true. Run npx -y sublinear-time-solver --help to see commands for inspecting matrices, generating test inputs, and running PageRank.
A sparse matrix stores only the relationships that exist. A local solve starts with the row you care about, follows nearby dependencies, and returns a value or a small set of updates. The cost depends on how large that neighborhood gets and how much accuracy you need. A full solve returns every value, so its output grows with the size of the system.
| If you need | Start with |
|---|---|
| Every value in a system of equations | CLI or MCP solve |
| An estimate for one entry | MCP estimateEntry |
| A small set of updates after a local change | The Rust event driven example on the development branch |
| An importance score for each node in a graph | CLI pagerank or MCP pageRank |
The local path works best when rows have few neighbors, the diagonal terms dominate, and the change stays local. Inspect your matrix with analyze and check the residual when you need to know how closely a solution satisfies the equations.
Add this to your client's MCP server configuration. It starts the server over standard input and output.
{
"mcpServers": {
"sublinear-solver": {
"command": "npx",
"args": ["-y", "sublinear-time-solver", "serve"]
}
}
}
With Claude Code: claude mcp add sublinear -- npx -y sublinear-time-solver serve. With Codex, add [mcp_servers.sublinear] with command = "npx" and args = ["-y", "sublinear-time-solver", "serve"] to ~/.codex/config.toml. All diagnostics go to stderr, so stdout carries only JSON-RPC.
Try asking your client to list the solver tools, then pass the COO matrix and vector from the quick start to solve. Clients can also inspect complexity metadata before choosing a tool. The MCP server source has the tool schemas, and ADR 001 explains the complexity budget.
The zero-dependency core is the fastest way to embed the math:
npm install @ruvnet/sublinear-core
import { solve, graphFromEdges, pageRank, personalizedPageRank, forwardPush, topK } from '@ruvnet/sublinear-core';
// A x = b. COO input; duplicate entries are summed. The residual is recomputed from x.
const { x, residual, converged } = solve(
{ rows: 2, cols: 2, rowIndices: [0, 0, 1, 1], colIndices: [0, 1, 0, 1], values: [4, -1, -1, 4] },
[3, 3],
);
// PageRank and personalized PageRank on string ids
const g = graphFromEdges([['a', 'b'], ['b', 'c', 2], ['c', 'a'], ['a', 'c']]);
topK(pageRank(g).scores, 3, g);
personalizedPageRank(g, 'a', { damping: 0.85 });
// Local top-k: the work depends on epsilon, not on the graph size
topK(forwardPush(g, 'a', { epsilon: 1e-6 }).scores, 10, g);
solve(A, b, { method }) accepts COO, dense rows, or a CsrMatrix (csrFromCoo, csrFromDense).
'auto' uses conjugate gradient for symmetric matrices with a positive diagonal and Gauss-Seidel otherwise.'jacobi' and 'neumann' are also available. The two have identical iterates.pageRank / personalizedPageRank: scores sum to 1. damping is the probability of following an edge, so a restart probability α means damping = 1 − α.forwardPush(g, seeds, { epsilon }) / backwardPush(g, target): local personalized PageRank. Forward push does at most 1/((1 − damping)·epsilon) pushes, whatever the graph size.estimateEntry(A, b, i, { walks }): estimates one entry of x by random walks and returns a standard error. After a one-time check per matrix, the cost does not depend on n.The core package README has the full API. sublinear-time-solver/core exposes the same functions plus the 1.x SublinearSolver class, without loading the MCP server. For Rust, run cargo add sublinear and see the crate documentation.
Make @ruvnet/sublinear-core an optional dependency and keep your own fallback (try { core = await import('@ruvnet/sublinear-core') } catch {}).
simplePersonalizedPageRank with personalizedPageRank(graphFromEdges(edges), seed, { damping: 1 - restart }) and topK(scores, k, graph). claude-flow's damping is the restart probability.SparsificationService can use personalizedPageRank(graphFromAdjacency(edges), source, { damping: 1 - alpha }), or forwardPush for large graphs.pageRank, or smooth signals over them by solving (I + L) x = y with solve.Runnable versions are in packages/sublinear-core/examples/.
On this benchmark, quadrupling the number of rows took the full solve from 66.7 µs to 258 µs and the local update from 2.28 ms to 2.32 ms. The full solve was faster at both sizes. The local update grew more slowly because the changed neighborhood stayed small. See the benchmark setup and results.
Setup.
packages/sublinear-core/bench/bench.mjs. Reproduce with npm run bench. Add LEGACY=<dir> to time sublinear-time-solver 1.7.2, and GRAPH_TRANSFORMER=<dir> to time @ruvector/graph-transformer.Linear solves: accuracy against dense Gaussian elimination (n = 1,000, tolerance 1e-12).
| Method | Time | Iterations | Relative residual | Max error vs dense |
|---|---|---|---|---|
| Dense Gaussian elimination (reference) | 108.7 ms | — | — | — |
core gauss-seidel |
0.95 ms | 13 | 7.0e-13 | 4.0e-13 |
core jacobi |
2.04 ms | 20 | 2.5e-13 | 7.9e-14 |
core neumann |
0.70 ms | 20 | 2.5e-13 | 7.9e-14 |
1.7.2 SublinearSolver neumann |
50.8 ms | 23 | 5.0e-1 | 1.3e-1 |
The 1.7.2 Neumann solver returned a wrong answer here because its series used the wrong sign. That is fixed in 1.8.0.
Linear solves: scaling (tolerance 1e-10).
| n | nnz | Build CSR | Gauss-Seidel | Jacobi | 1.7.2 Neumann |
|---|---|---|---|---|---|
| 10,000 | 90 k | 8.8 ms | 2.3 ms (11 iterations) | 1.5 ms (16 iterations) | 4,402 ms |
| 100,000 | 900 k | 70 ms | 32 ms | 43 ms | — |
| 1,000,000 | 9.0 M | 951 ms | 474 ms | 314 |