Problem: A. Show That SPATH ? P. B. Show That LPATH Is NP-complete
Problem: A. Show That SPATH ? P. B. Show That LPATH Is NP-complete
Step-by-step solution
Step 1 of 3
a)
Class- P : P is class of languages that are decidable in polynomial time on a deterministic single – tape Turing machine. We have to construct an
3. If an edge is found connecting s marked as “i” to an unmarked node t, mark node t with .
This algorithm is similar to PATH algorithm. Here we additionally need to keep the track of length of the shortest paths discovered. That will be done in
polynomial time .
Therefore, .
Comments (1)
Step 2 of 3
(b)
1. B is in NP and
1. :
We know that “NP is the class of languages that have polynomial time verifies.
We construct a verifies V for as follows:
5. Otherwise, reject
So, .
Comments (1)
Step 3 of 3
2.
Consider an instant of problem where is a graph with assigned starting node a and ending node b.
• We need to prove
• It must be a simple path that goes through every node exactly once,
• So
• So this simple path must pass through all of needs in graph G exactly once.
• It implies that
Comment