chaimleib / intervaltree

A mutable, self-balancing interval tree. Queries may be by point, by range overlap, or by range containment.
Apache License 2.0
636 stars 108 forks source link

Add remove_data method #119

Open adamcircle opened 2 years ago

adamcircle commented 2 years ago

Hello @chaimleib,

Firstly, much thanks to you and co-contributors for building this excellent library.

I have a use case in which I want to delete intervals which are tagged with a certain data. The changes I propose add a remove_data(...) method which removes all intervals containing the data. If the optional set of points points argument is filled, only intervals which overlap any of these points and also contain the given data will be removed. Providing points lends a considerable speedup, as the only other way to remove points with certain data, as far as I can see, is to rebuild the entire tree.

Please let me know your thoughts.