BIROn - Birkbeck Institutional Research Online

    Fast generation of Unlabelled Free Trees using Weight Sequences

    Brown, Paul and Fenner, Trevor (2021) Fast generation of Unlabelled Free Trees using Weight Sequences. Journal of Graph Algorithms and Applications 25 (1), pp. 219-240. ISSN 1526-1719.

    [img] Text
    zTreeAlgorithm_JGAAfinal.pdf - Author's Accepted Manuscript
    Restricted to Repository staff only

    Download (378kB)
    [img]
    Preview
    Text
    47939a.pdf - Published Version of Record
    Available under License Creative Commons Attribution.

    Download (589kB) | Preview

    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 effciency 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 modified to generate adjacency list and adjacency matrix representations for free trees. We compared the runtimes 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 runtimes 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.

    Metadata

    Item Type: Article
    School: Birkbeck Faculties and Schools > Faculty of Science > School of Computing and Mathematical Sciences
    Depositing User: Trevor Fenner
    Date Deposited: 14 Jun 2022 11:31
    Last Modified: 09 Aug 2023 12:53
    URI: https://eprints.bbk.ac.uk/id/eprint/47939

    Statistics

    Activity Overview
    6 month trend
    0Downloads
    6 month trend
    0Hits

    Additional statistics are available via IRStats2.

    Archive Staff Only (login required)

    Edit/View Item
    Edit/View Item