Skip to main content
VICGeneral MathematicsSyllabus dot point

How does the Hungarian algorithm assign tasks to workers so the total cost is the lowest possible, using row and column reduction?

Model an allocation problem with a cost matrix and a bipartite graph, apply the Hungarian algorithm using row reduction, column reduction and line covering to find the minimum-cost one-to-one allocation

A focused answer to the VCE General Mathematics Unit 4 Networks key-knowledge point on allocation. The cost matrix and bipartite model, row and column reduction, covering zeros with the fewest lines, the adjustment step, and reading off the minimum-cost assignment.

Generated by Claude Opus 4.77 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Setting up the cost matrix
  3. The Hungarian algorithm steps
  4. Why this matters for the exams

What this dot point is asking

VCAA wants you to solve an allocation (assignment) problem: matching workers to tasks one-to-one so the total cost or time is as small as possible. You set it up as a cost matrix (and recognise the underlying bipartite graph), then apply the Hungarian algorithm: reduce rows, reduce columns, cover the zeros with the fewest lines, adjust if needed, and read off the optimal assignment. This is the matching tool of the Networks module.

Setting up the cost matrix

Each row is a worker, each column a task, and each entry the cost (or time) of that worker doing that task. The bipartite graph has workers on one side and tasks on the other, with weighted edges. The goal is a perfect matching of least total weight. The matrix must be square; if it is not, a dummy row or column of zeros is added.

The Hungarian algorithm steps

  1. Row reduction: subtract the smallest entry in each row from every entry in that row.
  2. Column reduction: subtract the smallest entry in each column from every entry in that column.
  3. Cover the zeros: draw the fewest horizontal and vertical lines that cover all zeros.
  4. Test: if the number of lines equals the matrix size, an optimal assignment exists; jump to reading it off. Otherwise continue.
  5. Adjust: find the smallest uncovered entry, subtract it from every uncovered entry, and add it to every entry covered by two lines. Return to step 3.

Why this matters for the exams

Allocation questions reward a disciplined run through the Hungarian steps and a final cost read from the original matrix. Markers check the reductions, the line-covering test, and a valid one-to-one assignment. The problem is the matching counterpart to maximum flow and critical path analysis, completing the decision-mathematics toolkit of the Networks module.

Exam-style practice questions

Practice questions written in the style of VCAA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

2023 VCAA1 marksFour employees are each assigned a different duty. The time taken, in minutes, is: Anthea (Duty 1 to 4) = 8, 7, 7, 8; Bob = 10, 8, 10, 9; Cho = 8, 9, 7, 10; Dario = 7, 7, 8, 9. The duties are allocated to minimise the total time taken. The minimum total time, in minutes, is A. 29 B. 30 C. 31 D. 32 E. 33
Show worked answer β†’

This is a minimum-cost allocation. Use the Hungarian algorithm, or test sensible one-to-one assignments.

The optimal allocation is Anthea to Duty 2 (7), Bob to Duty 4 (9), Cho to Duty 3 (7) and Dario to Duty 1 (7).

total time = 7 + 9 + 7 + 7 = 30 minutes.

No other one-to-one assignment beats this, so the minimum total time is 30 minutes, option B.

2025 VCAA1 marksThe cost, in dollars, for four contractors P, Q, R, S to complete work at four sites is: P (Site 1 to 4) = 15 400, 9600, 22 750, 18 300; Q = 14 500, 10 000, 25 000, 19 450; R = 21 000, 12 400, 29 300, 24 600; S = 19 438, 9000, 23 150, 18 000. Using the Hungarian algorithm, Martha first subtracts the minimum entry in each row from each element in that row, then, using this new table, subtracts the minimum entry in each column from each element in that column. Which one of the following tables correctly displays the results after these two steps are completed?
Show worked answer β†’

Step 1, row reduction. Subtract each row's smallest cost. Row minimums are P 9600, Q 10 000, R 12 400, S 9000, giving rows P: 5800, 0, 13 150, 8700; Q: 4500, 0, 15 000, 9450; R: 8600, 0, 16 900, 12 200; S: 10 438, 0, 14 150, 9000.

Step 2, column reduction on that table. Column minimums are 4500, 0, 13 150, 8700.

The result is P: 1300, 0, 0, 0; Q: 0, 0, 1850, 750; R: 4100, 0, 3750, 3500; S: 5938, 0, 1000, 300, which matches option B.