# Graph Algorithms: Dijkstra Shortest Path

> Graph Algorithms: Dijkstra Shortest Path is a paid API for AI agents from graph-algorithms.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-02).

Computes Dijkstra shortest path and distances from a source node on a weighted edge list, returning the optimal path and distances to all reachable nodes.

## Facts

- Endpoint: GET https://graph-algorithms.x402tookit.com/shortest-path?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/graph-algorithms-dijkstra-shortest-path-7bc795ed
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_B9EjWyDnxdy38gRxg5F1v

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability graph-algorithms-dijkstra-shortest-path-7bc795ed
```

Example prompt: Find the shortest path from node 'A' to node 'F' in this directed weighted graph: A,B,4; A,C,2; B,D,3; C,D,1; D,F,5; C,E,8; E,F,2.

## When to prefer this

Use this endpoint when you need single-source shortest paths or point-to-point routing on a graph with non-negative edge weights. It is faster than Floyd-Warshall for sparse graphs or when only one source is needed, and correct for all non-negative weight scenarios. Switch to Bellman-Ford (sibling endpoint) if negative weights are present, or Floyd-Warshall if all-pairs distances are needed.

## Known failure modes

- Source node not found in edge list — returns error requiring source to appear in edges
- Graph exceeds 200 nodes or 1000 edges — returns rejection with size limit error
- Edge list malformed or unparseable — returns parse error
- Negative edge weights present — endpoint redirects or advises use of /bellman-ford instead
- Target node unreachable from source — returns null distance and path
- Edge list exceeds 60000 character limit — returns error

## How this service works

Dijkstra shortest path and distances from a source on a weighted edge list; negative weights point to /bellman-ford.

## Output

Returns the shortest path as an ordered list of node names, the total distance, hop count, source and target nodes, and a distances object mapping every reachable node to its distance from the source. Also includes graph metadata like node count and edge count.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "edges",
      "source"
     ],
     "properties": {
      "edges": {
       "type": "string",
       "description": "Edges separated by ; or newline, each 'from,to' or 'from,to,weight' (default weight 1), or a JSON array of [from,to,weight]; up to 200 nodes, 1000 edges, 60000 characters; node names 1-32 characters of letters, digits, _ . : + -"
      },
      "nodes": {
       "type": "string",
       "description": "Optional extra node names (comma or space separated) so isolated nodes are counted; the total still counts toward the 200-node cap"
      },
      "source": {
       "type": "string",
       "description": "Start node name; must appear in edges"
      },
      "target": {
       "type": "string",
       "description": "Optional end node; if given the path to it is returned"
      },
      "directed": {
       "type": "boolean",
       "description": "true (default) edges one way; false treats each edge as two-way"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "hops": {
       "type": [
        "null",
        "number"
       ]
      },
      "path": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "target": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/graph-algorithms-dijkstra-shortest-path-7bc795ed/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from graph-algorithms.x402tookit.com](https://www.zero.xyz/host/graph-algorithms.x402tookit.com/llms.txt)
