erdos_renyi_graph
¶
Returns the edges of a random Erdos-Renyi graph: each possible edge
(without self-loops) is present independently with probability
edge_prob.
Randomness comes from mx.random, so results are reproducible with
mx.random.seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_nodes
|
int
|
Number of nodes. |
required |
edge_prob
|
float
|
Probability of each edge. |
required |
directed
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
array
|
The sorted int32 |
Example:
Source code in mlx_graphs/utils/generators.py
from mlx_graphs.utils import erdos_renyi_graph · mlx_graphs/utils/generators.py