Блог пользователя snacache

Автор snacache, история, 9 лет назад, По-английски

Hi everyone!

Suppose we have a weighted graph with N vertices and two vertices S and T are given. We have to remove some edges from the graph in order to separate the given vertices (after removing the edges, there should be no path from S to T). Suppose the cost is the sum of the edges weights. Find the minimum cost to achieve this.

In case of tie (more than one way to remove edges, obtaining the minimum cost), remove the minimum number of edges.

I know that finding the minimum cost of the cut can be solved via Max Flow, but how can we handle the ties? Sure, we can find the cut-set, but the cut-set cardinality isn't always the answer.

Is there a good way to handle these cases?

Thanks!

  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +92 Проголосовать: не нравится

add eps to all edge weights?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
1 — Maxflow 
2 — Build a new network where the saturated arcs will have capacity 1 and the other arcs will have capacity oo 
3 — Maxflow
»
9 лет назад, скрыть # |
 
Проголосовать: нравится +21 Проголосовать: не нравится

there is a problem like this in the USACO training pages chapter 4 called "Pollutant Control"

to solve it multiply the capacity of each edge by (number of edges in the network + 1) and subtract 1 (c_new = (E + 1)*c_old — 1) and run maxflow why this works is simple the new maxflow is equal to old_maxflow * (E + 1) — number of edges used ,hence we get minimum number of edges .. why (E + 1) because it's the minimum number such that the -1 that accounts for the number of edges doesn't change the original paths (it's supposed only to break ties between paths with equal augmenting capacity)