Graph strongly connected components
graph-strongly-connected-components · version 1.0.0 · Graphs & scheduling · free, no key needed
Partition a directed simple graph into strongly connected components, listed by declared node index.
Use when you need to: graph strongly connected components · directed strongly connected components · collapse cyclic dependency clumps.
Supported
- graph strongly connected components
- directed strongly connected components
- collapse cyclic dependency clumps
Not supported
- 2-SAT
- condensation DAG extras
- undirected connected components
- listing every cycle
Behavior
- Input is a directed simple graph: unique non-empty node ids and unique {from,to} edges whose ends are in nodes.
- Two distinct nodes share a component if and only if each can reach the other on directed edges.
- A self-loop does not by itself merge distinct nodes.
- Isolated nodes are size-1 components. Empty graph yields components [].
- Members of each component are listed in declared node-index order.
- Components are ordered by the smallest declared index among their members.
- Cycles are data: they form non-trivial components and are not rejected.
Input
nodes(array of string, required): max items 2000; each min length 1; each max length 256edges(array of object, required): max items 10000
Output
components(array of array of string, required)
Limits
- max nodes: 2000
- max edges: 10000
- max node id bytes: 256
Example
Request input:
{
"nodes": [
"build",
"test",
"lint",
"package",
"publish"
],
"edges": [
{
"from": "build",
"to": "test"
},
{
"from": "test",
"to": "lint"
},
{
"from": "lint",
"to": "build"
},
{
"from": "test",
"to": "package"
},
{
"from": "package",
"to": "publish"
}
]
}
Response:
{
"result": {
"components": [
[
"build",
"test",
"lint"
],
[
"package"
],
[
"publish"
]
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "graph-strongly-connected-components",
"version": "1.0.0",
"input": {
"nodes": [
"build",
"test",
"lint",
"package",
"publish"
],
"edges": [
{
"from": "build",
"to": "test"
},
{
"from": "test",
"to": "lint"
},
{
"from": "lint",
"to": "build"
},
{
"from": "test",
"to": "package"
},
{
"from": "package",
"to": "publish"
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/graph-strongly-connected-components/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"nodes":["build","test","lint","package","publish"],"edges":[{"from":"build","to":"test"},{"from":"test","to":"lint"},{"from":"lint","to":"build"},{"from":"test","to":"package"},{"from":"package","to":"publish"}]}'
The machine-readable contract is at /v1/tools/graph-strongly-connected-components/versions/1.0.0.
CLI
node cli.mjs run graph-strongly-connected-components 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Graph connected components: Partition a directed simple graph into undirected connected components, ignoring edge direction.
- Graph dependency impact: List nodes downstream of a removed set: not themselves removed, reachable by a directed path of length at least 1.
- Graph find cycle: Find one directed cycle by 3-color DFS, or report that the graph is acyclic.
- Graph reachable from: List nodes reachable from given sources by directed BFS, in discovery order.
- Graph reverse: Reverse every directed edge of a simple graph, keeping node order and original edge order.
- Graph shortest unweighted path: Find a shortest directed path by fewest edges from source to target.