This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Fall 2010 ECE608, Homework #12 Solution (1) CLR 34.11 (a) If LongestPath P, then we can come up with an algorithm LongestPath Length ( G, u, v ). LongestPathLength ( G, u, v ) 1. for k =  V  1 to 1 2. do Ans = LongestPath ( G, u, v, k ) 3. if ( Ans = yes) 4. return k /* path exists */ 5. return 0 /* path does not exist */ If LongestPath runs in polynomial time, so does LongestPathLength . (b) If LongestPathLength P, then we also can come up with an algorithm LongestPath ( G, u, v, k ). LongestPath ( G, u, v, k ) 1. Opt LongestPathLength ( G, u, v ) 2. if k > OPT 3. return No 4. else return Yes Similarly, if LongestPathLength runs in polynomial time, so does Longest Path . From (a) and (b) , we can conclude that LongestPath P if and only if Longest PathLength P. (2) CLR 34.16 Assume that L, L 1 , L 2 P . The following statements hold: L 1 L 2 P since we can decide if x L 1 L 2 by deciding if x L 1 and then if x L 2 . If either holds then x L 1 L 2 otherwise it is not. L 1 L 2 P since we can decide if x L 1 and then if x L 2 . If both hold then x L 1 L 2 otherwise it is not. L P since x L x / L L 1 L 2 P . Given a string x of length n denote its substring from index i to j by x ij . We can then decide x by deciding x 1 k L 1 and x ( k +1) n L 2 for all the n possible values of k 1 L P . We can prove this by showing that the result holds for L k for all k and thus for k i =0 L k . We will use induction on k . If k = 0 we only consider the empty language and the result is trivial. Assume that L k P and consider L k +1 = LL k . The above result on concatenation gives us that LL k P . (3) CLR 34.21 Suppose the certificate y used to verify the language GRAPH ISOMORPHISM is in the form of two lists of vertices v 1 , v 2 , v 3 , ..., v n in G 1 and u 1 , u 2 , u 3 ,..., u n in G 2 with v i corresponding to u i ( i = 1 , 2 , ..., n ). Use DFS (or other polynomialtime algorithms) to explore all the edges in G 1 . Once an edge ( v i , v j ) is found in G 1 , we check in G 2 if there is an edge between u i and u j . If there is, we just go on. If not, G 1 and G 2 are not isomorphic because there isnt an corresponding edge between u i and u j in G 2 for ( v i , v j ) in G 1 ; we stop and return false. After we explore all the edges in G 1 and all the edges in G 1 have their corresponding edges in G 2 , we do the same thing again by exploring all the edges in G 2 and checking if every edge in G 2 has its corresponding edge in G 1 . If every edge in G 1 ( G 2 ) has its corresponding edge in G 2 ( G 1 ), we can make the conclusion that G 1 and G 2 are isomorphic and return TRUE. Otherwise, they are not isomorphic with the certificate y , and this algorithm will return FALSE....
View Full
Document
 Fall '11
 PAI

Click to edit the document details