简体   繁体   中英

Matching Hierarchical inexact graphs

Please refer to the image below

层次图

I wish to compare 2 graphs for determining what changes have occured in a certain graph. For example if I consider graph on left side to be Model graph and one or right to be modified graph, I need to be able to identify the following

  1. left most orange node is deleted
  2. Green node has been added as child to right most orange node
  3. 3rd Green node from left has a new blue child node

and so on. I can compare nodes of similar color only. ie All Orange nodes can be compared among 2 graphs, all Green nodes can be compared among 2 graphs etc. Each node will have some attribute that can be used to identify a corresponding unique node in another graph.

Please let me know which graph matching algorithm is suitable for this purpose. Or is it required at all to use a graph matching algorithm since nodes of same color can be matched using color and unique attribute of the node.

Maybe try the simplest solution first. Breadth-first search the graph (+ a set of visited nodes to break up cycles). Put nodes of equal color into arrays in the order you encounter them. Then compare the arrays either as linear sequence or use longest common sequence. Note that a node might have a different parent but the same position in the array, so compare the node parent too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM