# Flow feasibility check

`flow-feasibility-check` · version 1.0.0 · Numbers & math · free, no key needed

Check exact integer edge capacities and flow conservation, returning the first discrepancy.

**Use when you need to: check flow feasibility · validate a claimed network flow · find first flow constraint violation.**

## Decide before calling

Read the [versioned contract](/v1/tools/flow-feasibility-check/versions/1.0.0) and the supported scope below. Reuse `flow-feasibility-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 `flow-feasibility-check@1.0.0` for check flow feasibility. 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 flow feasibility
- validate a claimed network flow
- find first flow constraint violation
- check capacity constraints
- check flow conservation
- verify feasible capacitated flow

## Not supported

- compute a maximum flow
- repair an infeasible flow

## Behavior

- Nodes and edges retain caller order; parallel edges and self-loops are allowed, and flow[i] corresponds exactly to edges[i].
- All capacities and flows are canonical nonnegative decimal strings and arithmetic is exact; no leading zero except "0".
- Capacity discrepancies are checked by edge index before conservation discrepancies are checked by node index.
- A valid flow balances every nonterminal and has equal source outflow and sink inflow.
- Reference version: Ford-Fulkerson max-flow/min-cut theorem (Ahuja-Magnanti-Orlin 1993, Sections 6.1-6.5).

## Input

- `nodes` (array of string, required): min items 2; max items 256; each min length 1; each max length 64
- `edges` (array of object, required): max items 4096
- `source` (string, required): min length 1; max length 64
- `sink` (string, required): min length 1; max length 64
- `flow` (array of string, required): max items 4096; each min length 1; each max length 78; each pattern `^(0|[1-9][0-9]*)$`

## Output

- `valid` (boolean, required)
- `reason` (string or null, required)
- `discrepancy` (null or object, required)
- `reference_version` (constant "Ford-Fulkerson max-flow/min-cut theorem (Ahuja-Magnanti-Orlin 1993, Sections 6.1-6.5)", required)

## Limits

- max nodes: 256
- max edges: 4096
- max integer digits: 78
- max node id bytes: 64

## Example

Request input:

```json
{
  "nodes": [
    "s",
    "t"
  ],
  "edges": [
    {
      "from": "s",
      "to": "t",
      "capacity": "3"
    }
  ],
  "source": "s",
  "sink": "t",
  "flow": [
    "3"
  ]
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reason": null,
    "discrepancy": null,
    "reference_version": "Ford-Fulkerson max-flow/min-cut theorem (Ahuja-Magnanti-Orlin 1993, Sections 6.1-6.5)"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "flow-feasibility-check",
  "version": "1.0.0",
  "input": {
    "nodes": [
      "s",
      "t"
    ],
    "edges": [
      {
        "from": "s",
        "to": "t",
        "capacity": "3"
      }
    ],
    "source": "s",
    "sink": "t",
    "flow": [
      "3"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/flow-feasibility-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"nodes":["s","t"],"edges":[{"from":"s","to":"t","capacity":"3"}],"source":"s","sink":"t","flow":["3"]}'
```

The machine-readable contract is at [/v1/tools/flow-feasibility-check/versions/1.0.0](/v1/tools/flow-feasibility-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run flow-feasibility-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Network flow feasibility check](/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.
- [Lp primal feasibility check](/tools/lp-primal-feasibility-check): Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.
- [Flow value check](/tools/flow-value-check): Check a feasible exact integer flow and its claimed source value, returning the first discrepancy.
- [Maximum flow certificate check](/tools/maximum-flow-certificate-check): Check a claimed max flow with a min-cut certificate or residual search; reports the first failure or augmenting path.
- [Network cut capacity check](/tools/network-cut-capacity-check): Check a claimed s-t cut: source-side membership, the edges crossing it and its capacity, with exact integers.
- [Precedence batches check](/tools/precedence-batches-check): Check whether claimed parallel batches contain every node once and respect a caller-supplied DAG.
