{"uid":"cap_rCwuD4G0TEA0VyOSZ8OBk","slug":"fastx402-graph-shortest-path-f3551bdb","name":"FastX402 Graph Shortest Path","description":"200 pay-per-call tools for AI agents, from $0.001 per request in USDC on Base or Solana with x402. No account, no API key.","url":"https://fastx402.tools/graph-shortest-path?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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":["graph","operation"],"properties":{"end":{"type":"string","description":"Ending node (required for shortest_path)"},"graph":{"type":"string","description":"JSON string with 'nodes' array and 'edges' array (each edge has 'from', 'to', and optional 'weight' defaulting to 1)"},"start":{"type":"string","description":"Starting node (required for shortest_path)"},"operation":{"type":"string","description":"One of: 'shortest_path' (Dijkstra), 'topological_sort' (for DAG), 'detect_cycle'"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"end":{"type":"string"},"path":{"type":"array","items":{"type":"string"}},"start":{"type":"string"},"distance":{"type":"integer"},"operation":{"type":"string"}}}}}}},"responseSchema":{"type":"json","example":{"end":"D","path":["A","C","B","D"],"start":"A","distance":8,"operation":"shortest_path"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_2u_rCKSUcueBbwo5PFL4o","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Finds the shortest path between two nodes in a weighted graph using Dijkstra's algorithm, or performs topological sort/cycle detection on a graph","exampleAgentPrompt":"Find the shortest path from node A to node D in this weighted graph: nodes are A, B, C, D and edges are A→C (weight 3), A→B (weight 5), C→B (weight 2), B→D (weight 3), C→D (weight 10).","exampleUseCases":[{"title":"Network routing optimization","prompt":"I have a network with servers A, B, C, D, E where A connects to B (latency 2), A connects to C (latency 5), B connects to D (latency 3), C connects to D (latency 1), D connects to E (latency 4). Find me the shortest path from A to E."},{"title":"Dependency build order","prompt":"I have a software build system with modules: core, utils, api, ui, app. The dependencies are core→utils, utils→api, api→ui, core→app. Can you topologically sort these so I know the correct build order?"},{"title":"Cycle detection in task graph","prompt":"I have a task graph where task1 depends on task2, task2 depends on task3, and task3 depends on task1. Can you detect whether there's a cycle in this dependency graph?"}],"resultDescription":"Returns a JSON object containing the operation type, start and end nodes, the ordered array of nodes forming the shortest path, and the total integer distance (sum of edge weights) along that path. For topological sort, returns an ordered node list. For cycle detection, returns a boolean result.","failureModes":["Missing required 'graph' or 'operation' query parameters — returns error","Invalid JSON string for graph parameter — parsing failure","Start or end node not found in the provided graph — returns not found error","Topological sort requested on a graph containing cycles — returns error","Shortest path operation called without specifying start or end nodes — returns validation error","No path exists between start and end nodes — returns null or empty path","Payment of $0.002 USDC not completed — returns HTTP 402"],"whenToPreferThis":"Choose this endpoint when you need fast, on-demand graph algorithm execution without setting up an account or API key — ideal for AI agents that encounter ad-hoc graph problems. It supports Dijkstra's shortest path, topological sort, and cycle detection in a single endpoint. Best for lightweight, one-off graph computations paid per-call in USDC via x402 protocol.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T07:05:50.378Z","isFirstParty":false,"canonicalSlug":"fastx402-graph-shortest-path-f3551bdb"}