October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Choose Between a Linear Assignment Solver and Min-Cost Flow

Use linear assignment for one-to-one cost matching; use min-cost flow for capacities, supplies, demands, or a broader network. Check cardinality and solver-specific limits.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a linear assignment solver when you need to pair items from two groups one-to-one at minimum total cost. Choose min-cost flow when the real problem involves a network of routes, capacities, or supplies and demands. Basic assignment can be modeled either way, so the best choice is the one that fits the constraints and the solver interface you plan to use.

Start with the shape of the constraints

Ask whether each item simply needs to be paired with at most one item from another set, or whether units must move through a network with capacities and supply or demand at its nodes. The first is a linear assignment problem; the second is naturally a min-cost flow problem.

As an Amazon Associate I earn from qualifying purchases.

  • Linear assignment: choose worker-job, driver-route, or similar pairs. Each pair has a cost, and each row and column can be used at most once.
  • Min-cost flow: send units through directed arcs that have capacities and costs, while satisfying node supplies or demands.

Assignment is a special case of flow: a network can be built with a source, worker nodes, task nodes, and a sink, and assignment costs can be put on the worker-to-task arcs. OR-Tools documents this representation in its assignment-as-minimum-cost-flow example. That does not make the two interfaces interchangeable in every application; it means the basic matching model can be expressed in either form.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a linear assignment solver is the clearer fit

Choose linear assignment when the core data is a cost for pairing each member of one group with a member of another, with no additional network structure. A dense cost matrix is a natural input: rows represent one group, columns the other, and each cell gives the cost of that pair.

#1 Best Overall
CATIGA Scientific Calculators with Graphic Functions, Graphing Calculators with Multiple Modes, Scientific Calculators for Students, High School or College Courses, Calculadora Cientifica, CS-121
  • [SCIENTIFIC + GRAPHING IN ONE] – True graphing power in a familiar scientific calculator. Plot functions, analyze graphs, and solve complex equations while viewing the graph and the formula on screen at the same time — so you can see, check, and correct your work at a glance. Built for algebra, trigonometry, calculus, and statistics.
  • [GRAPHING WITHOUT THE BIG PRICE TAG] – The sweet spot between a basic scientific calculator and a bulky, expensive graphing calculator. Everything a high school or college student needs to step up to graphing — plotting, equation solving, and advanced math — at a fraction of the cost of premium graphing models.
  • [360+ FUNCTIONS, 3 SMART MODES] – Angle-measurement, calculation, and display modes adapt to any subject. Over 360 functions including fractions, complex numbers, statistics, linear regression, standard deviation, and variable solving — enough to carry you from pre-algebra through advanced coursework.
  • [BUILT TO GO WHERE YOU STUDY] – Compact 7 x 3.3" body fits your hand, desk, or backpack, and the anti-drop housing plus included protective case guard the screen and keys on the go. Lightweight at just 6.4 oz for all-day study sessions, class, or the library.
  • [365-DAY WARRANTY & FRIENDLY SUPPORT] – Buy with confidence: every CS-121 is backed by a 365-day limited warranty and responsive support within 24 hours. (Tip: if it won't power on, simply press the reset button on the back.)

SciPy’s linear_sum_assignment minimizes the total cost of selected row-column pairs, using each row and column at most once. Its API accepts rectangular matrices; in that case, not every row or column has to be assigned. The current development documentation describes a modified Jonker–Volgenant implementation, but implementation details can change. Check the documentation for the SciPy release you actually deploy.

OR-Tools also provides a dedicated linear sum assignment solver. A direct assignment API is usually the most legible choice when the model is only one-to-one matching.

When min-cost flow is the better model

Choose min-cost flow when the problem itself is a capacitated network. For example, a source may supply multiple units, intermediate nodes may represent facilities or distribution stages, and arcs may limit how much can pass along each route. Costs can be attached to the arcs, while node balances specify supply or demand.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NetworkX describes its min_cost_flow function as returning a minimum-cost flow that satisfies all node demands. For feasibility, the total node demand must sum to zero. Its documentation also warns that its implementation is not guaranteed to work with floating-point edge weights or demands because of roundoff and overflow. That warning applies to NetworkX’s implementation; do not assume it describes every flow solver.

Flow can also be a natural choice for assignment when assignment is only one part of an existing flow network. OR-Tools’ graph documentation covers its flow tools, alongside the assignment example above. However, not every extra rule can be represented as ordinary min-cost flow. If a side constraint cannot be expressed through network capacities, costs, and node balances, you may need a different optimization model.

How to handle sparse allowed pairs

If only some pairs are eligible, a dense matrix may be an awkward way to represent the problem. Use an API that accepts the sparse bipartite graph of allowed pairs and check its matching requirement explicitly.

Rank #2
Sharp 8-Digit Dual Power Pocket Calculator, Gray/Blue (EL-243SB)
  • PROTECTIVE HINGED COVER: Features a hinged, hard cover that protects the keys and display when stored, making this handheld calculator durable and easy to carry safely.
  • DUAL-POWER SOURCE: Runs on solar energy with a battery backup, ensuring consistent and reliable use in any lighting condition or environment.
  • LCD SCREEN SIZE: The 2-inch screen size, 8-digit LCD screen clearly shows each digit, helping to prevent reading errors and making numbers easy to read at a glance.
  • CONVENIENT FUNCTION KEYS: Includes a 3-key independent memory, square root key, change sign key, automatic power down, and more to provide efficient, reliable everyday math.
  • TRUSTED BY WORKPLACES FOR DECADES: Sharp has been a dependable name in office calculation for generations — practical tools built around the way people actually work.

SciPy’s min_weight_full_bipartite_matching finds a full matching whose cardinality equals the size of the smaller partition. It raises an error if no such matching exists. That behavior is important when eligibility rules leave some items without a possible partner: this API does not silently return a smaller partial match.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NetworkX’s minimum_weight_full_matching uses the same rectangular full-matching interpretation and delegates the calculation to SciPy. Confirm that a full matching of the smaller side is what your application requires before selecting either API.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Decide what unmatched items mean

Rectangular assignment and full matching are not policies for what your business should do with unmatched items; they are solver behaviors that must match a policy you choose.

  • Balanced perfect matching: if both groups must be fully paired, their sizes and eligibility edges must allow it.
  • Full matching of the smaller group: rectangular assignment APIs can leave items on the larger side unmatched. Verify which side and how many items the particular API assigns.
  • Optional or penalized matches: define what it costs to leave an item unmatched, then verify that the solver formulation represents that rule. Do not assume an API’s default cardinality is equivalent to a penalty policy.

Choose by model and interface, not a presumed speed winner

The sources describe APIs and algorithms, not a controlled head-to-head benchmark establishing that one solver is always faster. Performance depends on the structure and size of the instance, how it is represented, the solver and its version, and the numeric types involved.

  1. Write down the actual constraints: one-to-one pairs, capacities, node balances, eligibility, and unmatched-item rules.
  2. Choose the API whose input and matching semantics directly express those constraints.
  3. Check its numeric requirements and limitations in the documentation for the exact library and version you will use.
  4. If runtime matters, benchmark equivalent formulations on representative inputs using that intended version and data type.

For NetworkX flow in particular, use numeric representations consistent with its documented floating-point caveat. For other solvers, consult their own documentation rather than transferring NetworkX’s warning to them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick decision guide

Problem Natural starting point Key check
Dense pairwise cost table; each item can be used at most once Linear assignment Does rectangular assignment’s unmatched-item behavior fit your policy?
Sparse set of eligible pairs Sparse full bipartite matching Can the smaller partition be fully matched?
Multiple units, arc capacities, or node supplies and demands Min-cost flow Do node demands balance, and does the chosen solver support your numeric values?
Assignment embedded in a larger network Often min-cost flow Can every added constraint be expressed as network flow structure?

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.