Purpose: Harold Gabow’s bit scaling technique applied to weighted matching and shortest paths, building on Edmonds’ matching theory. The general recipe turns a weighted problem into nearly-unweighted ones.

The bit-scaling recipe

Given weights with :

  1. Let — the top bits of each weight.
  2. Solve the problem for (weights in — nearly unweighted, hence cheap).
  3. Given an optimal solution for , note that . So doubling the previous solution gives something within of optimal for , and augmentations repair it.
  4. After rounds, and the solution is exact.

The scaling factor replaces a factor of — turning pseudo-polynomial into weakly polynomial.

Applied to weighted matching

Gabow’s scaling algorithm for maximum weight perfect matching in general graphs runs in

versus or for the classical Blossom-based weighted algorithm. For bipartite graphs the corresponding bound is , improving on the Hungarian algorithm.

Applied to shortest paths

Goldberg’s scaling algorithm solves single-source shortest paths with negative edge weights in

beating Bellman-Ford’s when is moderate. (In 2022 Bernstein-Nanongkai-Wulff-Nilsen gave a near-linear algorithm for the same problem.)

Why scaling works so generally

Two properties make a problem scalable:

  1. Doubling preserves near-optimality. An optimal solution for the top bits, scaled by 2, is close to optimal for the top bits.
  2. Repair is cheap. The gap can be closed with a bounded number of augmenting-path or local-improvement steps.

Almost every combinatorial optimisation problem with integer weights satisfies both, which is why scaling appears in max flow (Ahuja-Orlin), min-cost flow (Goldberg-Tarjan), matching, shortest paths, and assignment.

In practice

Scaling algorithms are rarely written for contests: the constants are large, the code is long, and is usually small enough that the simple algorithm fits in the time limit. The idea is still worth carrying, because “solve the high bits first, then refine” occasionally cracks a problem that resists direct attack — for instance building an answer bit by bit from the most significant bit down, checking feasibility at each step.

Variants / Use Cases