P199: Enumeration of all $k$-cardinarity subtrees of a tree with $w$ vertices

P199: Enumeration of all $k$-cardinarity subtrees of a tree with $w$ vertices
Input:
An integer $k$ and a tree $T$ with $w$ element, where $k \le w$.
Output:
All subtrees with $k$ vertices of $T$.
Complexity:
$O(Nw^5)$ total time.
Comment:
$N$ is the number of ideals.
Reference:
[Wild2013] (Bibtex)