Merging similar graphs based solely on the graph structure?

Posted by Buttons840 on Programmers See other posts from Programmers or by Buttons840
Published on 2012-04-12T04:11:02Z Indexed on 2012/04/12 5:40 UTC
Read the original article Hit count: 187

Filed under:

I am looking for (or attempting to design) a technique for matching nodes from very similar graphs based on the structure of the graph*. In the examples below, the top graph has 5 nodes, and the bottom graph has 6 nodes. I would like to match the nodes from the top graph to the nodes in the bottom graph, such that the "0" nodes match, and the "1" nodes match, etc. This seems logically possible, because I can do it in my head for these simple examples. Now I just need to express my intuition in code. Are there any established algorithms or patterns I might consider?

(* When I say based on the structure of the graph, I mean the solution shouldn't depend on the node labels; the numeric labels on the nodes are only for demonstration.)

I'm also interested in the performance of any potential solutions. How well will they scale? Could I merge graphs with millions of nodes?

In more complex cases, I recognize that the best solution may be subject to interpretation. Still, I'm hoping for a "good" way to merge complex graphs.

(These are directed graphs; the thicker portion of an edge represents the head.)

Example 1 Example 2 Example 3 Example 4

© Programmers or respective owner

Related posts about graph