Define the optimization problem
$\text{LONGEST-PATH-LENGTH}$ as the relation that associates each instance of an undirected graph and two vertices with the number of edges in a longest simple path between the two vertices. Define the decision problem$\text{LONGEST-PATH}$ $= \{\langle G, u, v, k\rangle: G = (V, E)$ is an undirected graph,$u, v \in V, k \ge 0$ is an integer, and there exists a simple path from$u$ to$v$ in$G$ consisting of at least$k$ edges$\}$ . Show that the optimization problem$\text{LONGEST-PATH-LENGTH}$ can be solved in polynomial time if and only if$\text{LONGEST-PATH} \in P$ .
Showing that
Since we know that the number of edges in the longest path length is between
Give a formal definition for the problem of finding the longest simple cycle in an undirected graph. Give a related decision problem. Give the language corresponding to the decision problem.
The problem
Give a formal encoding of directed graphs as binary strings using an adjacencymatrix representation. Do the same using an adjacency-list representation. Argue that the two representations are polynomially related.
(Omit!)
Is the dynamic-programming algorithm for the 0-1 knapsack problem that is asked for in Exercise 16.2-2 a polynomial-time algorithm? Explain your answer.
This isn't a polynomial-time algorithm. Recall that the algorithm from Exercise 16.2-2 had running time
Show that if an algorithm makes at most a constant number of calls to polynomial-time subroutines and performs an additional amount of work that also takes polynomial time, then it runs in polynomial time. Also show that a polynomial number of calls to polynomial-time subroutines may result in an exponential-time algorithm.
(Omit!)
Show that the class
$P$ , viewed as a set of languages, is closed under union, intersection, concatenation, complement, and Kleene star. That is, if$L_1, L_2 \in P$ , then$L_1 \cup L_2 \in P$ ,$L_1 \cap L_2 \in P$ ,$L_1L_2 \in P$ ,$\bar L_1 \in P$ , and$L_1^* \in P$ .
(Omit!)