GenerateRandomSearch

Flow Network Generator

How much can travel from the source to the sink when every pipe has a capacity? The answer is always limited by some set of pipes that, if cut, would separate the two ends completely — and the maximum flow always equals the capacity of the cheapest such cut. That equality is the max-flow min-cut theorem, and here it is the check: the page computes both numbers separately and they have to match.

What this generator does

Builds a layered directed network where every edge runs forward, so the source and sink are unambiguous and no cycles appear. Edmonds-Karp then pushes flow along shortest augmenting paths until none remain, and whatever the residual network still reaches from the source is the source side of a minimum cut.

How to use this tool

  1. Choose how many nodes the network has and how densely they connect.
  2. Work out how much can get from the first node to the last.
  3. Compare with the flow shown on each edge.
  4. Read off the bottleneck cut and confirm its capacity equals the flow.

Understanding the controls

How many nodes
Between 4 and 12. The first is the source and the last is the sink.
Extra edge density (%)
How many forward edges appear beyond the chain that guarantees a route exists. Denser networks usually carry more flow.
Seed
Reproduces the same capacities exactly, so the same network can be set twice.

Common use cases

  • Worked max-flow examples with the bottleneck identified
  • Showing max-flow min-cut on concrete networks rather than as a statement
  • Capacity-planning questions in abstract form
  • Test instances for a flow implementation
  • Reproducing the same network from a seed

How this generator works

Edmonds-Karp finds augmenting paths breadth-first, which bounds the number of iterations and makes the run predictable. The check verifies three things independently: no edge carries more than its capacity, every node except the source and sink conserves what passes through it, and the stated cut capacity equals the stated flow.

Randomness and fairness

The network's capacities are random; the maximum flow and the minimum cut are computed exactly. Seeded networks reproduce and are therefore explicitly not cryptographically secure. Unseeded, the browser's cryptographically secure generator supplies the capacities.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Networks are layered and acyclic, which is easier to read than a general network and is not the hardest case.
  • Single source and single sink only; multi-commodity flow is a different problem.
  • Capacities are whole numbers, which keeps the arithmetic exact.
  • The minimum cut shown is the one nearest the source; others of the same capacity may exist.
  • Networks are not stored between visits.

Privacy and your data

Capacities and flows are computed in your browser. No network or seed is transmitted or kept.