AAPS Advanced Algorithmic Problem Solving

Lab 2

Lab Assignment 2

The suggested API below is pseudo code, you have to translate it to
your favorite language in an appropriate way. The graph type can
vary between different APIs, depending on what extra information,
such as weights, markings, flows, etc., is relevant for the problem.

The "recommended time complexity" is what is required to pass the
time requirements in Kattis.

Sometimes Kattis does not check exactly what is required for the
task. For example, you might be asked to find the shortest path from
x to y, while Kattis only asks for the shortest distance. In such a
case, you should solve the problem as stated in the lab
assignment. That Kattis accepts your solution is a necessary but not
sufficient condition to get the points for the task.

Task 2.8: Minimal cost maximum flow (1p)

Implement an algorithm for finding the maximum flow with the minimal
cost in a graph. This is a generalization of maximum flow where
each edge both has a capacity and a cost. The cost of a flow
through an edge is the flow multiplied by the cost for that edge.

Kattis only asks for the maximal flow and the minimal cost while
your solution should be able to construct the actual flow.