CS代考 Assignment4

Assignment4

Homework 4¶

Copyright By PowCoder代写 加微信 powcoder

import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import scipy
import EoN as eon

# Read the graph
G = nx.read_edgelist(“fludata.txt”, nodetype=int, data=((“weight”, float),))

A) Plot Infected Individuals Over Time¶

beta = 0.01 # transmission rate
mu = 0.5 # recovery rate
initial_infected = 325

# TODO run 10 simulations and plot the number of infected over time

Comment on your observations about the number of infected:

B) Actual VS Estimated Infected¶

# Compute tau from simulations

# Plot the actual number of infected and the exponential fit computed

# quantify closeness

C) Simulated VS Theoretical Estimates of $\tau$¶

# Run several times (25x or more) to compute distribution of tau

Manually compute the theoretical values of tau here (include the formula and your results):

For random distribution from Canvas:

# calculate random distribution

For arbitrary distribution from Canvas

# calculate arbitrary distribution (from Canvas)

For arbitrary distribution in textbook

# calculate arbitrary distribution (from textbook)

# Plot the experimental distribution (box plot would be preferred) and theoretical values

Which distributions match your simulation results most accurately?

D) Infection at the Endemic State¶

Compute the theoretical expected value of $i(\infty)$:

# Compute the distribution of i(\inf)

# Plot the experimental distribution of i(\inf) and theoretical value

A) Varying Transmission Rate $\beta$¶

# Run simulations by varying beta

# Plot # infected individuals at the epidemic state vs beta

B) Minimum Transmission Rate for Epidemic¶

Compute theoretical values for minimum $\beta$ required for epidemic to occur:

Random distribution:

# for a random degree distribution

Arbitrary distribution:

# for an arbitrary distribution

Beta Theoretical And Experimental Calculation

# Compute the theoretical number of infected individuals with different betas as well as the simulation.
# Plot those two curves in one plot and compare them.

# Find min value of \beta experimentally

Comments on the above.

A) Patient-0 Centrality & $\tau$¶

# Run simulations with each node as initial infected and compute tau

# Compute centrality metrics

# Plot centrality metrics v/s tau – 4 plots

B) Correlation between centrality and $\tau$¶

# Compute the Pearson correlation coefficient

C) Centrality as an Outbreak Predictor¶

The order here, from best to worst is:

Comment on your observations

Part 4 – Knowledge Question¶

Your answer to the modularity proof food for thought here

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com