Adds Graph.
[pyutils.git] / src / pyutils / collectionz / interval_tree.py
index 7ba190a5984814eb35ff7058181cdc3a79342dd6..878f6289f709c4838a268f24be4a320fb1e0d2bf 100644 (file)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python3
 
+# © Copyright 2021-2022, Scott Gasch
+
 """This is an augmented interval tree for storing ranges and identifying overlaps as
 described by: https://en.wikipedia.org/wiki/Interval_tree.
 """
@@ -7,13 +9,12 @@ described by: https://en.wikipedia.org/wiki/Interval_tree.
 from __future__ import annotations
 
 from functools import total_ordering
-from typing import Any, Generator, Optional, Union
+from typing import Any, Generator, Optional
 
 from overrides import overrides
 
 from pyutils.collectionz import bst
-
-Numeric = Union[int, float]
+from pyutils.types.simple import Numeric
 
 
 @total_ordering
@@ -47,7 +48,10 @@ class NumericRange(object):
         Returns:
             True is this range is less than (lower low) other, else False.
         """
-        return self.low < other.low
+        if self.low != other.low:
+            return self.low < other.low
+        else:
+            return self.high < other.high
 
     @overrides
     def __eq__(self, other: object) -> bool: