Upcoming SlideShare
×

# Graph Matching

1,237 views

Published on

An implementation based on Khun-Munkres Algorithm

Published in: Education, Technology
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,237
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
30
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Graph Matching

1. 1. Graph Matching An implementation based on Khun-Munkres Algorithm
2. 2. Problem description <ul><li>Consider two Reebgraphs describing topological features of two objects. </li></ul><ul><li>The goal is to check for similarities between these two graphs and to return a possible assignment of correspondence between nodes in different graphs (graph matching). </li></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
3. 3. Problem description <ul><li>The problem is similar to that of finding isomorphisms and subisomorphisms between the graphs. </li></ul><ul><li>However, to reduce the complexity of the algorithm we can reduce the original problem to a bipartite matching problem. </li></ul><ul><li>This allows us to reuse existing algorithms for solving bipartite matching problem. </li></ul><ul><ul><li>One of these algorithms is the Khun-Munkres “Hungarian” Algorithm. </li></ul></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
4. 4. Minimum-cost bipartite matching <ul><li>The typical example for understanding this problem considers a bipartite set with two classes (sets) of nodes </li></ul><ul><ul><li>Employees I </li></ul></ul><ul><ul><li>Tasks T </li></ul></ul><ul><li>Each employee can perform a task with a different cost, according to his capabilities. </li></ul><ul><li>The goal is to find an assignment (f: I  T) for which the overall cost is minimized. </li></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
5. 5. Minimum-cost bipartite matching Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07 E1 E2 E3 T1 T2 T3 10 15 10 2 1 12 11 5 13 I T
6. 6. Minimum-cost bipartite matching Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07 E1 E2 E3 T1 T2 T3 10 15 10 2 1 12 11 5 13 I T
7. 7. Minimum-cost bipartite matching <ul><li>The overall cost of an assignment f is the sum of the cost of (i, f(i)) for each element i in set I. </li></ul><ul><li>For instance, in the previous example the overall assignment cost is 2+1+5 = 8. </li></ul><ul><li>Since there exists no assignment with cost less than 8 for the given bipartite set. </li></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
8. 8. Formalization of the original problem <ul><li>Input: </li></ul><ul><ul><li>Txt file with the topological Reeb graph 1 enriched with geometrical information . </li></ul></ul><ul><ul><li>Txt file with the topological Reeb graph 2 enriched with geometrical information . </li></ul></ul><ul><ul><li>(Optional) Txt file with the geometrical similarity matrix between nodes in the two different graphs . </li></ul></ul><ul><li>Output: </li></ul><ul><ul><li>Matching rate as a number . </li></ul></ul><ul><ul><li>Node-to-node correspondence . </li></ul></ul><ul><ul><li>Graphical visualization of results. </li></ul></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
9. 9. System operation: Steps <ul><li>Step 1: Information loading </li></ul><ul><ul><li>Txt files are read and parsed to initialize the necessary data structures . These comprise: </li></ul></ul><ul><ul><ul><li>Reeb graph 1 </li></ul></ul></ul><ul><ul><ul><li>Reeb graph 2 </li></ul></ul></ul><ul><ul><ul><li>(Optional) Geometrical similarity matrix </li></ul></ul></ul><ul><li>Step 2: Construction of adjacency matrices </li></ul><ul><ul><li>Adjacency matrix E is computed for each of the input graphs. </li></ul></ul><ul><li>Step 3: Normalization of adjacency matrices </li></ul><ul><ul><li>Each row in E is normalized so as to sum 1, obtaining normalized adjacency matrix L. </li></ul></ul><ul><ul><li>This is performed twice, once for each input graph’s adjacency matrix. </li></ul></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
10. 10. System operation: Steps <ul><li>Step 4: Eigenvectors computation </li></ul><ul><ul><li>For each matrix L, it’s principal eigenvector p is determined. </li></ul></ul><ul><li>Step 5: Eigenvectors normalization </li></ul><ul><ul><li>Eigenvectors p are normalized so as their components sum 1, obtaining normalized eigenvectors np. </li></ul></ul><ul><li>Step 6: Correlation matrix computation </li></ul><ul><ul><li>The correlation matrix of the two vectors np M is computed. </li></ul></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
11. 11. System operation: Steps <ul><li>Step 7: Conversion into minimization problem </li></ul><ul><ul><li>Each element in M is substracted to the maximum so as to obtain a suitable cost matrix for a minimum bipartite matching problem. </li></ul></ul><ul><ul><li>New rows or columns are also added if necessary, to make the matrix become square. </li></ul></ul><ul><li>Step 8: Bipartite matching </li></ul><ul><ul><li>Apply Hungarian Algorithm using the entries in the obtained matrix as assignment costs. </li></ul></ul><ul><li>Step 9: Compute matching rate </li></ul><ul><ul><li>The matching rate is computed in a similar fashion than the assignment cost. </li></ul></ul><ul><ul><li>However, it is computed using the original correlation matrix M instead of the converted one. </li></ul></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
12. 12. System operation: Steps <ul><li>Step 10: Output results </li></ul><ul><ul><li>Show message dialog with the matching rate. </li></ul></ul><ul><ul><li>Display graphs using different colors for the nodes, indicating the correspondence between nodes in different graphs. </li></ul></ul><ul><ul><li>Give the user the possibility to write the results to a file. </li></ul></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
13. 13. Results: Application snapshot Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07
14. 14. Conclusions <ul><li>Hungarian algorithm can be considered an instance of a backtracking algorithm. </li></ul><ul><li>A lot of attention must be paid to its implementation, specially in handling particular or exceptional cases. </li></ul><ul><li>Graph matching is approximate, but fast, and can still give good results in many cases. </li></ul>Page of 13 Bruno Nardelli Computer Graphics Lab. 26-07-07