3

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 O(Cm)(m for number of edges and C for the sum of capacity of edges leaving from start point)?

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
CSnerd
  • 2,129
  • 8
  • 22
  • 45
  • 1
    The concept of pseudo-polynomial depends almost entirely on the fact that time complexity is determined by the _length_ of the input. In this case, if you have a set of capacities represented in binary, then increasing that set of capacities by a single bit could potentially increase `C` exponentially. In that sense, the algorithm runs exponentially longer for a single "unit" increase in the input. I'd say it's pseudo-polynomial. – rliu Oct 29 '13 at 03:34
  • 1
    here's a nice reference: http://courses.csail.mit.edu/6.854/06/scribe/s9-maxflow.pdf – Tom Swifty Oct 31 '13 at 12:34

1 Answers1

8

Yes, the Ford-Fulkerson algorithm is a pseudopolynomial time algorithm. Its runtime is O(Cm), where C is the sum of the capacities leaving the start node. Since writing out the number C requires O(log C) bits, this runtime is indeed pseudopolynomial but not actually polynomial.

Strongly-polynomial time algorithms do exist for maximum flow, though, such as the push-relabel algorithm, which runs in time O(n3).

Hope this helps!

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
  • 1
    Do such problems fall under complexity class P or NP-complete? The site http://www.cs.yale.edu/homes/aspnes/pinewiki/MaxFlow.html shows the running time as O(E^2 U). What is the difference between your solution and this website? – LearningToCode Dec 04 '15 at 06:45
  • 2
    @LearningToCode The bound I'm giving is a bit tighter than the one they're listing. They're correct that the maximum size of a cut is no greater than EU, but you can give a tighter bound by noting that the cut formed by just removing s has capacity at most C (in my notation). As for whether this problem is in P or NP-complete, because we have algorithms for max-flow whose runtime is strongly polynomial (not pseudopolynomial), the max-flow problem is definitely in P. It's possible that it's also NP-complete, but no one knows because we don't know if P = NP. (Continued...) – templatetypedef Dec 04 '15 at 17:30
  • 5
    @LearningToCode Remember that only *problems* can be in P or NP, not *algorithms.* – templatetypedef Dec 04 '15 at 17:30