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
i
andj
are nodes inthis
, andlbl
is in the range[0, out_degree())
, then this function adds an edge fromi
toj
labelledlbl
. Complexity
Constant.
 Parameters
i – the source node
j – the range node
lbl – the label of the edge from
i
toj
 Throws
LibsemigroupsException – if
i
,j
, orlbl
is not valid. If an exception is thrown,this
is 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
i
toj
 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 intothis
may 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,this
is guaranteed not to be modified (strong exception guarantee). Returns
(None)

inline void libsemigroups::ActionDigraph::add_to_out_degree(size_t nr)¶
Adds to the outdegree.
 Complexity
\(O(mn)\) where
m
is the number of nodes, andn
is the new out degree of the digraph. Iterator validity
This function modifies the object defined by
this
, any iterators, pointers or references pointing intothis
may be invalidated by a call to this function.
 Parameters
nr – the number of new outedges for every node.
 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)

void libsemigroups::ActionDigraph::init(T m, T n)¶
Reinitialize the digraph to have
m
nodes and outdegreen
.This functions puts a digraph into the state that it would have been in if it had just been newly constructed with the same parameters
m
andn
. Complexity
\(O(mn)\) where
m
is the number of nodes, andn
is the outdegree of the digraph.
 Parameters
m – the number of nodes in the digraph.
n – the outdegree 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 outdegree.
 Complexity
\(O(mn)\) where
m
is the number of nodes andn
is the outdegree. Iterator validity
This function modifies the object defined by
this
, any iterators, pointers or references pointing intothis
may 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 outdegree
 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
n
nodes.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
u
labelleda
with the target of the edge from the nodev
labelleda
. 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)