Network cut capacity check
network-cut-capacity-check · version 1.0.0 · Numbers & math · free, no key needed
Check a claimed s-t cut: source-side membership, the edges crossing it and its capacity, with exact integers.
Use when you need to: check the capacity of an s-t cut · verify which edges cross a cut · validate a claimed minimum cut partition.
Decide before calling
Read the versioned contract and the supported scope below. Reuse network-cut-capacity-check@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use network-cut-capacity-check@1.0.0 for check the capacity of an s-t cut. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- check the capacity of an s-t cut
- verify which edges cross a cut
- validate a claimed minimum cut partition
- is the source on the source side of this cut
- sum capacities of edges leaving a vertex set claim
- audit a cut certificate in a flow network
Not supported
- finding a minimum cut (use maximum-flow-certificate-check to verify one)
- undirected or global (non s-t) minimum cuts
- vertex capacities or weighted vertex cuts
- counting edges in the reverse direction toward the capacity
Behavior
- Reference: CLRS 4th ed. (2022) section 24.2, cut (S, T) of a flow network with s in S and t in T = V - S, capacity c(S, T) = sum of c(u, v) over edges from S to T only; reference_version is returned with every result.
- Network rules as in network-flow-feasibility-check: unique string node ids compared exactly, directed edges identified by array index, parallel edges each counted, integers exact (JSON safe integer or canonical string of at most 30 digits).
- claim.source_side lists the node ids of S; claim.capacity is the claimed c(S, T); claim.crossing_edges (optional) lists the indices of the edges from S to T, in any order.
- Check order: source_side in list order (unknown_node, duplicate_node, with position), then source_not_in_source_side, sink_in_source_side; then crossing_edges in list order (unknown_edge for an index out of range, duplicate_edge); then edges by index (crossing_edge_missing for an S-to-T edge not listed, crossing_edge_extra for a listed edge that does not go from S to T); then capacity_mismatch.
- Edges from T to S never count toward the capacity. cut_capacity is the exact c(S, T) when the source side is valid, else null.
Input
nodes(array of string, required): min items 2; max items 2000; each min length 1; each max length 64edges(array of object, required): max items 10000source(string, required): min length 1; max length 64sink(string, required): min length 1; max length 64claim(object, required)
Output
valid(boolean, required)reason(one of null, "unknown_node", "duplicate_node", "source_not_in_source_side", "sink_in_source_side", "unknown_edge", "duplicate_edge", "crossing_edge_missing", "crossing_edge_extra", "capacity_mismatch", required)first_discrepancy(object or null, required)cut_capacity(string or null, required)reference_version(string, required)
Limits
- max nodes: 2000
- max edges: 10000
- max id chars: 64
- max integer digits: 30
Example
Request input:
{
"nodes": [
"s",
"v1",
"v2",
"v3",
"v4",
"t"
],
"edges": [
{
"from": "s",
"to": "v1",
"capacity": 16
},
{
"from": "s",
"to": "v2",
"capacity": 13
},
{
"from": "v2",
"to": "v1",
"capacity": 4
},
{
"from": "v1",
"to": "v3",
"capacity": 12
},
{
"from": "v3",
"to": "v2",
"capacity": 9
},
{
"from": "v2",
"to": "v4",
"capacity": 14
},
{
"from": "v4",
"to": "v3",
"capacity": 7
},
{
"from": "v3",
"to": "t",
"capacity": 20
},
{
"from": "v4",
"to": "t",
"capacity": 4
}
],
"source": "s",
"sink": "t",
"claim": {
"source_side": [
"s",
"v1",
"v2"
],
"capacity": 26,
"crossing_edges": [
3,
5
]
}
}
Response:
{
"result": {
"valid": true,
"reason": null,
"first_discrepancy": null,
"cut_capacity": "26",
"reference_version": "CLRS 4th ed. (2022) ch. 24 Maximum Flow: flow networks, cuts, residual networks, max-flow min-cut theorem; r55-flow-certificate-verifiers@1.0.0"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "network-cut-capacity-check",
"version": "1.0.0",
"input": {
"nodes": [
"s",
"v1",
"v2",
"v3",
"v4",
"t"
],
"edges": [
{
"from": "s",
"to": "v1",
"capacity": 16
},
{
"from": "s",
"to": "v2",
"capacity": 13
},
{
"from": "v2",
"to": "v1",
"capacity": 4
},
{
"from": "v1",
"to": "v3",
"capacity": 12
},
{
"from": "v3",
"to": "v2",
"capacity": 9
},
{
"from": "v2",
"to": "v4",
"capacity": 14
},
{
"from": "v4",
"to": "v3",
"capacity": 7
},
{
"from": "v3",
"to": "t",
"capacity": 20
},
{
"from": "v4",
"to": "t",
"capacity": 4
}
],
"source": "s",
"sink": "t",
"claim": {
"source_side": [
"s",
"v1",
"v2"
],
"capacity": 26,
"crossing_edges": [
3,
5
]
}
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/network-cut-capacity-check/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"nodes":["s","v1","v2","v3","v4","t"],"edges":[{"from":"s","to":"v1","capacity":16},{"from":"s","to":"v2","capacity":13},{"from":"v2","to":"v1","capacity":4},{"from":"v1","to":"v3","capacity":12},{"from":"v3","to":"v2","capacity":9},{"from":"v2","to":"v4","capacity":14},{"from":"v4","to":"v3","capacity":7},{"from":"v3","to":"t","capacity":20},{"from":"v4","to":"t","capacity":4}],"source":"s","sink":"t","claim":{"source_side":["s","v1","v2"],"capacity":26,"crossing_edges":[3,5]}}'
The machine-readable contract is at /v1/tools/network-cut-capacity-check/versions/1.0.0.
CLI
node cli.mjs run network-cut-capacity-check 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Network flow feasibility check: Check a claimed s-t flow for capacity bounds and conservation with exact integers; returns the first bad edge or node.
- Maximum flow certificate check: Check a claimed max flow with a min-cut certificate or residual search; reports the first failure or augmenting path.
- Graph coloring check: Check that a node colouring of an undirected graph is proper (and within k colours); returns the first conflict.
- Graph path weight check: Check that a path of edge IDs walks source to target in a weighted digraph and sums to the claimed exact weight.
- Lp primal feasibility check: Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.
- Spanning tree structure check: Check that claimed edge IDs form a spanning tree of a graph; reports the first missing, repeated or cyclic edge