---
title: min_cost_max_flow
url: https://nexyron.tech/docs/cypher/procedures/algorithms/trees-and-flow/min-cost-max-flow
description: Maximize flow while minimizing total cost.
---

# min_cost_max_flow

## Generic Description

Maximize flow while minimizing total cost.

Simple example:

```cypher
CALL nexyron.min_cost_max_flow({source: 0, sink: 1})
```

Tree and flow procedures optimize connectivity or movement through weighted graphs. They are useful for network design, allocation, dependency coverage, and capacity analysis.

## Consumer-Level Explanation

Use `min_cost_max_flow` when maximize flow while minimizing total cost is the graph-analysis or operational question you actually need to answer. Keep the call explicit because its `YIELD` columns, row grain, and required runtime state determine how the rest of the Cypher pipeline can safely compose it. These algorithms make stronger assumptions about weights, terminals, prizes, and capacities than simple traversal, so parameter meaning must be explicit.

## Conceptual Explanation

`min_cost_max_flow` should be read as one named procedure contract in the broader Nexyron Cypher surface. The procedure call is not only a syntax hook: it defines what runtime state, projection, registry entry, or graph algorithm is being asked to operate, and it determines which output columns downstream `YIELD`, `WITH`, and `RETURN` stages can safely use.

## More Detailed Explanation

This differs from max\_flow by caring not only about quantity moved but also the price of moving it

In practical queries, start by deciding the row grain you want after the call: one row per node, one row per path, one row per registry object, one row per artifact, or one row per summary. Then keep that grain explicit with `YIELD` and named projections. That is the difference between a useful planner-facing example and a vague call that downstream tooling cannot safely compose. For contract-driven procedures, the executable examples on these pages intentionally inspect procedure metadata unless the required named artifacts are created in the same example.

## How It Differs From Nearby Algorithms

This differs from max\_flow by caring not only about quantity moved but also the price of moving it.

## Advanced Example

This example yields named columns from `min_cost_max_flow` and returns a bounded result shape that downstream planner tooling can compose without guessing column names or row grain.

```cypher
CALL nexyron.min_cost_max_flow({source: 0, sink: 1}) YIELD source, target, flow, cost, max_flow
RETURN source, target, flow, cost, max_flow
LIMIT 10
```

## Real Use Cases

-   capacity routing with cost tradeoffs
-   supply or logistics modeling
-   network optimization
-   compare algorithm output with domain labels or time windows before operationalizing it
-   feed graph-analytic scores into ranked reports, feature contracts, or investigation queues only after checking the modeling assumptions

## Real Limitations And Tradeoffs

-   needs both capacity and cost semantics to be trustworthy
-   algorithm output reflects the projected graph, not an abstract real-world network outside the data model
-   nearby algorithms can answer different questions even when their output columns look similar
