diff --git a/python/datastruct.py b/python/datastruct.py index 22e0647..48df054 100644 --- a/python/datastruct.py +++ b/python/datastruct.py @@ -29,9 +29,14 @@ class UnionFindQueue(Generic[_NameT, _ElemT]): tracking added to it. """ + __slots__ = ("name", "tree", "sub_queues", "split_nodes") + class Node(Generic[_NameT2, _ElemT2]): """Node in a UnionFindQueue.""" + __slots__ = ("owner", "data", "prio", "min_node", "height", + "parent", "left", "right") + def __init__(self, owner: "UnionFindQueue[_NameT2, _ElemT2]", data: _ElemT2, @@ -688,6 +693,8 @@ class UnionFindQueue(Generic[_NameT, _ElemT]): class PriorityQueue(Generic[_ElemT]): """Priority queue based on a binary heap.""" + __slots__ = ("heap", ) + class Node(Generic[_ElemT2]): """Node in the priority queue."""