on the complexity of submap isomorphismon the complexity of submap isomorphism christine solnon1,...
TRANSCRIPT
On the Complexity of Submap Isomorphism
Christine Solnon1, Guillaume Damiand1, Colin de la Higuera2
and Jean-Christophe Janodet3
(1) LIRIS, INSA de Lyon / CNRS(2) LINA, Universite de Nantes / CNRS
(3) IBISC, Universite d’Evry
GbR 2013
1/18
Motivations
Plan
1 Motivations
2 Recalls on Generalized Maps
3 Recalls on Computational Complexity
4 Reduction of Planar-4 3-SAT to Submap Isomorphism
5 Conclusion
2/18
Motivations
Induced Subgraph Isomorphism
G’=(N’,E’)G=(N,E)
Is G a pattern of G′ ?
Search for an injective matching that preserves all edges betweenmatched vertices
NP-complete problem
3/18
Motivations
Induced Subgraph Isomorphism
G’=(N’,E’)G=(N,E)
Is G a pattern of G′ ?
Search for an injective matching that preserves all edges betweenmatched vertices
NP-complete problem
3/18
Motivations
Partial Subgraph Isomorphism
G’=(N’,E’)G=(N,E)
Is G a partial pattern of G′ ?
Search for an injective matching that preserves pattern edges
NP-complete problem
4/18
Motivations
Partial Subgraph Isomorphism
G’=(N’,E’)G=(N,E)
Is G a partial pattern of G′ ?
Search for an injective matching that preserves pattern edges
NP-complete problem
4/18
Motivations
Plane Subgraph Isomorphism
Is the left-hand side graph included in the right-hand side one ?
Yes... but do they look similar ?
Graphs modelling images are embedded in planes Let us compare plane graphs Use generalized maps to model plane graphs
GbR 2009: Polynomial algorithm for submap iso.Precondition: the pattern map must be connected
Question: Polynomial algorithm when the pattern map is not connected ?
5/18
Motivations
Plane Subgraph Isomorphism
Is the left-hand side graph included in the right-hand side one ?Yes... but do they look similar ?
Graphs modelling images are embedded in planes Let us compare plane graphs Use generalized maps to model plane graphs
GbR 2009: Polynomial algorithm for submap iso.Precondition: the pattern map must be connected
Question: Polynomial algorithm when the pattern map is not connected ?
5/18
Motivations
Plane Subgraph Isomorphism
Is the left-hand side graph included in the right-hand side one ?Yes... but do they look similar ?
Graphs modelling images are embedded in planes Let us compare plane graphs Use generalized maps to model plane graphs
GbR 2009: Polynomial algorithm for submap iso.Precondition: the pattern map must be connected
Question: Polynomial algorithm when the pattern map is not connected ?
5/18
Motivations
Plane Subgraph Isomorphism
Is the left-hand side graph included in the right-hand side one ?Yes... but do they look similar ?
Graphs modelling images are embedded in planes Let us compare plane graphs Use generalized maps to model plane graphs
GbR 2009: Polynomial algorithm for submap iso.Precondition: the pattern map must be connected
Question: Polynomial algorithm when the pattern map is not connected ?5/18
Recalls on Generalized Maps
Plan
1 Motivations
2 Recalls on Generalized Maps
3 Recalls on Computational Complexity
4 Reduction of Planar-4 3-SAT to Submap Isomorphism
5 Conclusion
6/18
Recalls on Generalized Maps
From plane graphs to generalized mapsDefinition: nD generalized map M = (D, α0, . . . , αn)
D = finite set of darts∀i , αi is an involution on D∀i ,∀j ≥ i + 2, αi ◦ αj is an involution on D
Example:Graph:
2G-map:
Involutions:
a b c d e f g h i j k l m nα0 h c b e d g f a j i l k n m
α1 b a d c f e h g n k j m l iα2 a b c i j f g h d e k l m n
Notation:Given E ⊆ D, seamsM(E) = {(d , i , αi(d)),d ∈ E ,alphai(d) 6= d}Example: seamsM({a,b, c}) = {(a,1,b), (b,1,a), (b,0, c), (c,0,b)}
7/18
Recalls on Generalized Maps
From plane graphs to generalized mapsDefinition: nD generalized map M = (D, α0, . . . , αn)
D = finite set of darts∀i , αi is an involution on D∀i ,∀j ≥ i + 2, αi ◦ αj is an involution on D
Example:Graph:
2G-map:
Involutions:
a b c d e f g h i j k l m nα0 h c b e d g f a j i l k n mα1 b a d c f e h g n k j m l i
α2 a b c i j f g h d e k l m n
Notation:Given E ⊆ D, seamsM(E) = {(d , i , αi(d)),d ∈ E ,alphai(d) 6= d}Example: seamsM({a,b, c}) = {(a,1,b), (b,1,a), (b,0, c), (c,0,b)}
7/18
Recalls on Generalized Maps
From plane graphs to generalized mapsDefinition: nD generalized map M = (D, α0, . . . , αn)
D = finite set of darts∀i , αi is an involution on D∀i ,∀j ≥ i + 2, αi ◦ αj is an involution on D
Example: Graph: 2G-map:
Involutions:
a b c d e f g h i j k l m nα0 h c b e d g f a j i l k n mα1 b a d c f e h g n k j m l iα2 a b c i j f g h d e k l m n
Notation:Given E ⊆ D, seamsM(E) = {(d , i , αi(d)),d ∈ E ,alphai(d) 6= d}Example: seamsM({a,b, c}) = {(a,1,b), (b,1,a), (b,0, c), (c,0,b)}
7/18
Recalls on Generalized Maps
From plane graphs to generalized mapsDefinition: nD generalized map M = (D, α0, . . . , αn)
D = finite set of darts∀i , αi is an involution on D∀i ,∀j ≥ i + 2, αi ◦ αj is an involution on D
Example: Graph: 2G-map:
Involutions:
a b c d e f g h i j k l m nα0 h c b e d g f a j i l k n mα1 b a d c f e h g n k j m l iα2 a b c i j f g h d e k l m n
Notation:Given E ⊆ D, seamsM(E) = {(d , i , αi(d)),d ∈ E ,alphai(d) 6= d}Example: seamsM({a,b, c}) = {(a,1,b), (b,1,a), (b,0, c), (c,0,b)}
7/18
Recalls on Generalized Maps
Induced and Partial Submap Isomorphism
DefinitionsM = (D, α0, . . . , αn) and M ′ = (D′, α′
0, . . . , α′n) are isomorphic if ∃ a
bijection f : D → D′ such that ∀d ∈ D,∀i ∈ [0,n], f (αi(d)) = α′i (f (d)).
M ′ = (D′, α′0, . . . , α
′n) is an induced submap of M = (D, α0, . . . , αn) if
D′ ⊆ D and seamsM′(D′) = seamsM(D′).M ′ = (D′, α′
0, . . . , α′n) is a partial submap of M = (D, α0, . . . , αn) if D′ ⊆ D
and seamsM′(D′) ⊆ seamsM(D′).
Example:
b d
a c
M M ′
M ′′
M is isomorphic to an induced submap of M ′
but not M ′′
8/18
Recalls on Generalized Maps
Induced and Partial Submap Isomorphism
DefinitionsM = (D, α0, . . . , αn) and M ′ = (D′, α′
0, . . . , α′n) are isomorphic if ∃ a
bijection f : D → D′ such that ∀d ∈ D,∀i ∈ [0,n], f (αi(d)) = α′i (f (d)).
M ′ = (D′, α′0, . . . , α
′n) is an induced submap of M = (D, α0, . . . , αn) if
D′ ⊆ D and seamsM′(D′) = seamsM(D′).M ′ = (D′, α′
0, . . . , α′n) is a partial submap of M = (D, α0, . . . , αn) if D′ ⊆ D
and seamsM′(D′) ⊆ seamsM(D′).
Example:
b d
a c
M M ′ M ′′
M is isomorphic to an induced submap of M ′ but not M ′′
8/18
Recalls on Generalized Maps
Induced and Partial Submap Isomorphism
DefinitionsM = (D, α0, . . . , αn) and M ′ = (D′, α′
0, . . . , α′n) are isomorphic if ∃ a
bijection f : D → D′ such that ∀d ∈ D,∀i ∈ [0,n], f (αi(d)) = α′i (f (d)).
M ′ = (D′, α′0, . . . , α
′n) is an induced submap of M = (D, α0, . . . , αn) if
D′ ⊆ D and seamsM′(D′) = seamsM(D′).M ′ = (D′, α′
0, . . . , α′n) is a partial submap of M = (D, α0, . . . , αn) if D′ ⊆ D
and seamsM′(D′) ⊆ seamsM(D′).
Example:
b d
a c
M M ′ M ′′
M is isomorphic to a partial submap of M ′ and M ′′
8/18
Recalls on Generalized Maps
Algorithm for Submap Isomorphism [GbR 2009]
Basic idea:Choose a dart d in the pattern map MFor each dart d ′ in the target map M ′:
Traverse M and M ′ in parallel and build a mappingIf the mapping is an isomorphism then answer Yes
Answer No
Complexity: O(|D| · |D′|)
Precondition: The pattern map M must be connected
M M ′9/18
Recalls on Generalized Maps
Algorithm for Submap Isomorphism [GbR 2009]
Basic idea:Choose a dart d in the pattern map MFor each dart d ′ in the target map M ′:
Traverse M and M ′ in parallel and build a mappingIf the mapping is an isomorphism then answer Yes
Answer No
Complexity: O(|D| · |D′|)
Precondition: The pattern map M must be connected
M M ′9/18
Recalls on Computational Complexity
Plan
1 Motivations
2 Recalls on Generalized Maps
3 Recalls on Computational Complexity
4 Reduction of Planar-4 3-SAT to Submap Isomorphism
5 Conclusion
10/18
Recalls on Computational Complexity
Complexity classes
Class P∃ Polynomial time algorithm on a deterministic Turing machine
Class NPPolynomial time algorithm on a Non deterministic Turing machine There may be an exponential number of candidates to check
but ∃ polynomial algorithm for deciding if a given candidate is a solution
NP-complete problems
Hardest problems of NP: If one NP-complete problem is shown to belong to P then P = NP
How to prove that a problem p is NP-complete ?
Find a reduction of a known NP-complete problem to p
11/18
Recalls on Computational Complexity
The Boolean Satisfiability Problem (SAT)
Definition of the SAT problem:Input: a Boolean expression EQuestion: Is there a truth assignment of the variables that satisfies E?
First known NP-complete problem [Cook 1971]
Example:Input: E = (¬x ∨ y ∨ u)
∧ (¬x ∨ y ∨ ¬z)∧ (¬y ∨ z ∨ u)∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
Solution = {¬x , y ,¬z,u,w}
Special case of SAT which is still NP-complete: Planar-4 3-SATAll clauses have 3 literalsEach variable occurs in at least 2 and at most 4 different clausesThe bipartite graph associated with E is planar
12/18
Recalls on Computational Complexity
The Boolean Satisfiability Problem (SAT)
Definition of the SAT problem:Input: a Boolean expression EQuestion: Is there a truth assignment of the variables that satisfies E?
First known NP-complete problem [Cook 1971]
Example:Input: E = (¬x ∨ y ∨ u)
∧ (¬x ∨ y ∨ ¬z)∧ (¬y ∨ z ∨ u)∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
Solution = {¬x , y ,¬z,u,w}
Special case of SAT which is still NP-complete: Planar-4 3-SATAll clauses have 3 literalsEach variable occurs in at least 2 and at most 4 different clausesThe bipartite graph associated with E is planar
12/18
Recalls on Computational Complexity
The Boolean Satisfiability Problem (SAT)
Definition of the SAT problem:Input: a Boolean expression EQuestion: Is there a truth assignment of the variables that satisfies E?
First known NP-complete problem [Cook 1971]
Example:Input: E = (¬x ∨ y ∨ u)
∧ (¬x ∨ y ∨ ¬z)∧ (¬y ∨ z ∨ u)∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
Solution = {¬x , y ,¬z,u,w}
C4
C2
C3
C5
w
C1
y
x
u
z
Special case of SAT which is still NP-complete: Planar-4 3-SATAll clauses have 3 literalsEach variable occurs in at least 2 and at most 4 different clausesThe bipartite graph associated with E is planar
12/18
Reduction of Planar-4 3-SAT to Submap Isomorphism
Plan
1 Motivations
2 Recalls on Generalized Maps
3 Recalls on Computational Complexity
4 Reduction of Planar-4 3-SAT to Submap Isomorphism
5 Conclusion
13/18
Reduction of Planar-4 3-SAT to Submap Isomorphism
Reduction of Planar-4 3-SAT to Submap Isomorphism
Goal of the reduction:
Let E be a boolean formula with v variables and c clauses
Give a polynomial time algorithm for building two maps M and M ′
such that there exists a solution to E iff M is a submap of M ′
Basic idea: Associate patterns with variables and clauses
The pattern map M is composed of v + c connected components
The target map M ′ is derived from the plane graph associated with E :
Replace vertices by the corresponding patterns2-sew patterns associated with adjacent vertices
Submap isomorphism⇔ Selection of 1 satisfied litteral for each clause
14/18
Reduction of Planar-4 3-SAT to Submap Isomorphism
Example for induced submap isomorphism
Instance of Planar-4 3-SAT:(¬x ∨ y ∨ u) ∧ (¬x ∨ y ∨ ¬z)
∧ (¬y ∨ z ∨ u) ∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
C4
C2
C3
C5
w
C1
y
x
u
z
Pattern map M:
w:
x: y: z:
u:
C3:
C4:
C5:C2:
C1:
Target map M ′:
15/18
Reduction of Planar-4 3-SAT to Submap Isomorphism
Example for induced submap isomorphism
Instance of Planar-4 3-SAT:(¬x ∨ y ∨ u) ∧ (¬x ∨ y ∨ ¬z)
∧ (¬y ∨ z ∨ u) ∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
C4
C2
C3
C5
w
C1
y
x
u
z
Pattern map M:
w:
x: y: z:
u:
C3:
C4:
C5:C2:
C1:
Target map M ′:
w
x
x
x
x
x
x
u u
u
u
uu
u
x
x
x
u
u
u
C1
C2
C3 C4
C5
y
z
y
y
y
yy
y
y
y
z
z zz
z
z
z
z
z
u
u
w
w
w
w
w
15/18
Reduction of Planar-4 3-SAT to Submap Isomorphism
Example for induced submap isomorphism
Instance of Planar-4 3-SAT:(¬x ∨ y ∨ u) ∧ (¬x ∨ y ∨ ¬z)
∧ (¬y ∨ z ∨ u) ∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
C4
C2
C3
C5
w
C1
y
x
u
z
Pattern map M:
w:
x: y: z:
u:
C3:
C4:
C5:C2:
C1:
Target map M ′:
w
x
x
x
x
x
x
u u
u
u
uu
u
x
x
x
u
u
u
C1
C2
C3 C4
C5
y
z
y
y
y
yy
y
y
y
z
z zz
z
z
z
z
z
u
u
w
w
w
w
w
15/18
Reduction of Planar-4 3-SAT to Submap Isomorphism
Example for partial submap isomorphism
Instance of Planar-4 3-SAT:(¬x ∨ y ∨ u) ∧ (¬x ∨ y ∨ ¬z)
∧ (¬y ∨ z ∨ u) ∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
C4
C2
C3
C5
w
C1
y
x
u
z
Pattern map M: Target map M ′:
w
x
x
x
x
x
x
u u
u
u
uu
u
x
x
x
u
u
u
C1
C2
C3 C4
C5
y
z
y
y
y
yy
y
y
y
z
z zz
z
z
z
z
z
u
u
w
w
w
w
w
16/18
Reduction of Planar-4 3-SAT to Submap Isomorphism
Example for partial submap isomorphism
Instance of Planar-4 3-SAT:(¬x ∨ y ∨ u) ∧ (¬x ∨ y ∨ ¬z)
∧ (¬y ∨ z ∨ u) ∧ (¬z ∨ u ∨ ¬w)∧ (x ∨ w ∨ ¬u)
C4
C2
C3
C5
w
C1
y
x
u
z
Pattern map M: Target map M ′:
w
x
x
x
x
x
x
u u
u
u
uu
u
x
x
x
u
u
u
C1
C2
C3 C4
C5
y
z
y
y
y
yy
y
y
y
z
z zz
z
z
z
z
z
u
u
w
w
w
w
w
16/18
Conclusion
Plan
1 Motivations
2 Recalls on Generalized Maps
3 Recalls on Computational Complexity
4 Reduction of Planar-4 3-SAT to Submap Isomorphism
5 Conclusion
17/18
Conclusion
Conclusion
Tractability of deciding if M is isomorphic to a submap of M ′ ?
Let k be the number of connected components in M:
We can search for all occurrences of each component of M inpolynomial time
Let m be the maximum number of occurrences of a connectedcomponent of M
Number of candidate solutions to explore bounded by mk
The problem is tractable if k is small enough
Further workComplexity of the maximum common submap problem:
NP-hard in the general case
Open question if the submap must be connected
18/18