hyanwong / giglib

MIT License
4 stars 2 forks source link

Storing (L, R) plus value for inverted #65

Open hyanwong opened 8 months ago

hyanwong commented 8 months ago

@duncanMR points out that it is sometimes much easier to think of the parent_left and parent_right such that left < right even for an inversion, but where we maintain another flag for is_inverted. I think this might simplify the mrca-finding routine in some places.

We can easily hack this in by providing one or more methods on an edge that return the [parent_low, parent_high) interval for an edge, regardless of which way round it is (and we already have the is_inversion method. It seems a no-brainer to have such a method.

Something like iedge.range?

hyanwong commented 7 months ago

@duncanMR - do you have a suggestion for a name for a function or property that returns the (low, high) interval. We already have parent_max, parent_min, child_max, child_min.

duncanMR commented 7 months ago

Perhaps we should call intervals of the form [a,b), where a < b or a > b, directed intervals, and intervals where strictly a < b undirected intervals? Maybe interval.undirected could work as a property in that case. I think the idea of treating inversions as a simple + or - direction of an iedge might be helpful. My first thought was to call it normalising, but I think that's confusing because of its common meaning of reducing a vector to have unit length.