API & MCP
Everything a person can do on Graph Algorithm Visualizer, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://graphalgorithmvisualizer.usefulweb.site/api/v1/calculate– run Graph Algorithm VisualizerGET https://graphalgorithmvisualizer.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Graph Algorithm Visualizer
Paste an edge list (weighted or not, directed or not) and run a classic graph algorithm: BFS, DFS, Dijkstra, Bellman–Ford (with negative-cycle detection), A* with node coordinates, Prim or Kruskal minimum spanning tree, Kahn topological sort or Tarjan strongly connected components. Shows every step, the distances and the highlighted path or tree.
| Field | Type | Default | Description |
|---|---|---|---|
edges (required) | textarea | "A B 4\nA C 2\nB C 5\nB D 10\nC E 3\nE D 4\nD F 11" | Edges (one per line: from to [weight]). Formats: "A B 4", "A -> B 4", "A,B,4". A line with one name adds an isolated node. # starts a comment. Max 200 nodes, 2,000 edges. |
directed | boolean | false | Directed edges |
algorithm | select (bfs, dfs, dijkstra, bellman-ford, astar, prim, kruskal, topo, scc) | "dijkstra" | Algorithm |
source | text | — | Start node. Default: the first node. Used by BFS, DFS, Dijkstra, Bellman–Ford, A* and Prim. |
target | text | — | Target node. Optional for searches; required for A*. |
coordinates | textarea | — | Node coordinates (node x y), for A* and layout. A* uses the straight-line distance as heuristic; it is admissible only if no edge is shorter than the distance between its end points. |
Example request
Dijkstra from A to F
curl -X POST https://graphalgorithmvisualizer.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"algorithm":"dijkstra","source":"A","target":"F"}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://graphalgorithmvisualizer.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
graph_algorithm_visualizer - Local stdio connector:
node src/mcp-stdio.ts --tool=graph-algorithm-visualizer
{
"mcpServers": {
"graph-algorithm-visualizer": { "type": "http", "url": "https://graphalgorithmvisualizer.usefulweb.site/mcp" }
}
}