-2
$\begingroup$

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 ..

$\endgroup$
2
  • $\begingroup$ What have you tried and where did you get stuck? Also, please restrict yourself to one question per post. $\endgroup$
    – Raphael
    Nov 2, 2015 at 17:23
  • 1
    $\begingroup$ For finding $T(n,k)$, check our reference question. $\endgroup$ Nov 2, 2015 at 19:35

1 Answer 1

1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.