The Ukkonen.Node class

The type of the nodes in the tree.

Contents

Node

The type of the nodes in the tree.

Ukkonen.Node.child(…)

The index of the child node corresponding to a letter (if any).

Ukkonen.Node.children

The children of the current node.

Ukkonen.Node.copy(…)

Copy a Ukkonen.Node object.

Ukkonen.Node.is_leaf(…)

Returns True` if the node is a leaf and False if not.

Ukkonen.Node.is_root(…)

Returns True if the node is the root and False if not.

Ukkonen.Node.l

The index of the first letter in the edge leading to the node.

Ukkonen.Node.length(…)

The length of the edge leading into the current node.

Ukkonen.Node.parent

The index of the parent node.

Ukkonen.Node.r

The index of one past the last letter in the edge leading to the node.

Full API

class Ukkonen.Node
__init__(self: Ukkonen, l: int = 0, r: int = 0, parent: int | Undefined = UNDEFINED) None

Construct a node from left most index, right most index, and parent.

Parameters:
  • l (int) – the left most index and value of the data member l (defaults to 0).

  • r (int) – one after the right most index and value of the data member r (defaults to 0).

  • parent (int | Undefined) – parent of the node being constructed (defaults to UNDEFINED).

child(self: Ukkonen.Node, c: int) int

The index of the child node corresponding to a letter (if any).

Parameters:

c (int) – the first letter in the edge of the node.

Returns:

The index of the child node.

Return type:

int

Complexity:

Logarithmic in the size of len(children).

property children

The children of the current node.

copy(self: Ukkonen.Node) Ukkonen.Node

Copy a Ukkonen.Node object.

Returns:

A copy.

Return type:

Ukkonen.Node

is_leaf(self: Ukkonen.Node) bool

Returns True` if the node is a leaf and False if not.

Returns:

Whether the node is a leaf.

Return type:

bool

Complexity:

Constant.

is_root(self: Ukkonen.Node) bool

Returns True if the node is the root and False if not.

Returns:

Whether the node is the root.

Return type:

bool

Complexity:

Constant.

property l

The index of the first letter in the edge leading to the node.

length(self: Ukkonen.Node) int

The length of the edge leading into the current node.

Returns:

The length of the edge.

Return type:

int

Complexity:

Constant.

property parent

The index of the parent node.

property r

The index of one past the last letter in the edge leading to the node.