简体   繁体   English

匹配分层不精确图

[英]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. 例如,可以在2个图之间比较所有Orange节点,可以在2个图之间比较所有Green节点,依此类推。每个节点都有一些属性,可用于标识另一个图中的相应唯一节点。

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. 请注意,一个节点可能具有不同的父节点,但在数组中的位置相同,因此也要比较该节点的父节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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