Dinic algorithm

Dinic algorithm

The Dinic or Dinitz algorithm is based on two notions: a graph level, and a blocking flow (level graph & blocking flow).

To determine the level graph, we place the source at level 1, its successors at level 2, and so on.

dinic algorithm dinitz level graph

The blocking flow is the maximum flow can pass in a given path.

dinic algorithm dinitz level graph

Dinic's algorithm is as follows:

  1. build a level graph
  2. find an increasing path (the smallest) from the source to the well
  3. find the arc limiting the increasing path
  4. find a path increasing from limiting summit to the well
  5. repeat steps 3 and 4 to build a blocking flow until there is no longer an increasing path

Example

Construction of the level graph:

dinic algorithm dinitz level graph

Find an increasing path, find the limiting arc:

dinic algorithm dinitz level graph

Return to step 3 and 4:

dinic algorithm dinitz level graph

And so on until no longer finding an increasing path:

dinic algorithm dinitz level graph