Random k-regular network#
- random_regular_graph[vert_type]( size: int, degree: int, random_state) -> undirected_network[vert_type]
-
template<integer_network_vertex VertT, std::uniform_random_bit_generator Gen>
undirected_network<VertT> random_regular_graph(VertT size, VertT degree, Gen &generator)#
Generates a random \(k\)-regular network, a random sample out of the space
of all graphs where all nodes have exactly degree equal to degree
.
The generation of a random \(k\)-regular graph becomes more and more
difficult as the density increases. In C++, you can use the try_
variant of this function to limit runtime to a limited set of tries:
-
template<integer_network_vertex VertT, std::uniform_random_bit_generator Gen>
std::optional<undirected_network<VertT>> try_random_regular_graph(VertT size, VertT degree, Gen &generator, std::size_t max_tries)#
If this function succeeds in max_tries
tries, it will return the
resulting network, otherwise it returns an instance of std::nullopt_t
.