Let G represent an undirected graph. Also let

SPATH={́aG,a,b,k~nGcontainsasimplepathoflengthatmostkfromatob},and

LPATH={́aG,a,b,k~nGcontainsasimplepathoflengthatleastkfromatob}.

a) Show that SPATH? P.

b) Show that LPATH is NP-complete.

Short Answer

Expert verified

a)SPATH+1P.

b) The LPATH is NP-complete.

Step by step solution

01

To construct a DTM M to decide SPATH

a)

P is class of languages that are decidable in polynomial time on a deterministic single $-$ tape Turing machine. We have to construct an deterministic Turing machine $(D T M)$ to decide SPATH in polynomial time.

Let M be the DTM to decide SPATH in polynomial time.

The algorithm of M is as follows:

M=''oninput$G,a,b,k$wherem-nodegraphGhasnodesaandb:

Place a mark "o" on node a.

for eachifrom0tom:

If an edges,tis found connecting s marked as "i" to an unmarked nodet , mark nodet with "i+1''$.

Ifb is marked with a value at mostk , accept. Otherwise reject.

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

$OV+|E|$.

Hence, we constructed a DTM M to decide SPATH in polynomial time.

Therefore,SPATH+1P$.

02

Step 2:To Explain LPATH language

(b)

NP - complete: A language B is NP-complete if it satisfies two conditions.

$B$isinNPand

Every A in NP is polynomial time reducible to B.

To showLPATHisNP-complete,weneedshow$LPATHNP$and$UHAMPATHPLPATH

LPATHNP:We know that "NP is the class of languages that have polynomial time verifies.

We construct a verifies$for$LPATHas follows:

:V=$''oninput$G,a,b,k,c$,wherecisapath

Check is a non - repeated sequence of nodes in G

Check the first term of c is a and last is b.

Check the length of c is larger than or equal to k.

If c satisfies the conditions, accept.

Otherwise, reject

This verifier v can finish in O(ICI)where cis the length of c.

So,LPATHNP.

Therefore, the LPATH is NP-complete.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

A cut in an undirected graph is a separation of the vertices V into two disjoint subsets S and T . The size of a cut is the number of edges that have one endpoint in S and the other in T . Let MAX-CUT=<G,K>|Ghasacutofsizekormore.

Show that MAX-CUT is NP-complete. You may assume the result of Problem 7.26. (Hint: Show thatSATPMAXCUT. The variable gadget for variable x is a collection of 3c nodes labeled with x and another nodes labeled with x . The clause gadget is a triangle of three edges connecting three nodes labeled with the literals appearing in the clause. Do not use the same node in more than one clause gadget. Prove that this reduction works.)

Let CONNECTED={<G>|Gisaconnectedundirectedgraph}.Analyse the algorithm given on page 185 to show that this language is in .

Let ? be a 3cnf-formula. An ≠-assignment to the variables of ? is one where each clause contains two literals with unequal truth values. In other words, an ≠ -assignment satisfies ? without assigning three true literals in any clause.

a. Show that the negation of any ≠ -assignment to ? is also an ≠ -assignment.

b. Let ≠ SAT be the collection of 3cnf-formulas that have an ≠ -assignment. Show that we obtain a polynomial time reduction from 3SAT to ≠ SAT by replacing each clause ci

(y1y2y3)$$

with the two clauses

(y1y2zi)and(zi¯y3b)

Where ziis a new variable for each clause,ci and b is a single additional new variable.

c. Conclude that SATisNP-complete.

Call graphsGandH isomorphic if the nodes of Gmay be reordered so that it is identical to H.

Let ISO=hG,Hi|GandHareisomorphicgraphs.Show that ISONP.

Show thatPRIMES={m|is a prime number in binary} ?. (Hint: Forp>1, the multiplicative groupZ*p={x|x is relatively prime toand } is both cyclic and of orderp-1ifpis prime. You may use this fact without justifying it. The stronger statementPis now known to be true, but it is more difficult to prove.)

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free