Unit 5 Part 2
Unit 5 Part 2
Problems
Example Kruskal Algorithm
https://www.youtube.com/watch?v=myhWOgjJoaI
Example Travelling Salesman Problem
Key Points
Given a set of cities and the distance between every pair of cities, the problem is to find the shortest possible
route that visits every city exactly once and returns to the starting point. Note the difference between
Hamiltonian Cycle and TSP. The Hamiltonian cycle problem is to find if there exists a tour that visits every city
exactly once. Here we know that Hamiltonian Tour exists (because the graph is complete) and in fact, many such
tours exist, the problem is to find a minimum weight Hamiltonian Cycle.
For example, consider the graph shown in the figure on the right side. A TSP tour in the graph is 1-2-4-3-1. The
cost of the tour is 10+25+30+15 which is 80. The problem is a famous NP-hard problem. There is no
polynomial-time know solution for this problem. The following are different solutions for the traveling salesman
problem.
Proving SAT is NP:
1. A certificate for an instance x of SAT consists of a truth assignment for the input variables of x.
2. The verification algorithm replaces each of the variables with the truth assignments from the
certificate, and evaluates the value of the expression, which can be done in polynomial time.
3. Since the expression can only evaluate to 1 if the formula is satisfiable, we have a polynomial-time
verification algorithm for SAT. That is, SAT is NP.