-
I would like to filter out small nodes from my tree, I am following the sample notebooks in the higra_notebooks. filtered_tree,filtered_altitudes = hg.filter_small_nodes_from_tree(tree, altitudes) The number of nodes of the tree remains the same, but when I depict it using the khalimsy grid I notice that the smaller nodes have been filtered. This probably means that there is a change in altitudes which I'm not sure what it exactly is. What changes do I have to make to get a new tree with the filtered number of nodes? Sorry for this, I am really new to C.V. and using higra ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, don't worry, this place is there to ask such questions :) Edit: in the new default behaviour the results of these functions are canonized and they will have less nodes than the input tree. The old behaviour is obtained by setting the param Old answer: Indeed, the
Those functions keep those extra-nodes because they convey some information about the adjacency relations between nodes but if you want to remove them, you can do the following: filtered_tree, filtered_altitudes = hg.filter_small_nodes_from_tree(tree, altitudes, size)
filtered_tree, node_map = hg.simplify_tree(filtered_tree, filtered_altitudes == filtered_altitudes[filtered_tree.parents()])
filtered_altitudes = filtered_altitudes[node_map] |
Beta Was this translation helpful? Give feedback.
Hello, don't worry, this place is there to ask such questions :)
Edit: in the new default behaviour the results of these functions are canonized and they will have less nodes than the input tree. The old behaviour is obtained by setting the param
canonize_tree
equals toFalse
Old answer:
Indeed, the
filter_xxx_nodes_from_tree
functions yield binary partition trees which implies that there is always2n - 1
nodes in these trees. But it is possible that: