higra / Higra

Hierarchical Graph Analysis
Other
98 stars 20 forks source link

Tree parents() TypeError #142

Closed fguiotte closed 4 years ago

fguiotte commented 4 years ago

Hi!

When I try to get the parents list with Tree.parents() I get a TypeError:

t = hg.Tree((7, 7, 8, 8, 8, 9, 9, 11, 10, 10, 11, 11))
t.parents((0, 11, 8))
TypeError: parents(): incompatible function arguments. The following argument types are supported:
    1. (self: higra.higram.Tree) -> xt::xtensor
PerretB commented 4 years ago

Hi,

there are indeed 2 different functions in the class Tree to access to parents:

You can thus use:

t.parent((0, 11, 8))

I agree that this is not very intuitive and following Python usage, they should probably be the same function. Feel free to open a PR if you want to do this modification (I can guide you in the process if needed).

fguiotte commented 4 years ago

Ok problem solved!

I think it's fine to have two separate functions, as long as the documentation is clear :slightly_smiling_face: