hyperiax.Topology

class hyperiax.Topology(parents, size, depth, level_starts, node_depths, child_counts, is_root, is_leaf, is_inner, max_degree, equal_degree, pbuckets, pbuckets_ref, names)[source]

Bases: object

Immutable tree topology with precomputed dispatch layouts.

Parameters:
__init__(parents, size, depth, level_starts, node_depths, child_counts, is_root, is_leaf, is_inner, max_degree, equal_degree, pbuckets, pbuckets_ref, names)
Parameters:
Return type:

None

Methods

__init__(parents, size, depth, level_starts, ...)

from_parents(parents, *[, names])

Build a Topology from a BFS-ordered parents array.

Attributes

parents: ndarray
size: int
depth: int
level_starts: ndarray
node_depths: ndarray
child_counts: ndarray
is_root: ndarray
is_leaf: ndarray
is_inner: ndarray
max_degree: int
equal_degree: bool
pbuckets: ndarray
pbuckets_ref: tuple
names: tuple | None
classmethod from_parents(parents, *, names=None)[source]

Build a Topology from a BFS-ordered parents array.

Return type:

Topology

Parameters:

names (Sequence[str] | None)

Parameters

parents :

1-D array of int32; parents[i] is the index of node i’s parent. parents[0] must be 0 (root self-parent). Must be BFS-ordered: parents[i] < i for i > 0.

names :

Optional per-node names (informational only; used by Newick I/O).