higra / Higra

Hierarchical Graph Analysis
Other
98 stars 20 forks source link

Bug report: filter_small_nodes_from_tree requires a bpt based on mst to work #213

Closed lnajman closed 3 years ago

lnajman commented 3 years ago

The code filtered_tree, filtered_altitudes = hg.filter_small_nodes_from_tree(tree_ws_area, altitudes_ws_area, 100) returns the error The dimension of the provided edge data array 'edge_weights' does not match the number of edges in the provided graph 'graph'. when tree_ws_area is not a tree based on a mst (ie, when it is not computed by bpt_canonical)

lnajman commented 3 years ago

The same is true for filter_non_relevant_node_from_tree and I guess all the similar filterings

PerretB commented 3 years ago

This is due to a bad handling of region adjacency graphs in filter_non_relevant_node_from_tree. Probably the faulty line is : https://github.com/higra/Higra/blob/8c0b45fcaf75fee119a3ea62906908d57b4b5200/higra/algo/tree.py#L186 which should be

saliency = hg.saliency(tree, altitudes, leaf_graph, handle_rag=False)