New binary linear programming formulation to compute the graph edit distance 2015

文章简介:

  1. 文章标题:
    New binary linear programming formulation to compute the graph edit distance
  2. 论文初稿链接
  3. 文章来源:2017 期刊 Pattern Recognition (文章是2015年的文章)

文章思路

  精确计算GED是NP-Hard问题,需要的时间是指数级。因此,设定计算的GED的下限是十分必要的,可以在下界的基础上更加容易判定图GED。(这里的lower bound:不是过滤的意思,是指最小计算的运算量)文章以二进制数的线性规划问题,模拟了GED的计算过程,把计算成本的{0,1}的离散值分解为(0,1)区间的连续值。文中将编辑距离的六种操作都定义为取值为0或者1的变量:
在这里插入图片描述
并且给出了编辑距离的目标函数:
在这里插入图片描述
以及基于目标函数的约束条件:
在这里插入图片描述
三种约束:

  1. 顶点映射
  2. 边映射
  3. 考虑图的拓扑结构

基于约束条件,可以通过F1和F2求解:
F1:
在这里插入图片描述
F2:在这里插入图片描述

文章缺点:

  凡是计算GED的问题,都是通过计算编辑成本的方法。如,定义 d i s ( G 1 , G 2 ) dis(G_1,G_2) dis(G1,G2)= ∑ i = 0 p c o s t ( o p e r a t i o n ( i ) ) {\sum_{i=0}}^{p}cost(operation(i)) i=0pcost(operation(i)),类似的成本公式,在公式中考虑到了顶点和边之间的六种操作。但是,编辑距离在度量相似度时候,不能考虑到顶点的结构信息,比如一个顶点的出度和入度信息,即拓扑信息。这是不精准的;另外一个方面,应该改变cost(operation)的权重,不应该设定统一的代价,因为每个操作的复杂情况根据其拓扑环境来讲是不同的。

As an AI language model, I cannot provide you with the exact solution you need without further details. However, here is a general approach to find the longest distance in a binary tree using Python: 1. Define a class for a binary tree node with attributes for the node value, left child, and right child. 2. Define a function that recursively traverses the binary tree and returns the height of the tree starting from a given node. 3. Define a function that recursively traverses the binary tree and returns the longest distance between two nodes in the tree. 4. In the function defined in step 3, for each node, calculate the longest distance that passes through that node and update the maximum distance seen so far. 5. Call the function defined in step 3 starting from the root node of the binary tree. Here is a sample implementation of the above approach: ``` class Node: def __init__(self, value): self.value = value self.left = None self.right = None def height(root): if root is None: return 0 return 1 + max(height(root.left), height(root.right)) def longest_distance(root): if root is None: return 0 left_height = height(root.left) right_height = height(root.right) left_distance = longest_distance(root.left) right_distance = longest_distance(root.right) return max(left_height + right_height, max(left_distance, right_distance)) root = Node(1) root.left = Node(2) root.right = Node(3) root.left.left = Node(4) root.left.right = Node(5) root.right.left = Node(6) root.right.right = Node(7) print(longest_distance(root)) ``` This code will output the longest distance between any two nodes in the binary tree.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值