Mojo struct
TreeUnionFind
@memory_only
struct TreeUnionFind
Aliases
width = 2
Fields
- size (
Int) - is_component (
List[Bool])
Implemented traits
AnyType, ImplicitlyDestructible
Methods
__init__
def __init__(out self, size: Int)
Args:
- size (
Int) - self (
Self)
Returns:
Self
__del__
def __del__(deinit self)
Args:
- self (
Self)
union_
def union_(mut self, x: Scalar[DType.int], y: Scalar[DType.int])
Args:
- self (
Self) - x (
Scalar) - y (
Scalar)
find
def find(mut self, x: Scalar[DType.int]) -> Scalar[DType.int]
Args:
- self (
Self) - x (
Scalar)
Returns:
Scalar
components
def components(self) -> List[Int]
Args:
- self (
Self)
Returns:
List