Polynomial-time and exponential time

text book: Introduction to the theory of computation_third edition - Michael Sipser

please download the assignment in the following link and write the code in Jupyter notebook

https://github.com/burtr/Workbook/blob/master/fa-sim/csc427-202-problem-set-8.ipynb

Please write as much as possible not so complex

Your tasks are to,

1- Write a polynomial time predicate VerifyPath.find_if_path, that given a graph and two vertices, returns true if the two vertices are vertices in the graph, and there is a path in the graph connecting the two vertices. Else it returns False.

2- Write a polynomial time predicate VerifyKCover.verify, that given a graph and a list of vertices, returns true if the list of vertices is a vertex-covering of the graph. That is, ever edge of the graph has at least one end vertice in the given cover. Else it returns False.

3- Write an exponential time search algoirthm, SolveKCover.search_brute_force, that given a graph and an integer k, returns a vertex-covering with exactly k vertices of the graph, or else returns the empty list. The algorithm will work by enumerating all subsets of k vertices from the set of all the graph's vertices, and will apply the verifying on each such candidate solution.

4- Write a polynomial time reduction Reduction.reduce from 3-SAT to Vertex Cover, that is, which given an instance of 3-SAT produces a graph and a number k, such that 3-SAT is satisfiable if and only if the graph has a k covering.

5- Write a polynomail time function Reduction.pullback, which given a 3-SAT to Vertex Cover reduction, and a k cover, produces a satisfying assignment for the 3-SAT instance, the subject of the reduction.

6- Complete method Reduction.solve. Write a 3-SAT solver that solves a 3-SAT instance by reducing it to a Vertex Cover instance, solves the instance by brute force, and pulls back the vertex cover solution to a satisfying assignment for the 3-SAT instance.

Sample Solution