The AHU algorithm has been the state of the art since the 1970s for determining in linear time whether two unordered rooted trees are isomorphic or not. However, it has been criticized (by Campbell and Radford) for the way it is written, which requires several (re)readings to be understood, and does not facilitate its analysis. In this paper, we propose an alternative version of the AHU algorithm, which addresses this issue by being designed to be clearer to understand and implement, with the same theoretical complexity and equally fast in practice.. Whereas the key to the linearity of the original algorithm lay on the careful sorting of lists of integers, we replace this step by the multiplication of lists of prime numbers, and prove that this substitution causes no loss in the final complexity of the new algorithm.
翻译:AHU算法自20世纪70年代以来一直是判断两棵无序有根树是否同构的线性时间最优算法。然而,该算法因表述方式受到坎贝尔和拉德福德的批评,其文本需要多次反复阅读才能理解,且不利于算法分析。本文提出AHU算法的改进版本:在保持相同理论复杂度且实际运行速度同样高效的前提下,通过更清晰的设计解决了上述理解与实现难题。原算法线性时间的关键在于对整数列表的精细排序,我们将其替换为素数列表的乘法运算,并证明这种替换不会导致新算法的最终复杂度损失。