You can download this code by clicking the button below.
This code is now available for download.
This function generates a random graph with a specified number of nodes and edges using the Erdos_Renyi function from the Igraph library.
Technology Stack : Igraph
Code Type : Function
Code Difficulty : Intermediate
import igraph as ig
import random
def generate_random_graph(num_nodes, num_edges):
# Generate a random graph with a specified number of nodes and edges
graph = ig.Graph.Erdos_Renyi(n=num_nodes, m=num_edges)
return graph
# JSON representation of the code