利用权序列快速生成无标号自由树
Fast Generation of Unlabelled Free Trees using Weight Sequences
摘要:
在本文中,我们介绍了一种新的表示有序树,重量序列表示。然后,我们用它来构建新的表示为根树和自由树,即规范的重量序列表示。我们构造算法生成的重量序列表示的所有根和自由树的顺序n,然后添加一些修改,以提高算法的效率。算法的Python实现包含了进一步的改进,通过使用生成器来避免存储递归调用返回的长树列表,以及缓存小阶根树的列表,从而消除了许多递归调用。我们进一步展示了如何修改该算法生成邻接表和邻接矩阵表示的自由树。我们比较了生成自由树的Python实现与来自NetworkX的著名WROM算法的Python实现的运行时。我们的算法的实施是超过四倍的速度的WROM算法的实施。生成邻接列表和矩阵的运行时间比权重序列的运行时间稍长,但仍然比WROM算法的相应实现快三倍以上。
英文摘要:
In this paper, we introduce a new representation for ordered trees, the weight sequence representation. We then use this to construct new representations for both rooted trees and free trees, namely the canonical weight sequence representation. We construct algorithms for generating the weight sequence representations for all rooted and free trees of order n, and then add a number of modifications to improve the efficiency of the algorithms. Python implementations of the algorithms incorporate further improvements by using generators to avoid having to store the long lists of trees returned by the recursive calls, as well as caching the lists for rooted trees of small order, thereby eliminating many of the recursive calls. We further show how the algorithm can be modifed to generate adjacency list and adjacency matrix representations for free trees. We compared the run-times of our Python implementation for generating free trees with the Python implementation of the well-known WROM algorithm taken from NetworkX. The implementation of our algorithm is over four times as fast as the implementation of the WROM algorithm. The run-times for generating adjacency lists and matrices are somewhat longer than those for weight sequences, but are still over three times as fast as the corresponding implementations of the WROM algorithm.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。