home / skills / a5c-ai / babysitter / flow-network-builder

This skill models optimization problems as network flow problems, building flow networks and selecting optimal algorithms to solve them.

npx playbooks add skill a5c-ai/babysitter --skill flow-network-builder

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.8 KB
---
name: flow-network-builder
description: Model optimization problems as network flow problems
allowed-tools:
  - Read
  - Write
  - Grep
  - Glob
---

# Flow Network Builder Skill

## Purpose

Model optimization problems as network flow problems, constructing appropriate flow networks and selecting optimal algorithms.

## Capabilities

- Identify max-flow/min-cut modeling opportunities
- Construct flow network from problem description
- Select optimal flow algorithm
- Handle min-cost flow variants
- Bipartite matching reduction
- Circulation problems

## Target Processes

- advanced-graph-algorithms
- graph-modeling
- optimization problems

## Flow Problem Types

1. **Maximum Flow**: Find max flow from source to sink
2. **Minimum Cut**: Partition minimizing cut capacity
3. **Bipartite Matching**: Maximum matching via flow
4. **Min-Cost Max-Flow**: Cheapest maximum flow
5. **Circulation**: Flow with lower bounds

## Reduction Patterns

- Assignment problems -> Bipartite matching
- Scheduling -> Flow with constraints
- Path cover -> Flow reduction
- Edge-disjoint paths -> Unit capacity flow

## Input Schema

```json
{
  "type": "object",
  "properties": {
    "problemDescription": { "type": "string" },
    "problemType": {
      "type": "string",
      "enum": ["maxFlow", "minCut", "matching", "minCostFlow", "circulation"]
    },
    "constraints": { "type": "object" }
  },
  "required": ["problemDescription"]
}
```

## Output Schema

```json
{
  "type": "object",
  "properties": {
    "success": { "type": "boolean" },
    "networkDescription": { "type": "string" },
    "nodes": { "type": "array" },
    "edges": { "type": "array" },
    "source": { "type": "string" },
    "sink": { "type": "string" },
    "algorithm": { "type": "string" },
    "reduction": { "type": "string" }
  },
  "required": ["success"]
}
```

Overview

This skill models optimization problems as network flow problems and produces concrete flow network designs ready for algorithmic solving. It helps translate verbal or formal problem descriptions into nodes, edges, capacities, costs, source/sink selection, and recommended algorithms. The goal is to make graph-modeling decisions explicit so downstream code or solvers can be plugged in deterministically.

How this skill works

Given a problem description and optional problemType or constraints, the skill identifies whether a flow reduction applies (max flow, min cut, bipartite matching, min-cost flow, or circulation). It constructs a networkDescription plus explicit nodes and edges with capacities and costs, selects an algorithm suited to scale and problem type, and indicates any reduction pattern used. The output follows a predictable schema so orchestrators can validate and resume execution.

When to use it

  • You need to convert assignment, scheduling, or routing problems into flow formulations.
  • You want a reproducible mapping from natural-language constraints to graph elements.
  • You need to pick a flow algorithm tailored to size and cost constraints.
  • You must produce networks suitable for min-cost or circulation variants.
  • You want automated reductions for bipartite matching or edge-disjoint path problems.

Best practices

  • Provide a clear problemDescription and specify problemType when known to reduce ambiguity.
  • List hard constraints and objective priorities separately so the reduction preserves them.
  • Include expected problem size to guide algorithm selection (Dinic, Edmonds–Karp, successive shortest path, etc.).
  • Use unit capacities when modeling edge-disjoint or matching problems for simpler reductions.
  • Validate the produced network by checking supply/demand balance for circulation cases.

Example use cases

  • Convert a task-assignment description into a bipartite matching network with source/sink and capacities.
  • Model scheduling with resource capacities and time slots as a min-cost flow to minimize delay or cost.
  • Translate a network reliability question into a min-cut instance to find critical edges.
  • Build a circulation network when lower bounds and node supplies/demands must be enforced.
  • Reduce an edge-disjoint paths requirement to a unit-capacity max-flow instance.

FAQ

What input yields the best network designs?

A concise problemDescription plus explicit constraints and expected size lets the skill choose precise node/edge mappings and the most efficient algorithm.

Which algorithms will you recommend?

Recommendations depend on type and scale: Dinic or push-relabel for large max-flow, Edmonds–Karp for clarity, successive shortest path or capacity-scaling for min-cost, and circulation-specific reductions when lower bounds exist.

Can you handle mixed objectives or soft constraints?

Soft constraints are modeled via costs or additional penalty edges; specify priorities so the skill encodes them as min-cost elements or separate feasibility checks.