如何计算树编辑距离是多少? [英] How do I calculate tree edit distance?
问题描述
我要计算我的一个个人项目树之间的编辑距离。 这本文介绍了一种算法,但我不能做正面或反面出来。你知道的描述更平易近人的方式适用的算法任何资源?伪code或code将是有益的,太。
I need to calculate the edit distance between trees for a personal project of mine. This paper describes an algorithm, but I can't make heads or tails out of it. Are you aware of any resources that describe an applicable algorithm in a more approachable way? Pseudocode or code would be helpful, too.
推荐答案
下面是一些 Java源代码$ C $Ç(底部gzip压缩的压缩包)的树编辑距离算法,可能对你有用。
Here's some java source code (gzipped tarball at the bottom) for a Tree Edit Distance algorithm that might be useful to you.
该页面包含经过张沙沙算法一步一步和其他有用的链接引用和一些幻灯片,让你加快速度。
The page includes references and some slides that go through the "Zhang and Shasha" algorithm step-by-step and other useful links to get you up to speed.
编辑:虽然这个答案被接受,因为它指的张杀杀算法,code中的链接有错误。史蒂夫·约翰逊和tim.tadh提供工作的Python code 。请参阅<一href="http://stackoverflow.com/questions/1065247/how-do-i-calculate-tree-edit-distance/4264181#4264181">Steve约翰逊的评论更多的细节。
While this answer was accepted because it pointed to the Zhang-Shasha algorithm, the code in the link has bugs. Steve Johnson and tim.tadh have provided working Python code. See Steve Johnson's comment for more details.
这篇关于如何计算树编辑距离是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!