{"uid":"cap_tFqz0uteH3d1TxwNfeKPg","slug":"graph-algorithms-connected-components-b5aa7b07","name":"Graph Algorithms – Connected Components","description":"Connected components of an edge list; with directed=true also strongly connected components via Tarjan.","url":"https://graph-algorithms.x402tookit.com/connected-components?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":["edges"],"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, _ . : + - (weights ignored)"},"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"},"directed":{"type":"boolean","description":"false (default): undirected components. true: edges are one-way; returns strongly connected components plus weakly connected ones"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"directed":{"type":["boolean","null"]},"edgeCount":{"type":["null","number"]},"nodeCount":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"isConnected":{"type":["boolean","null"]},"nodesOnACycle":{"type":["null","number"]},"largestComponent":{"type":["null","number"]},"isStronglyConnected":{"type":["boolean","null"]},"weaklyConnectedCount":{"type":["null","number"]},"stronglyConnectedCount":{"type":["null","number"]},"largestStronglyConnected":{"type":["null","number"]},"weaklyConnectedComponents":{"type":["array","null"],"items":{"type":"array","items":{"type":"string"}}},"stronglyConnectedComponents":{"type":["array","null"],"items":{"type":"array","items":{"type":"string"}}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_mFBvMdVqCd4q0BrdtciCa","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Finds connected components of an undirected edge list, or strongly and weakly connected components of a directed graph using Tarjan's algorithm.","exampleAgentPrompt":"Take this edge list — A,B; B,C; D,E; E,F; G — and tell me how many connected components there are and which nodes belong to each group; also include G as an isolated node.","exampleUseCases":[{"title":"Detecting isolated network segments","prompt":"I have a network of servers connected like this: server1,server2; server2,server3; server4,server5; server6 — can you find all the connected components and tell me which servers are isolated from the rest?"},{"title":"Finding SCCs in a dependency graph","prompt":"Given these directed package dependencies — A,B; B,C; C,A; D,E; E,D; F,G — run strongly connected component analysis so I can find circular dependency groups."},{"title":"Checking social graph connectivity","prompt":"Here's my social graph as an edge list: alice,bob; bob,carol; dave,eve; frank — is the whole graph connected, and if not, which separate groups exist? Treat the edges as undirected."}],"resultDescription":"Returns a JSON object with node count, edge count, whether the graph is connected (isConnected), the number of components, the largest component size, a list of all components with their member nodes, and (if directed=true) strongly connected component count, weakly connected component count, largest SCC size, and number of nodes on a cycle.","failureModes":["Edge list exceeds 200 nodes or 1000 edges — request rejected","Edge list string exceeds 60000 characters — request rejected","Malformed edge format (not 'from,to' or 'from,to,weight') — parse error returned","Node names contain invalid characters (outside letters, digits, _ . : + - ) — parse error","Empty edge list with no nodes parameter — may return empty result or error","Network timeout on very large valid inputs"],"whenToPreferThis":"Use this endpoint when you need to partition a graph into connected groups, check global connectivity, or (with directed=true) identify strongly connected components and cycle membership in a directed graph. It supports up to 200 nodes and 1000 edges and accepts flexible edge list formats. Prefer this over the other graph algorithm endpoints when the question is about reachability and clustering rather than shortest paths, flow, or spanning trees.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-02T12:30:57.892Z","isFirstParty":false,"canonicalSlug":"graph-algorithms-connected-components-b5aa7b07"}