Function retworkx::directed_gnm_random_graph [−][src]
pub fn directed_gnm_random_graph(
py: Python<'_>,
num_nodes: isize,
num_edges: isize,
seed: Option<u64>
) -> PyResult<PyDiGraph>
Return a :math:G_{nm}
of a directed graph
Generates a random directed graph out of all the possible graphs with :math:n
nodes and
:math:m
edges. The generated graph will not be a multigraph and will not have self loops.
For :math:n
nodes, the maximum edges that can be returned is :math:n (n - 1)
.
Passing :math:m
higher than that will still return the maximum number of edges.
If :math:m = 0
, the returned graph will always be empty (no edges).
When a seed is provided, the results are reproducible. Passing a seed when :math:m = 0
or :math:m >= n (n - 1)
has no effect, as the result will always be an empty or a complete graph respectively.
This algorithm has a time complexity of :math:O(n + m)
:param int num_nodes: The number of nodes to create in the graph :param int num_edges: The number of edges to create in the graph :param int seed: An optional seed to use for the random number generator
:return: A PyDiGraph object :rtype: PyDiGraph