7

Sorry for stupid question. I cannot jog my memory and googling did not help me answer this question.

So basically given a graph G(V,E), I know that O(|V|^2) or O(|E|^2 + |V|^2) is considered to be polynomial complexity, so is O(|E|*|V|) polynomial as well? If not, what kind of complexity is it? I believe it's not pseudo-polynomial either.

Another question is: is O(m*n) considered polynomial as well, given m and n are the sizes of two INDEPENDENT inputs to a problem? I just want to clarify the concept of polynomial time in here and want to know if O(m*n) has a different name for its type of complexity.

templatetypedef
  • 328,018
  • 92
  • 813
  • 992
Simo
  • 1,906
  • 5
  • 22
  • 40

1 Answers1

8

it is polynomial O(|V|^3) since the number of edges is bounded O(|V|^2)

Tom Swifty
  • 2,614
  • 2
  • 12
  • 25
  • Oh yeah. Boo me :), how can I not see that? The another question is: is O(m*n) polynomial as well, given m and n are the sizes of two inputs to a problem? I just want to clarify the concept of polynomial time in here. – Simo Oct 31 '13 at 19:30
  • @Simo, i don't understand your follow up question. if you need examples of pseudo-polynomial for a contrast, look here: http://stackoverflow.com/questions/4538581/why-is-the-knapsack-problem-pseudo-polynomial – Tom Swifty Oct 31 '13 at 19:40
  • the difference is that pseudo-polynomial complexity in this case depends on the capacity (ie, right hand size) and this value could be deceivingly large. – Tom Swifty Oct 31 '13 at 19:41
  • I was trying to clarify if O(n*m) is still considered polynomial or not, when n and m are independent of each other. For example, if some test has a question like that and asks me to choose if a problem can be solved in polynomial time? And I need to answer yes or no, and I know the complexity is O(n*m), where n and m are independent, not like in the case where |E| is bounded by |V|^2. Haha, sorry for the long comment – Simo Oct 31 '13 at 19:56
  • Note that a *simple graph* has `O(|V|^2)` edges. A general graph does not have any bound on the number of edges, and it can have `2^|V|` edges. – amit Nov 01 '13 at 00:46
  • @amit great point...multigraphs and hypergraphs can exceed the quadratic bound – Tom Swifty Nov 01 '13 at 11:50