Modifiers

inline void libsemigroups::Forest::add_nodes(size_t n)

Add nodes to the Forest.

Complexity

At most linear in number_of_nodes() + n.

Iterator validity

This function modifies the object defined by this, any iterators, pointers or references pointing into this may be invalidated by a call to this function.

Parameters

n – the number of nodes to add.

Throws

(None) – This function guarantees not to throw a LibsemigroupsException. If an exception is thrown, this is guaranteed not to be modified (strong exception guarantee).

Returns

(None)

inline void libsemigroups::Forest::clear() noexcept

Removes all nodes from the forest.

Complexity

Linear in number_of_nodes().

Iterator validity

This function modifies the object defined by this, any iterators, pointers or references pointing into this may be invalidated by a call to this function.

Parameters

(None)

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Returns

(None)

inline void libsemigroups::Forest::set(node_type node, node_type parent, label_type gen)

Set the parent and edge label for a node.

Complexity

Constant

Parameters
  • node – the node whose parent and label to set.

  • parent – the parent node

  • gen – the label of the edge from parent to node.

Throws

LibsemigroupsException – if node or parent exceeds number_of_nodes().

Returns

(None)