Graph validate
graph-validate · version 1.0.0 · Graphs & scheduling · free, no key needed
Inspect a well-formed directed simple graph and report counts, isolated nodes, and maximum degrees.
Use when you need to: graph validate · inspect directed graph structure · count isolated nodes and degrees.
Supported
- graph validate
- inspect directed graph structure
- count isolated nodes and degrees
Not supported
- undirected mode
- weighted edges
- drawing
- files
Behavior
- Input is a directed simple graph {nodes, edges} parsed with the shared graph grammar.
- Output is a null-prototype object with node_count, edge_count, self_loop_count, isolated_node_count, max_in_degree, and max_out_degree as integers.
- A self-loop counts once toward both in-degree and out-degree of its node.
- A node is isolated when its in-degree is 0 and its out-degree is 0.
- The empty graph yields 0 for every count, including max degrees.
- Self-loops and cycles are data; they 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
node_count(integer, required): min 0edge_count(integer, required): min 0self_loop_count(integer, required): min 0isolated_node_count(integer, required): min 0max_in_degree(integer, required): min 0max_out_degree(integer, required): min 0
Limits
- max nodes: 2000
- max edges: 10000
- max node id bytes: 256
Example
Request input:
{
"nodes": [
"a",
"b",
"c",
"d"
],
"edges": [
{
"from": "a",
"to": "b"
},
{
"from": "a",
"to": "c"
},
{
"from": "c",
"to": "c"
}
]
}
Response:
{
"result": {
"node_count": 4,
"edge_count": 3,
"self_loop_count": 1,
"isolated_node_count": 1,
"max_in_degree": 2,
"max_out_degree": 2
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "graph-validate",
"version": "1.0.0",
"input": {
"nodes": [
"a",
"b",
"c",
"d"
],
"edges": [
{
"from": "a",
"to": "b"
},
{
"from": "a",
"to": "c"
},
{
"from": "c",
"to": "c"
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/graph-validate/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"nodes":["a","b","c","d"],"edges":[{"from":"a","to":"b"},{"from":"a","to":"c"},{"from":"c","to":"c"}]}'
The machine-readable contract is at /v1/tools/graph-validate/versions/1.0.0.
CLI
node cli.mjs run graph-validate 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Graph reachable from: List nodes reachable from given sources by directed BFS, in discovery order.
- Graph shortest unweighted path: Find a shortest directed path by fewest edges from source to target.
- Graph ancestors: List every ancestor of given targets, including the targets, in reverse-graph BFS discovery order.
- 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 induced subgraph: Return the vertex-induced subgraph on a listed node subset, preserving declared node and edge order.