# Graph Algorithms Shortest paths, spanning trees, topological order, components, max flow, graph statistics and all-pairs distances from a caller-supplied edge list. ## How to pay Machine-payable over x402. USDC on: Base (eip155:8453), Solana (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp), Polygon (eip155:137), Arbitrum One (eip155:42161). No accounts. No API keys. No signup. The paying wallet is the account. ## Machine-readable - OpenAPI: https://graph-algorithms.x402tookit.com/openapi.json - x402 manifest: https://graph-algorithms.x402tookit.com/.well-known/x402 - Catalog (free): https://graph-algorithms.x402tookit.com/catalog - Health (free): https://graph-algorithms.x402tookit.com/health - Uptime (free): https://graph-algorithms.x402tookit.com/uptime ## Endpoints (8) ### GET /all-pairs-shortest — $0.03 Floyd-Warshall all-pairs shortest distances for up to 100 nodes; negative weights ok; detects negative cycles. Params: edges: string, nodes?: string, directed?: boolean, from?: string, to?: string Example: https://graph-algorithms.x402tookit.com/all-pairs-shortest?edges=1%2C2%2C3%3B+1%2C3%2C8%3B+1%2C5%2C-4%3B+2%2C4%2C1%3B+2%2C5%2C7%3B+3%2C2%2C4%3B+4%2C1%2C2%3B+4%2C3%2C-5%3B+5%2C4%2C6&from=3&to=5 ### GET /bellman-ford — $0.02 Bellman-Ford shortest paths with negative weights; reports a negative cycle reachable from the source. Params: edges: string, nodes?: string, source: string, target?: string, directed?: boolean Example: https://graph-algorithms.x402tookit.com/bellman-ford?edges=s%2Ct%2C6%3B+s%2Cy%2C7%3B+t%2Cx%2C5%3B+t%2Cy%2C8%3B+t%2Cz%2C-4%3B+x%2Ct%2C-2%3B+y%2Cx%2C-3%3B+y%2Cz%2C9%3B+z%2Cx%2C7%3B+z%2Cs%2C2&source=s&target=z ### GET /connected-components — $0.02 Connected components of an edge list; with directed=true also strongly connected components via Tarjan. Params: edges: string, nodes?: string, directed?: boolean Example: https://graph-algorithms.x402tookit.com/connected-components?edges=a%2Cb%3B+b%2Cc%3B+c%2Ca%3B+c%2Cd%3B+d%2Ce%3B+e%2Cd&directed=true ### GET /graph-stats — $0.02 Graph statistics: degree sequence, density, bipartite check, tree or forest test, and diameter if connected. Params: edges: string, nodes?: string, directed?: boolean Example: https://graph-algorithms.x402tookit.com/graph-stats?edges=0%2C1%3B+1%2C2%3B+2%2C3%3B+3%2C4%3B+4%2C0%3B+0%2C5%3B+1%2C7%3B+2%2C9%3B+3%2C6%3B+4%2C8%3B+5%2C7%3B+7%2C9%3B+9%2C6%3B+6%2C8%3B+8%2C5 ### GET /max-flow — $0.03 Edmonds-Karp maximum flow from a source to a sink on a capacity edge list, with flow per edge and min cut edges. Params: edges: string, nodes?: string, source: string, sink: string Example: https://graph-algorithms.x402tookit.com/max-flow?edges=s%2Cv1%2C16%3B+s%2Cv2%2C13%3B+v1%2Cv3%2C12%3B+v2%2Cv1%2C4%3B+v2%2Cv4%2C14%3B+v3%2Cv2%2C9%3B+v3%2Ct%2C20%3B+v4%2Cv3%2C7%3B+v4%2Ct%2C4&source=s&sink=t ### GET /minimum-spanning-tree — $0.02 Kruskal minimum spanning tree of an undirected weighted edge list; returns a spanning forest if disconnected. Params: edges: string, nodes?: string Example: https://graph-algorithms.x402tookit.com/minimum-spanning-tree?edges=a%2Cb%2C4%3B+a%2Ch%2C8%3B+b%2Cc%2C8%3B+b%2Ch%2C11%3B+c%2Cd%2C7%3B+c%2Cf%2C4%3B+c%2Ci%2C2%3B+d%2Ce%2C9%3B+d%2Cf%2C14%3B+e%2Cf%2C10%3B+f%2Cg%2C2%3B+g%2Ch%2C1%3B+g%2Ci%2C6%3B+h%2Ci%2C7 ### GET /shortest-path — $0.02 Dijkstra shortest path and distances from a source on a weighted edge list; negative weights point to /bellman-ford. Params: edges: string, nodes?: string, source: string, target?: string, directed?: boolean Example: https://graph-algorithms.x402tookit.com/shortest-path?edges=s%2Ct%2C10%3B+s%2Cy%2C5%3B+t%2Cx%2C1%3B+t%2Cy%2C2%3B+y%2Ct%2C3%3B+y%2Cx%2C9%3B+y%2Cz%2C2%3B+x%2Cz%2C4%3B+z%2Cx%2C6%3B+z%2Cs%2C7&source=s&target=x ### GET /topological-sort — $0.02 Topological order of a directed graph (Kahn) with parallel layers; on a cycle returns the cycle's nodes. Params: edges: string, nodes?: string Example: https://graph-algorithms.x402tookit.com/topological-sort?edges=undershorts%2Cpants%3B+undershorts%2Cshoes%3B+socks%2Cshoes%3B+pants%2Cshoes%3B+pants%2Cbelt%3B+belt%2Cjacket%3B+shirt%2Cbelt%3B+shirt%2Ctie%3B+tie%2Cjacket&nodes=watch ## Terms Textbook graph algorithms computed locally on the edge list you send, capped at 200 nodes and 1000 edges. Provided as is; check results before relying on them.