I need to build a graph with 100 nodes and 200 edges from a random adjacency matrix. This matrix can contain only 0s and 1s. Obviously, I did something wrong because the graph I have right now is super weird.
G = nx.Graph()
ctr = 0
V = 100
E = 200
for i in range(0, V) :
if(i == 200) :
break
for j in range(0, V) :
if(i == j) :
continue;
if(ctr < E) :
G.add_edge(i, j)
ctr = ctr + 1
Can you help me with that, please? Would be really thankful for any suggestions
if(i == 200) : breakbecauseiwill only be at maximum 99. Did you meanif(ctr == 200) :?if(ctr < e) :, do you meanif(ctr < E) :? Please make sure your code runs as you expect when you post.