# Flow value check

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

Check a feasible exact integer flow and its claimed source value, returning the first discrepancy.

**Use when you need to: check claimed flow value · validate network flow value · compare flow against claimed value.**

## Decide before calling

Read the [versioned contract](/v1/tools/flow-value-check/versions/1.0.0) and the supported scope below. Reuse `flow-value-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-value-check@1.0.0` for check claimed flow value. 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 claimed flow value
- validate network flow value
- compare flow against claimed value
- check source net outflow
- verify exact integer flow total
- find first flow value discrepancy

## Not supported

- compute a maximum flow
- infer or repair missing edge flows

## Behavior

- Feasibility is checked first in edge then node order; the value claim is checked only after feasibility succeeds.
- Flow value is total source outflow minus total source inflow, including parallel and antiparallel edges.
- Capacities and edge flows are canonical nonnegative decimal strings; claimed_value is a canonical signed decimal string. Arithmetic is exact.
- A false claim is reported and never replaced or silently repaired.
- 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]*)$`
- `claimed_value` (string, required): min length 1; max length 79; 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": "5"
    }
  ],
  "source": "s",
  "sink": "t",
  "flow": [
    "4"
  ],
  "claimed_value": "4"
}
```

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-value-check",
  "version": "1.0.0",
  "input": {
    "nodes": [
      "s",
      "t"
    ],
    "edges": [
      {
        "from": "s",
        "to": "t",
        "capacity": "5"
      }
    ],
    "source": "s",
    "sink": "t",
    "flow": [
      "4"
    ],
    "claimed_value": "4"
  }
}
```

### HTTP (no key)

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

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

### CLI

```sh
node cli.mjs run flow-value-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.
- [Flow feasibility check](/tools/flow-feasibility-check): Check exact integer edge capacities and flow conservation, returning the first discrepancy.
- [Maxflow certificate check](/tools/maxflow-certificate-check): Check an exact max-flow/min-cut certificate and return the first deterministic 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.
- [Permutation values check](/tools/permutation-values-check): Check whether claimed values are a SameValueZero multiset permutation, reporting the first source-order discrepancy.
- [Stable sort result check](/tools/stable-sort-result-check): Check that a claimed record result is the exact ascending stable sort of the supplied source records.
