Questions tagged [max-flow]

The maximum-flow problem, a problem in computer science over a flow network

The maximum flow (max-flow) problem is a problem in computer science, studied in the theory of s, involving finding the maximum flow over a given flow network. It is closely related to the problem for graphs.

214 questions
3
votes
1 answer

Graph cut with python: How to set up the graph correctly?

I want to use the graph cut algorithm on images in my project, I'm using python 2.7. I found the pymaxflow implementation, but the documentation doesn't seems so clear. I make an example, here is my 5*5 matrix: >>> A array([[ 0, 1, 2, 3, 4], …
Rowandish
  • 2,655
  • 3
  • 31
  • 52
3
votes
1 answer

Ford-Fulkerson Algorithm to terminate within O(|E|) iteration regardless of time complexity of finding augmenting path

Ford Fulkerson Algorithm will run in O(|E|f) time, where f is the maximum flow; however, is there a way to make it run O(|E|)? One of the solution to make it run less than O(|E|f) is to choose an augmenting path that allows the largest increase in…
LarsChung
  • 703
  • 5
  • 10
  • 24
3
votes
2 answers

Network Flow - Simulating a network of water pipes

I'm trying to devise an algorithm that will simulate a network of pipes with multiple sources and multiple sinks of specific capacity. So far I have tried using the classic Ford-Fulkerson algorithm but the issue i run into is this, given the…
Radu
  • 45
  • 4
3
votes
1 answer

Decreasing the capacity of some edge will decrease the max flow

I am trying to find a counter example, but it doesn't seem to exist. However, could not find a proof either. Maybe someone has some idea? Here is the details: For every s-t flow network with a non-zero max flow value, there exists an edge such that…
Simo
  • 2,292
  • 5
  • 30
  • 45
3
votes
1 answer

Is network flow pseudo-polynomial time?

We know that normal knapsack problem has pseudo-polynomial time, because of the runtime of O(nW). I was wondering whether the runtime of network flow is pseudo-polynomial time because the runtime of network flow using Ford-Fulkerson Algorithm is…
CSnerd
  • 2,129
  • 8
  • 22
  • 45
3
votes
1 answer

A variation of Ford Fulkerson Algorithm

Suppose that we redefine the residual network to disallow edges into s. Argue that the procedure FORD-FULKERSON still correctly computes a maximum flow. I was thinking that when we augment a path the residual capacity of reverse edge increases…
justice league
  • 235
  • 2
  • 8
3
votes
2 answers

Calculating max flow in a generalized network

I'm trying to find an efficient, publically available algorithm, preferably with implementation, for solving maximum flow in a generalized (non-pure) network with gains. All multipliers, capacities and flow values are non-zero integers. Does such…
2
votes
1 answer

Missing some paths in edmonds karp max flow algorithm

I'd implement Edmond Karp algorithm, but seems it's not correct and I'm not getting correct flow, consider following graph and flow from 4 to 8: Algorithm runs as follow: First finds 4→1→8, Then finds 4→5→8 after that 4→1→6→8 And I think third…
Saeed Amiri
  • 22,252
  • 5
  • 45
  • 83
2
votes
1 answer

Find an edge using the Ford Fulkerson algorithm?

I'm trying to implement the Ford Fulkerson Algorithm in C++. However, I'm having trouble with my find_edge function. When I call this function in my_alg, it chooses the correct edge and then the flow is incremented in my_alg. It chooses the right…
sekogs
  • 292
  • 4
  • 18
2
votes
1 answer

Why ortools maxflow sample program failed to calculate maxflow when I try it?

I didn't change anything,Retained the source code: // From Taha 'Introduction to Operations Research', example 6.4-2.""" #include #include "ortools/graph/max_flow.h" namespace operations_research { // MaxFlow simple interface…
zyg
  • 29
  • 4
2
votes
1 answer

Min Cost Max Flow algorithm that focuses on equal distribution of flow across all edges, as much as possible

My use case requires solving min cost max flow problem. I am looking for an algorithm that can satisfy the following restriction. I want to add a special restriction to finding the min cost solution. The restriction is that the cost should be…
SaeedOB
  • 21
  • 1
2
votes
2 answers

Disconnect two nodes in undirected weighted graph with min cost

Suppose we have given an undirected weighted graph and a source and destination node we need to disconnect the source and destination node by removing the edges and the cost of removing the edge is the weight for an edge. We need to minimize the…
2
votes
2 answers

Escape Pods Google Foobar Challenge | Max Flow Problem

I am on 4th level of the google foobar challenge. And I am facing issues in the question. I have tried my solution on the provided test cases but the grade checker of google shows that my code is wrong for those test cases as well. Can anybody help…
2
votes
2 answers

Ford-Fulkerson maximum flow step-by-step calculation?

I am currently studying Ford-Fulkerson algorithm based on this code found in R documentation: nodes <- 1:6 arcs <- matrix(c(1,2,1, 1,3,7, 2,3,1, 2,4,3, 2,5,2, 3,5,4, 4,5,1, 4,6,6, 5,6,2), byrow = TRUE, ncol = 3) # Maximum flow with…
Agnes Lee
  • 322
  • 1
  • 12
2
votes
1 answer

s-t cut for undirected weighted graph

I recently got interested in graph theory. I came across the s-t cut for a directed graph. I learned online that the min-cut is equal to the max flow and there are standard algorithms out there that can solve the s-t min cut for a directed graph.…