Question: Write PYTHON code to update infected status, infection rate and store the data by using the networkx pseudocode code and description below. import networkx as

Write PYTHON code to update infected status, infection rate and store the data by using the networkx pseudocode code and description below.

Write PYTHON code to update infected status, infection rate and store the

import networkx as nx G = nx.gnm_random_graph(15, 50) for i in range(0, 15): G.nodes[i]['infected'] = False # Person is not infected G.nodes[@]['infected'] = True # Choose the first infected person data = [] t = 0 tmax = 20 while t = 3: P becomes infected at the next time step (t+1). else P will remain healthy in the next time step. end end 11 IT II # Update the infected status # Calculate the infection rate for time step t and store the data t += 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!