Optimizing a shortest path problem

689 Views Asked by At

I am asked to formulate shortest path problem as a min-cost flow problem and I am stuck on the following step:

Min cost flow probelm can be formulated as https://en.wikipedia.org/wiki/Minimum-cost_flow_problem.

I am taking away the capacity constraint and the required flow constraint. But with the two constraints left, there is nothing stopping the algorithm from just giving me a 0 flow answer. How can i ensure the min problem gives a directed path?

Note: I assumed i cannot be using the constraint from shortest path which is using st-cuts>=1. That would defeat the whole purpose of the problem.

1

There are 1 best solutions below

2
On

To solve a shortest $s$-$t$ path problem as a minimum-cost network flow problem, send one unit of flow from $s$ to $t$. That is, you have a supply of $1$ at node $s$, a demand of $1$ (or supply of $-1$) at node $t$, and supply of $0$ at all other nodes.