Fast generation of unlabelled free trees using weight sequences
From MaRDI portal
Publication:5856669
DOI10.7155/JGAA.00556zbMATH Open1457.05106arXiv2010.07211OpenAlexW3093174092MaRDI QIDQ5856669FDOQ5856669
Authors:
Publication date: 29 March 2021
Published in: Journal of Graph Algorithms and Applications (Search for Journal in Brave)
Abstract: 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.
Full work available at URL: https://arxiv.org/abs/2010.07211
Recommendations
Cites Work
Cited In (1)
Uses Software
This page was built for publication: Fast generation of unlabelled free trees using weight sequences
Report a bug (only for logged in users!)Click here to report a bug for this page (MaRDI item Q5856669)