How do I apply the Ford-Fulkerson to a minimal cost flow problem?

297 Views Asked by At

I have the following graph : What is in red is the demand/supply.

When positive -> Supply

When negative -> Demand

When $0$ -> Transfer

On each arc there is residual capacity/given flow.

The goal here is to find the maximum amount of flow we can pass through this graph and afterwards minimize the cost.

graph

My first instinct is to create a super-source et super-sink. I get this graph : graph with super-source and super-sink

I also have the following policy that I have to respect while trying to find an augmenting path:

1.If you have a choice between S1...S2 always choose the one with the lowest number (here it's 1 so S1 will be chosen to be part of the augmenting path). Same thing for T1...T2 and D1...D2.

  1. Between a node with Sx and a node Tx choose Tx first if you can.

  2. Between a node with Tx and a node Dx choose Dx first if you can.

After applying the algorithm I get :

graph with ford-dulkerson algorithm

With this solution I'm supposed to find a partial tree that will be a base solution for the minimal cost flow problem. I'm told that I should find this tree by applying those rules:

  1. Every arc with a flow that is below the capacity is included in the partial tree.

  2. If not all nodes are in the tree add arbitrary arcs to the tree.

However if I follow 1. I get a cycle in my graph because of S1 and S3 is left out.

How do I find the correct partial tree to use? Also, should I remove the super-source and the super-sink? enter image description here