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.
- Complexity
Constant.
Warning
No checks whatsoever on the validity of the arguments are performed.
- Parameters:
i – the source node
j – the range node
lbl – the label of the edge from
itoj
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException.- Returns:
(None)
-
inline void libsemigroups::ActionDigraph::add_nodes(size_t nr)¶
Adds a number of new nodes.
- 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.
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException. If an exception is thrown,thisis guaranteed not to be modified (strong exception guarantee).- Returns:
(None)
-
inline void libsemigroups::ActionDigraph::add_to_out_degree(size_t nr)¶
Adds to the out-degree.
- 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.
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException. If an exception is thrown,thisis guaranteed not to be modified (strong exception guarantee).- Returns:
(None)
-
void libsemigroups::ActionDigraph::init(T m, T n)¶
Re-initialize the digraph to have
mnodes and out-degreenThis functions puts a digraph into the state that it would have been in if it had just been newly constructed with the same parameters
mandn.- Complexity
\(O(mn)\) where
mis the number of nodes, andnis the out-degree of the digraph.
- Parameters:
m – the number of nodes in the digraph.
n – the out-degree of every node.
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException.
-
inline void libsemigroups::ActionDigraph::remove_edge_nc(node_type i, label_type lbl)¶
Remove an edge from a node with a given label.
- Complexity
Constant.
Warning
No checks whatsoever on the validity of the arguments are performed.
- Parameters:
i – the source node
lbl – the label of the edge from
i
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException.- 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.
- 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
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException.- Returns:
(None)
-
inline void libsemigroups::ActionDigraph::restrict(size_t n)¶
Restrict the digraph to its first
nnodes.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
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException.- 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.- Complexity
Constant
Warning
No checks whatsoever on the validity of the arguments are performed.
- Parameters:
u – the first node
v – the second node
a – the label
- Throws:
(None) – This function guarantees not to throw a
LibsemigroupsException.- Returns:
(None)