libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches

This page contains documentation related to safely constructing a WordGraph instance.

See also
The `make` function for an overview of possible uses of the make function.

Functions

template<typename Return>
std::enable_if_t< IsWordGraph< Return >, Return > make (size_t num_nodes, std::initializer_list< std::vector< typename Return::node_type > > targets)
 Constructs a word graph from a number of nodes and targets.
 
template<typename Return>
std::enable_if_t< IsWordGraph< Return >, Return > make (size_t num_nodes, std::vector< std::vector< typename Return::node_type > > const &targets)
 Constructs a word graph from a number of nodes and targets. //NOLINT()
 

Function Documentation

◆ make() [1/2]

template<typename Return>
std::enable_if_t< IsWordGraph< Return >, Return > make ( size_t num_nodes,
std::initializer_list< std::vector< typename Return::node_type > > targets )
nodiscard

This function constructs a word graph from its arguments whose out-degree is specified by the length of the first item in the 2nd parameter.

Template Parameters
Returnthe return type. Must satisfy IsWordGraph<Return>.
Parameters
num_nodesthe number of nodes in the word graph.
targetsthe targets of the word graph.
Returns
A value of type WordGraph.
Exceptions
LibsemigroupsExceptionif WordGraph<Node>::target throws when adding edges from targets.
Complexity
\(O(mn)\) where \(m\) is the length of targets and \(n\) is the parameter num_nodes.
Example
// Construct a word graph with 5 nodes and 10 edges (7 specified)
make<WordGraph<uint8_t>>(5, {{0, 0}, {1, 1}, {2}, {3, 3}});
enable_if_is_same< Return, Blocks > make(Container const &cont)
Check the arguments, construct a Blocks object, and check it.
Definition bipart.hpp:798

◆ make() [2/2]

template<typename Return>
std::enable_if_t< IsWordGraph< Return >, Return > make ( size_t num_nodes,
std::vector< std::vector< typename Return::node_type > > const & targets )
nodiscard

This function constructs a word graph from its arguments whose out-degree is specified by the length of the first item in the 2nd parameter.

Template Parameters
Returnthe return type. Must satisfy IsWordGraph<Return>.
Parameters
num_nodesthe number of nodes in the word graph.
targetsthe targets of the word graph.
Returns
A value of type WordGraph.
Exceptions
LibsemigroupsExceptionif WordGraph<Node>::target throws when adding edges from targets.
Complexity
\(O(mn)\) where \(m\) is the length of targets and \(n\) is the parameter num_nodes.
Example
// Construct a word graph with 5 nodes and 10 edges (7 specified)
make<WordGraph<uint8_t>>(5, {{0, 0}, {1, 1}, {2}, {3, 3}});
//NOLINT()