Many fields such as computer vision, scene analysis, chemistry and molecular biology have
applications in which images have to be processed and some regions have to be searched for
and identified. When this processing is to be performed by a computer automatically without
the assistance of a human expert, a useful way of representing the knowledge is by using
attributed graphs. Attributed graphs have been proved as an effective way of representing
objects. When using graphs to represent objects or images, vertices usually represent regions
(or features) of the object or images, and edges between them represent the relations
between regions. Nonetheless planar graphs are graphs which can be drawn in the plane
without intersecting any edge between them. Most applications use planar graphs to
represent an image.
Graph matching (with attributes or not) represents an NP-complete problem, nevertheless
when we use planar graphs without attributes we can solve this problem in polynomial time
[1]. No algorithms have been presented that solve the attributed graph-matching problem and
use the planar-graphs properties. In this master thesis, we research about Attributed-Planar-
Graph matching. The aim is to find a fast algorithm through studying in depth the properties
and restrictions imposed by planar graphs.
3. 1. OBJECTIVES
• Why Graph? Images can be represented by graphs
• Why attributed graph? More semantic information
• Why Planar attributed graph? reduce combinations
• Why attributed planar graph matching ?
Currently there is no papers about it.
5. 2. DEFINITIONS
1. Planar Graph
Graph which can be drawn in the plane without intersecting any edge
between them.
Kuratowski’s theorem says:
Graph is planar is not contain subgraph K5 or k3,3
Also, there is an algorithm to determine whether a graph is planar
• Theorem 1: If 1 n>= 3 then a=<3n-6 (where n is the number of vertices
and a the numbers of edges)
• Theorem 2: If n> 3 and there are no cycles of length 3, then a=<2n -4
6. 2. DEFINITIONS
2. Attributed planar graph
3. Atrributed planar graph matching
Object= window
Colour= yellow
Object= window
Colour= white
NP problem using restrictions(attributes and planar
graphs ) can solve in polynomial time
7. 2. DEFINITIONS
4. Tree decomposition
Another way to represent a planar graph
W=2
Tree width the size of the largest set X minus one
8. CONTENTS
1. Objectives
2. Definitions
3. Planar Graph matching without attributes
- Eppstein Algorithm
- 1. Tree decomposition creation
- 2. Generation of vertices combination
- 3. Isomorphism list
- 4. Sample Eppstein algorithm
4. Planar Graph with attributes
5. Practical evaluation
6. Conclusion
9. 3. PLANAR GRAPH MATCHING
WITHOUT ATTRIBUTES
Eppstein proposes an algorithm matching between a planar
graph G and a graph H.
–Find how many isomorphism there are between them.
Algorithm:
1. Tree decomposition creation
2. Generation of vertices combinations (L(N), x and y)
– Apply consistency conditions
– edge function
3. List and count how many isomorphism there are in the
planar graph.
10. 3. PLANAR GRAPH MATCHING
WITHOUT ATTRIBUTES
1. Tree decomposition 2. Generation of combinations
Subgraph L(N’) Subgraph L(N)
Tree decomposition T of Graph G A
{ A, B, H, G }
{ A, D, F, G } { A, B,C,D} L(N) D
B
{A, D, E, F } {A, B, C, G} x
L(N’) G
y
Graph G Graph H Adding vertex x and y
- x= L(N)-L(N’) = G
- y= vertices not treated yet
11. 3. PLANAR GRAPH MATCHING
WITHOUT ATTRIBUTES
2. Generation of combinations L(N):
A B C D x={G} y
L(N) Combinations x and y combinations
General equation:
Adding case:
General equation:
12. 3. PLANAR GRAPH MATCHING
WITHOUT ATTRIBUTES
2. Generation of combinations
Final Combinations
Iniatially, b=0
13. 3. PLANAR GRAPH MATCHING
WITHOUT ATTRIBUTES
2. Generation of combinations
• Consistency
Suppose that node N has children N1 and N2. We say that two partial
isomorphisms: B: H→G’N and B1: H → G’N1 or, B: H→G’N and B2: H →
G’N2 are consistent if the following conditions all hold:
1. For each vertex v є H, if B(v) є L(N1) or B1(v) є L (N), then B(v)= B1(v)
2. For each vertex v є H, if B(v) ≠ X , then B1(v) є L(N)U {Y}
3. At least one vertex v є H has B1(v) є L(N) {Y1} or B2(v) є L(N) U {Y2} if
we have B1 and B2, otherwise it does not apply the condition.
4. For each partial isomorphism it must hold that if B(v)= X and B1(v) =y1 a
partial possible isomorphism is discarded.
5. For each v with B(v)=x, exactly one of B1(v) and one of B2(v) is equal to
y.
14. 3. PLANAR GRAPH MATCHING
WITHOUT ATTRIBUTES
2. Generation of combinations
• Edge function
3. Isomorphism list
17. 4. PLANAR GRAPH MATCHING WITH
ATTRIBUTES
• There is no optimal solutions, at the moment
• We propose new solution based on Eppstein’s Algorithm
Object= window
Colour= yellow
Object= window
Colour= white
• Applications to Computer Vision
• Attributes produce consistency reduction
18. 4. PLANAR GRAPH MATCHING WITH
ATTRIBUTES
New Algorithm (Arlandez’s algorithm)
1. Tree decomposition creation
2. Generation of vertices combinations
• Apply consistency conditions
• edge attribute function (exact or approximation method)
3. List and count how many isomorphism there are in the
planar graph.
4. Compute the euclidian distance of the isomorphism list
• Sorting the distances from lesser to greater value
19. 4. PLANAR GRAPH MATCHING WITH
ATTRIBUTES
New Algorithm (Arlandez’s algorithm)
• Attribute edge function
• Tolerance variable that accepts values.
• Two ways:
• Exact method threshold=0
• Approximation method threshold >0
20. 4. PLANAR GRAPH MATCHING WITH
ATTRIBUTES
New Algorithm (Arlandez’s algorithm) Graph H
• Euclidian distance 1
Planar graph 2 2
1
3
# A D F G E x y C B H Euclidian distance
1 [] a [] d b [] [] c [] [] 0
2 [] a c d [] [] [] [] b [] 0
3 [] d [] a b [] [] c [] [] 0
4 [] d c a [] [] [] [] b [] 0
5 [] a [] d [] [] [] c b [] 10
6 [] a c d b [] [] [] [] [] 10
7 [] d [] a [] [] [] c b [] 10
8 [] d c a b [] [] [] [] [] 10
25. 5. PRACTICAL EVALUATION
Planars Graphs G and Tree Decompositions Planar Graph G1
{ A, F, G, H }
{ A, F, H, M }
{ A, E, F, M } { F, H, K, M }
W=3
{ A, D, E, M } { H, K, L, M }
{ A, C, D, E }
{ A, B, C, E }
{ A, B, H, G } Planar Graph G2
{ A, B, D, G } { A, D, F, G }
W=4
{A, B, C, D } {A, D, E, F }
26. 5. PRACTICAL EVALUATION
More Tree Decompositions
Planar Graph G1
{ A, F, G, H }
{ A, F, H, M } { A, F, G, H, M }
{ A, E, F, M } W=3 { F, H, K, M } { A, D, E, F, M } { F, H, K, L, M }
W=4
{ A, D, E, M } { H, K, L, M } {A, B, C, D, E }
{ A, C, D, E }
{ A, B, C, E }
27. 5. PRACTICAL EVALUATION
More Tree Decompositions
Planar Graph G2
{ A, D, F, G, E }
{ A, B, H, G }
W=4
W=3 { A, B, G, H, D}
{ A, B, D, G } { A, D, F, G }
{A, B, C, D } {A, D, E, F }
{ A, B, D, G, C}
28. 5. PRACTICAL EVALUATION
1.Analysis: Eppstein’s Algorithm vs Arlandez’s Algorithm
possible partial combinations partial
Test 1 isomorphism after applying isomorphism with
combinations consistency edge relation hold
Without With Without With Without With
attributes attributes attributes attributes attributes attributes
Step 1 join {ACDE} and {ABCE}
Graph G1 3526 810 95 34 64 24
Step 2 join {ADEM} and {ACDE+B}
W=3 5248 1248 159 55 73 42
Step 3 join {AEFM} and {ADEM+BC}
6862 2268 215 55 97 25
Step 4 join {FHKM} and {HKLM}
6160 986 125 36 85 22
Step 5 join {AFHM} between
{AEFM+BCD} and {FHKM+L} 16562 2773 775 192 108 20
Step 6 join {AFGH} and
Graph H {AFHM+BCDLEK} 12096 2688 312 221 139 16
Partial Isomorphism
{AFGHBCDLEKM} 60 6
30. 5. PRACTICAL EVALUATION
1.Analysis: Eppstein’s Algorithm vs Arlandez’s Algorithm
Test 2
possible partial
vertices=4 combinations after partial isomorphism with
isomorphism
Attributes= combinations applying consistency edge relation hold
Graph G2 (a=5, b=5, c=2, d=1)
Without With Without With Without With
attributes attributes attributes attributes attributes attributes
W=4 STEP 1 {A,B,G,H,D} join
168961 12502 663 149 437 115
with {A,B,D,G,C}
STEP2 {A,D,F,G,E} join
293227 17365 3335 486 586 188
with { A,B,D,G,H+C,B}
TOTAL 462188 29867 3998 635 1023 303
Partial Isomorphisms 169 72
Graph H
31. 5. PRACTICAL EVALUATION
1.Analysis: Eppstein’s Algorithm vs Arlandez’s Algorithm
Test 2:
Possible partial isomorphism Combinations after applying
combinations 293227 consistency
300000 3335
3500
250000 3000
200000 168961 2500
150000 2000
1500
100000
1000 663
50000 16524 706
32825 500 135
0 0
STEP 1
STEP2 STEP 1
STEP2
planar graph 2 with attributes… planar graph 2 with attributes (a=5, b=5,c=2, d=1)
planar graph 2 without attributes planar graph 2 without attributes
32. 5. PRACTICAL EVALUATION
1.Analysis: Eppstein’s Algorithm vs Arlandez’s Algorithm
Test 2:
Total combinations of planar graph 2 Total combinations of planar graph 2
matching with a square (vertex=4) matching a triangle (vertex=4)
29867
462188
500000
450000 30000
400000 25000
350000
300000 20000
250000 15000
200000
150000 10000 3273
49349 3998 841
100000 5000 635 184
50000 0
0
possible partial combinations after
possible partial combinations after
isomorphism applying consistency
isomorphism applying consistency
combinations
combinations
Planar graph without attributes (w=4)
planar graph 2 without attributes w=4
Planar graph 2 with attributes (a=1, b=2, c=3 )
planar graph 2 with attributes (a=5, b=5, c=2, d=1)
33. 5. PRACTICAL EVALUATION
2. Tree decomposition analysis
possible partial
combinations after partial isomorphism with
W=3 isomorphism
applying consistency edge relation hold
combinations
STEP 1 {A,B,D,G} join
6862 107 94
Graph G2 Graph H with {A,B,C,D}
STEP2 {A,D,F,G} join with
3268 74 64
{ A,D,E,F}
{ A, F, G, H, M }
STEP 3 join {A,B,H,G}
between {A,B,D,G+C} and 17222 892 102
{ A, D, E, F, M } { F, H, K, L, M } {A,D,F,G+E}
TOTAL 27352 1073 260
{A, B, C, D, E } Partial isomorphism 72
possible partial
combinations after partial isomorphism with
W=4 isomorphism
applying consistency edge relation hold
combinations
STEP 1 {A,B,G,H,D} join
{ A, D, F, G, E } 12502 149 115
with {A,B,D,G,C}
STEP2 {A,D,F,G,E} join
17365 486 188
with { A,B,D,G,H+C,B}
{ A, B, G, H, D} TOTAL 29867 635 295
Partial isomorphism 72
{ A, B, D, G, C}
34. 5. PRACTICAL EVALUATION
2. Tree decomposition analysis
Total combinations before and after using consistency
27352 29867
30000
25000 W=3 W=4
20000
15000
10000
1073 635
5000
0
possible partial isomorphism combinations after applying
combinations consistency
35. 5. PRACTICAL EVALUATION
3.Attributed approximation analysis
Graph H
Possible combinations, threshold =4 3
Possible combinations, threshold =2
60000 60000
50000 7 9
40000 40000
30000
20000
20000 Graph G1
0 10000
0
planar graph 1 with attributes
planar graph 1 without attributes planar graph 1 with attributes
planar graph 1 without attributes
36. 5. PRACTICAL EVALUATION
3.Attributed approximation analysis
Graph H
Possible Possible combinations, threshold 3
60000 combinations, threshold =7 60000 2,4,7
50000 50000 7 9
40000 40000
30000
Graph G1
30000
20000
20000
10000
10000
0
STEP 1 STEP 2 0
STEP 3 STEP 4
STEP 5
STEP 6
TOTAL STEP 1 STEP 2
STEP 3 STEP 4
STEP 5 STEP 6
TOTAL
planar graph 1 with attributes planar graph 1 with attributes (threshold=2)
planar graph 1 wit attributes (threshold=4)
planar graph 1 without attributes
planar graph 1 with attributes (threshold=7)
planar graph 1 without attributes
38. 6. CONCLUSION
• Algorithm based on Eppstein’s algorithm.
• Nowadays, writing to publish in a congress
• Attributes reduce the number of combinations.
• Edges function most important function.
• Working with :
– high threshold worse
– Low threshold better
• Optimal algorithms supposes great time expenditure
• Euclidian distance make easier the best solution
• Future work:
– Make our spanning tree given a planar graph
– Work with no constant size tree decomposition