Enumeration of Subtrees and BC-subtrees with Maximum Degree No More Than K in Trees
Yu Yang,Xiao-xiao Li,Meng-yuan Jin,Long Li,Hua Wang,Xiao-Dong Zhang
DOI: https://doi.org/10.1016/j.tcs.2021.09.024
IF: 1.002
2021-01-01
Theoretical Computer Science
Abstract:The subtrees and BC-subtrees (subtrees where any two leaves are at even distance apart) have been intensively studied in recent years. Such structures, under special constraints on degrees, have a wide range of applications in many fields. By way of an approach based on generating functions, we present novel recursive algorithms for enumerating various subtrees and BC-subtrees of maximum degree ≤k in trees. The algorithms are explained through detailed examples. We also briefly discuss, in trees, the densities of subtrees (resp. BC-subtrees) with maximum degree ≤k among all subtrees (resp. BC-subtrees). For a tree of order n, the novelly proposed algorithms have multiple advantages. (1) Novel (k+2) (resp. (2k+3)) variable generating functions were introduced to construct the algorithms. (2) The proposed algorithms solved the fast enumerating problem of subtree (resp. BC-subtrees) with maximum degree constraint, and also make the subtree (resp. BC-subtrees) enumerating algorithms proposed by Yan and Yeh [1] (resp. Yang et al. [2]) a special case of ours with k=n−1. (3) The time complexity of our algorithm for subtree (resp. BC-subtrees) is O(kn) (resp. O(kn2)), which is much faster than the O(n2) (resp. O(kn3)) time method based on algorithm proposed in [1] (resp. [2]).