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

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.

Inputs of Graph Algorithm Visualizer
FieldTypeDefaultDescription
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.
directedbooleanfalseDirected edges
algorithmselect (bfs, dfs, dijkstra, bellman-ford, astar, prim, kruskal, topo, scc)"dijkstra"Algorithm
sourcetext—Start node. Default: the first node. Used by BFS, DFS, Dijkstra, Bellman–Ford, A* and Prim.
targettext—Target node. Optional for searches; required for A*.
coordinatestextarea—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)

{
  "mcpServers": {
    "graph-algorithm-visualizer": { "type": "http", "url": "https://graphalgorithmvisualizer.usefulweb.site/mcp" }
  }
}