Added Step counter to the gif.
Fixed multiple infected nodes at step 0.
This commit is contained in:
parent
eb5e546e73
commit
02800bcb7e
@ -94,9 +94,12 @@ def update(num, layout, g_repr, ax, our_graph: Graph):
|
|||||||
if not our_graph.is_alive():
|
if not our_graph.is_alive():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if num != 0:
|
||||||
our_graph.infect_step()
|
our_graph.infect_step()
|
||||||
ax.clear()
|
ax.clear()
|
||||||
|
|
||||||
|
ax.set_title(f'Step: {num}', loc='right', fontsize=30)
|
||||||
|
|
||||||
colors = ['red' if n.is_infected else 'blue' for n in g_repr]
|
colors = ['red' if n.is_infected else 'blue' for n in g_repr]
|
||||||
sizes = [200 if n.is_infected else 50 for n in g_repr]
|
sizes = [200 if n.is_infected else 50 for n in g_repr]
|
||||||
nx.draw(
|
nx.draw(
|
||||||
|
Loading…
Reference in New Issue
Block a user