ps9sol

# ps9sol - Introduction to Algorithms December 8 2006...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to Algorithms December 8, 2006 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Madhu Sudan Problem Set 9 Solutions Problem Set 9 Solutions Problem 9-1. Subgraph Isomorphism Two graphs G 1 = ( V 1 ,E 1 ) and G 2 = ( V 2 ,E 2 ) are said to be isomorphic if there exists a bijection π : V 1 → V 2 , providing a one-to-one correspondence between the vertices of the two graphs, such that ( u,v ) ∈ E 1 if and only if ( π ( u ) ,π ( v )) ∈ E 2 . A graph H = ( V H ,E H ) is a subgraph of G = ( V G ,E G ) if V H ⊆ V G and E H ⊆ E G . Consider the subgraph-isomorphism problem : given two graphs G and H , determine whether G is isomorphic to a subgraph of H . Prove that the subgraph-isomorphism problem is NP-complete. Solution: First, we argue that the subgraph-isomorphism problem belongs to NP. The verification algorithm for subgraph isomorphism, V SUB , takes in a graph G = ( V g ,E g ) , the graph H = ( V h ,G h ) , the vertices of the corresponding subgraph J ⊆ V h , and a permutation function π : J → V g . Given J and π , we can easily verify in polynomial time whether G is isomorphic to the subgraph of H determined by J . For every edge ( u,v ) ∈ E g , search E h to see if ( π ( u ) ,π ( v )) ∈ E h , and search J to see if π ( u ) ∈ J and π ( v ) ∈ J . If all searches returns true for all edges ( u,v ) , then G is isomorphic to a subgraph of H with J as its vertices....
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

ps9sol - Introduction to Algorithms December 8 2006...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online