From 02800bcb7eee97235136abc4c8db21dff782b207 Mon Sep 17 00:00:00 2001 From: Krystian Wasilewski Date: Mon, 20 Jun 2022 01:10:32 +0200 Subject: [PATCH] Added Step counter to the gif. Fixed multiple infected nodes at step 0. --- network_attack_propagation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/network_attack_propagation.py b/network_attack_propagation.py index 13bf9fe..658fee9 100644 --- a/network_attack_propagation.py +++ b/network_attack_propagation.py @@ -94,9 +94,12 @@ def update(num, layout, g_repr, ax, our_graph: Graph): if not our_graph.is_alive(): return - our_graph.infect_step() + if num != 0: + our_graph.infect_step() 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] sizes = [200 if n.is_infected else 50 for n in g_repr] nx.draw(