-2

Let $G = (V,E) $ and let be $T \subseteq V$ . $T$ is called vertex cover if each edge of the graph is incident to at least one vertex of $T$ .

Let be the following decisional problem :

$PROBLEM$

Input : $G = (V,E) $ with $n$ nodes ; $k\in \mathbb{N}$ , $k \le n$

Output : $YES$ if exists $T$ such that $T$ is vertex cover with $|T| \le k $ , else $NO$

$a)$ Proof the correctness of the following algorithm for solving $PROBLEM$ :

$V-COV ( G , k ) $

$IF$ ( $E(G)$ = $\emptyset $ ) then $return$ ($YES$ , $\emptyset$) ;

$IF$ ( $E(G)$ > $k$ * ($|V(G)|$-1) ) then $return$ $NO$ ;

Let $\{u,v\}$ $\in$ $E(G)$ ;

$IF$ ( ($V-COV ( G - u , k- 1 ) $ return ($YES$ , $T$ ) ) then $return$ ($YES$ , $T \cup \{u\}$) ;

$ELSE$ $IF$ ( ($V-COV ( G - v , k- 1 ) $ return ($YES$ , $T$ ) ) then $return$ ($YES$ , $T \cup \{v\}$) ;

$ELSE$ $return$ $NO$ ;

$b)$ Find out time complexity $T(n,k)$ for this algorithm and prove if $k$ is constant then it has a polynomial time complexity .

For $a)$ the first $IF$ statement is trivial .. but the others ? For $b)$ vertex cover is in $NP$ , right ? So it has exponential time complexity , right ? I wait answers please ..

penguina
  • 141
  • 4

1 Answers1

1

For b) vertex cover is in NP, right ? So it has exponential time complexity, right?

Yes, vertex cover is in NP. However, that doesn't mean that vertex cover has exponential time complexity: for example, every problem in P is also in NP. You probably mean to say that vertex cover is NP-complete, which means it's probably not in P (unless P = NP). However, NP-completeness is not known to imply that every algorithm must be exponential.

Furthermore, the problem asked about in b) is not vertex cover. In vertex cover, we're given a graph $G$ and an integer $k$ and asked if $G$ has a vertex cover of size at most $k$. However, the problem asked about in b) is whether $G$ has a vertex cover of size at most some fixed value of $k$, which is not part of the input. In particular, you can determine whether any graph has a vertex cover of size at most 17 by testing every set of size 17 to see if it is a vertex cover. That requires testing $O(n^{17})$ sets, which is a polynomial number.

David Richerby
  • 81,689
  • 26
  • 141
  • 235