Skip to content

Main content

Random Maximum Flow Instance Generator

Generate a capacitated directed network containing a spanning source-to-sink path, with a feasible positive flow witness; reverse arcs are allowed, with no maximum-flow claim.

Loading tool…

Description

Generate a capacitated directed network containing a spanning source-to-sink path, with a feasible positive flow witness; reverse arcs are allowed, with no maximum-flow claim.

An optimization instance defines choices, constraints, and an objective. A feasible witness demonstrates that its stated constraints can be met; it establishes optimality only when the tool actually computes and verifies an optimum.

Generate a capacitated directed network containing a spanning source-to-sink path, with a feasible positive flow witness; reverse arcs are allowed, with no maximum-flow claim.

When to use this tool

Use this generator to create reproducible maximum flow instance cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply nodeCount, arcCount, minimumCapacity, maximumCapacity in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read nodes, source, sink, arcs, witnessPath, arcFlows, flowValue. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.

Construct a directed network with a source-to-sink chain, draw capacities, and send the minimum chain capacity along every chain arc with zero on other arcs. Return the feasible path, aligned flows, and flow value.1

Input fieldMeaning and unitsAccepted input
nodeCountNode CountRequired. Safe integer; minimum 2; maximum 32.
arcCountArc CountRequired. Safe integer; minimum 1; maximum 992.
minimumCapacityMinimum CapacityRequired. Safe integer; minimum 1; maximum 9007199254740991.
maximumCapacityMaximum CapacityRequired. Safe integer; minimum 1; maximum 9007199254740991.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
nodesNodesRequired. Array of Safe integer; minimum 0; maximum 31.; minimum items 2; maximum items 32.
sourceSourceRequired. Safe integer; minimum 0; maximum 31.
sinkSinkRequired. Safe integer; minimum 0; maximum 31.
arcsArcsRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 992.
arcs[].fromFromRequired. Safe integer; minimum 0; maximum 31.
arcs[].toToRequired. Safe integer; minimum 0; maximum 31.
arcs[].capacityCapacityRequired. Safe integer; minimum 1; maximum 9007199254740991.
witnessPathWitness PathRequired. Array of Safe integer; minimum 0; maximum 31.; minimum items 2; maximum items 32.
arcFlowsArc FlowsRequired. Array of Safe integer; minimum 0; maximum 9007199254740991.; minimum items 1; maximum items 992.
flowValueFlow ValueRequired. Safe integer; minimum 1; maximum 9007199254740991.
randomnessReplay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source.Required. Object; no unknown keys.
randomness.seedOptional numeric replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "nodeCount": 4,
    "arcCount": 6,
    "minimumCapacity": 2,
    "maximumCapacity": 9,
    "seed": 42
  },
  "output": {
    "nodes": [
      0,
      1,
      2,
      3
    ],
    "source": 0,
    "sink": 3,
    "arcs": [
      {
        "from": 0,
        "to": 1,
        "capacity": 5
      },
      {
        "from": 1,
        "to": 2,
        "capacity": 3
      },
      {
        "from": 2,
        "to": 3,
        "capacity": 9
      },
      {
        "from": 0,
        "to": 2,
        "capacity": 7
      },
      {
        "from": 3,
        "to": 1,
        "capacity": 4
      },
      {
        "from": 1,
        "to": 3,
        "capacity": 3
      }
    ],
    "witnessPath": [
      0,
      1,
      2,
      3
    ],
    "arcFlows": [
      3,
      3,
      3,
      0,
      0,
      0
    ],
    "flowValue": 3,
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Despite the instance name, the returned witness is not a solved maximum flow. Extra arcs may permit greater flow; source is zero, sink is nodeCount minus one, and direction matters.
  • A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Maximum Flow Instance Generator — tool.io

Similar or alternative tools

  • Random Minimum-Cost Flow Instance Generator

    Generate a capacitated directed network containing a spanning source-to-sink path, with a feasible fixed-amount flow and nonnegative unit costs witness; reverse arcs are allowed, with no cost-minimality claim.

  • Random Interval Scheduling Challenge Generator

    Generate synthetic positive-duration half-open jobs and solve the declared count or weight objective exactly with finish-time dynamic programming, retaining one optimum with exclusion on objective ties.