Skip to main content
added 180 characters in body
Source Link

While using the NetworkX package I was tasked with creating multiple random graphs with a given n number of nodes and p probability, this is my code:

def random_networks_generator(n,p,num_networks=1, directed=False,seed=30030390):
    Graph_list=[]
    for num in range (0,num_networks):
        G=nx.gnp_random_graph(n,p,seed,directed)
        Graph_list.append(G)
    return Graph_list

But, every iteration creates the same exact graph (even the edges are completely the same)

Does anyone have a clue what might be wrong?

Update:

After trying to use the function without the "seed" parameter the graphs are random, but is there a way to sort the problem while still using the "seed" parameter?

While using the NetworkX package I was tasked with creating multiple random graphs with a given n number of nodes and p probability, this is my code:

def random_networks_generator(n,p,num_networks=1, directed=False,seed=30030390):
    Graph_list=[]
    for num in range (0,num_networks):
        G=nx.gnp_random_graph(n,p,seed,directed)
        Graph_list.append(G)
    return Graph_list

But, every iteration creates the same exact graph (even the edges are completely the same)

Does anyone have a clue what might be wrong?

While using the NetworkX package I was tasked with creating multiple random graphs with a given n number of nodes and p probability, this is my code:

def random_networks_generator(n,p,num_networks=1, directed=False,seed=30030390):
    Graph_list=[]
    for num in range (0,num_networks):
        G=nx.gnp_random_graph(n,p,seed,directed)
        Graph_list.append(G)
    return Graph_list

But, every iteration creates the same exact graph (even the edges are completely the same)

Does anyone have a clue what might be wrong?

Update:

After trying to use the function without the "seed" parameter the graphs are random, but is there a way to sort the problem while still using the "seed" parameter?

While using the NetworkXNetworkX package I was tasked with creating multiple random graphs with a given n number of nodes and p probability, this is my code:

def random_networks_generator(n,p,num_networks=1, directed=False,seed=30030390):
    Graph_list=[]
    for num in range (0,num_networks):
        G=nx.gnp_random_graph(n,p,seed,directed)
        Graph_list.append(G)
    return Graph_list

But, every iteration creates the same exact graph (even the edges are completely the same)

Anyone hasDoes anyone have a clue what might be wrong?

While using the NetworkX package I was tasked with creating multiple random graphs with a given n number of nodes and p probability, this is my code:

def random_networks_generator(n,p,num_networks=1, directed=False,seed=30030390):
Graph_list=[]
for num in range (0,num_networks):
    G=nx.gnp_random_graph(n,p,seed,directed)
    Graph_list.append(G)
return Graph_list

But, every iteration creates the same exact graph (even the edges are completely the same)

Anyone has a clue what might be wrong?

While using the NetworkX package I was tasked with creating multiple random graphs with a given n number of nodes and p probability, this is my code:

def random_networks_generator(n,p,num_networks=1, directed=False,seed=30030390):
    Graph_list=[]
    for num in range (0,num_networks):
        G=nx.gnp_random_graph(n,p,seed,directed)
        Graph_list.append(G)
    return Graph_list

But, every iteration creates the same exact graph (even the edges are completely the same)

Does anyone have a clue what might be wrong?

Source Link

Creating multiple graphs using gnp_random_graph

While using the NetworkX package I was tasked with creating multiple random graphs with a given n number of nodes and p probability, this is my code:

def random_networks_generator(n,p,num_networks=1, directed=False,seed=30030390):
Graph_list=[]
for num in range (0,num_networks):
    G=nx.gnp_random_graph(n,p,seed,directed)
    Graph_list.append(G)
return Graph_list

But, every iteration creates the same exact graph (even the edges are completely the same)

Anyone has a clue what might be wrong?