higra / Higra

Hierarchical Graph Analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

lnajman opened this issue · comments

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)

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

This is due to a bad handling of region adjacency graphs in filter_non_relevant_node_from_tree.
Probably the faulty line is :

saliency = hg.saliency(tree, altitudes, leaf_graph)
which should be

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