Table of Contents

Mojo struct

TreeUnionFind

@memory_only
struct TreeUnionFind

Aliases

  • width = 2
  • __del__is_trivial = False

Fields

  • size (Int)
  • is_component (List[Bool])

Implemented traits

AnyType, ImplicitlyDestructible

Methods

__init__

fn __init__(out self, size: Int)

Args:

  • size (Int)
  • self (Self)

Returns:

Self

__del__

fn __del__(deinit self)

Args:

  • self (Self)

union_

fn union_(mut self, x: Int, y: Int)

Args:

  • self (Self)
  • x (Int)
  • y (Int)

find

fn find(mut self, x: Scalar[DType.index]) -> Scalar[DType.index]

Args:

  • self (Self)
  • x (Scalar)

Returns:

Scalar

components

fn components(self) -> List[Int]

Args:

  • self (Self)

Returns:

List