I want to plot graph inside a while loop, but execution is blocked after plt.show(G) command and resumes when i manually kill the plot window.
Code:
while True:
print G.edges()
Q = #coming from a function
if Q > BestQ:
nx.draw(G)
plt.show(G)
if G.number_of_edges() == 0:
break
This is the output of G.edges() for two iterations:
[(0, 1), (1, 2), (1, 4), (1, 9), (2, 6), (3, 5), (5, 7), (5, 8), (5, 10)]
[(0, 1), (1, 4), (1, 9), (2, 6), (3, 5), (5, 7), (5, 8), (5, 10)]
How to make this continue after plotting???
plt.draw()
,plt.show()
may not be the best option – ThePredator Oct 12 '14 at 8:25