Initialization¶
This page contains information about initialising the ActionDigraph class.
-
inline void libsemigroups::ActionDigraph::add_edge(node_type i, node_type j, label_type lbl)¶
Add an edge from one node to another with a given label.
If
iandjare nodes inthis, andlblis in the range[0, out_degree()), then this function adds an edge fromitojlabelledlbl.- Complexity
Constant.
- Parameters
i – the source node
j – the range node
lbl – the label of the edge from
itoj
- Throws
LibsemigroupsException – if
i,j, orlblis not valid. If an exception is thrown,thisis guaranteed not to be modified (strong exception guarantee).- Returns
(None)
-
inline void libsemigroups::ActionDigraph::add_edge_nc(node_type i, node_type j, label_type lbl)¶
Add an edge from one node to another with a given label.
- Exceptions
This function guarantees not to throw a LibsemigroupsException.
- Complexity
Constant.
Warning
No checks whatsoever on the validity of the arguments are peformed.
- Parameters
i – the source node
j – the range node
lbl – the label of the edge from
itoj
- Returns
(None)
-
inline void libsemigroups::ActionDigraph::add_nodes(size_t nr)¶
Adds a number of new nodes.
- Exceptions
This function guarantees not to throw a LibsemigroupsException. If an exception is thrown,
thisis guaranteed not to be modified (strong exception guarantee).- Complexity
Linear in
number_of_nodes() + nr.- Iterator validity
This function modifies the object defined by
this, any iterators, pointers or references pointing intothismay be invalidated by a call to this function.
- Parameters
nr – the number of nodes to add.
- Returns
(None)
-
inline void libsemigroups::ActionDigraph::add_to_out_degree(size_t nr)¶
Adds to the out-degree.
- Exceptions
This function guarantees not to throw a LibsemigroupsException. If an exception is thrown,
thisis guaranteed not to be modified (strong exception guarantee).- Complexity
\(O(mn)\) where
mis the number of nodes, andnis the new out degree of the digraph.- Iterator validity
This function modifies the object defined by
this, any iterators, pointers or references pointing intothismay be invalidated by a call to this function.
- Parameters
nr – the number of new out-edges for every node.
- Returns
(None)
-
inline void libsemigroups::ActionDigraph::reserve(T m, T n) const¶
Ensures that the digraph has capacity for a given number of nodes, and out-degree.
- Exceptions
This function guarantees not to throw a LibsemigroupsException.
- Complexity
\(O(mn)\) where
mis the number of nodes andnis the out-degree.- Iterator validity
This function modifies the object defined by
this, any iterators, pointers or references pointing intothismay be invalidated by a call to this function.
Note
Does not modify number_of_nodes() or out_degree().
- Parameters
m – the number of nodes
n – the out-degree
- Returns
(None)
-
inline void libsemigroups::ActionDigraph::restrict(size_t n)¶
Restrict the digraph to its first
nnodes.- Exceptions
This function guarantees not to throw a LibsemigroupsException.
Warning
This function performs no checks whatsoever and will result in a corrupted digraph if there are any edges from the nodes \(0, \ldots, n - 1\) to nodes larger than \(n - 1\).
- Parameters
n – the number of nodes
- Returns
(None)
-
inline void libsemigroups::ActionDigraph::swap_edges_nc(node_type u, node_type v, label_type a)¶
Swaps the edge with specified label from one node with another.
This function swaps the target of the edge from the node
ulabelledawith the target of the edge from the nodevlabelleda.- Exceptions
This function guarantees not to throw a LibsemigroupsException.
- Complexity
Constant
Warning
No checks whatsoever on the validity of the arguments are peformed.
- Parameters
u – the first node
v – the second node
a – the label
- Returns
(None)