3 ms·
My work involves a lot of time series analysis, as such I'm often dealing with intervals. While the overlap algorithm (or rather "condition") is cute, there a
by Galanwe 1y ago
My work involves a lot of time series analysis, as such I'm often dealing with intervals.
While the overlap algorithm (or rather "condition") is cute, there a lot more "cool" stuff to do with intervals, which I would have liked to see in there.
- Checking whether multiple intervals overlap
- Checking whether multiple intervals are contiguous
- Merging contiguous intervals
- Etc..
From experience, something is also crucial when working with intervals: trivially knowing which boundaries are closed and which are opened. I found that defining a strict vocabulary helps a lot here. e.g. "last" is "inclusive", while "end" is exclusive.
[closed; opened[ intervals are also the best when dealing with time intervals (if that makes sense in your use case), because you can trivially join them.
- ambicapter 1y agoYou should write that blog post.
- Terr_ 1y agoHmm. I imagine that determining which intervals can be picked to make a continuous span is really a graph-traversal algorithm. However you aren't just given all the existing edges (pair overlaps) in advance, maybe there's a way to have the graph-exploration side guide the edge-detection to minimize work.